Guest User

Untitled

a guest
Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1. protected void flowThrough(Lattice in, Unit s, List<Lattice> fallOut,
  2.             List<Lattice> branchOuts) {
  3.         Lattice thenB = fallOut.isEmpty() ? null : fallOut.get(0);
  4.         Lattice elseB = branchOuts.isEmpty() ? null : branchOuts.get(0);
  5.  
  6.         if (thenB == null) {
  7.             return;
  8.         }
  9.         in.copy(thenB);
  10.         if (elseB != null) {
  11.             in.copy(elseB);
  12.         }
  13.  
  14.         if (s instanceof JIfStmt) {
  15.             JIfStmt ifstmt = (JIfStmt) s;
  16.             if (ifstmt.getCondition() instanceof JEqExpr) {
  17.  
  18.                 JEqExpr eq = (JEqExpr) ifstmt.getCondition();
  19.                 JimpleLocal var = null;
  20.                 AState a = null;
  21.  
  22.                 if (eq.getOp1() instanceof JimpleLocal
  23.                         && eq.getOp2() instanceof JimpleLocal) {
  24.                     var = (JimpleLocal) eq.getOp1();
  25.                    
  26.                    
  27.                     JimpleLocal var2 = (JimpleLocal) eq.getOp2();
  28.                     thenB.remove(var2);
  29.                     elseB.remove(var2);
  30.                     thenB.add(var2, a);
  31.                     elseB.add(var2, AState.complement(a));                 
  32.                 } else {
  33.                     if (eq.getOp1() instanceof JimpleLocal) {
  34.                         var = (JimpleLocal) eq.getOp1();
  35.                     }
  36.                     else if (eq.getOp1() instanceof IntConstant) {
  37.                         a = AState.toDivZeroElem((IntConstant) eq.getOp1());
  38.                     }
  39.  
  40.                     if (eq.getOp2() instanceof IntConstant) {
  41.                         a = AState.toDivZeroElem((IntConstant) eq.getOp2());
  42.                     } else if (eq.getOp2Box() instanceof JimpleLocal) {
  43.                         var = (JimpleLocal) eq.getOp2();
  44.                     }
  45.                 }
  46.  
  47.                 thenB.remove(var);
  48.                 elseB.remove(var);
  49.  
  50.                 thenB.add(var, a);
  51.                 elseB.add(var, AState.complement(a));
  52.             }
  53.  
  54.             else if (ifstmt.getCondition() instanceof JNeExpr) {
  55.                 JNeExpr eq = (JNeExpr) ifstmt.getCondition();
  56.                 JimpleLocal var = null;
  57.                 AState a = null;
  58.  
  59.             } else if (ifstmt.getCondition() instanceof JGtExpr) {
  60.                 JGtExpr eq = (JGtExpr) ifstmt.getCondition();
  61.                 JimpleLocal var = null;
  62.                 AState a = null;
  63.  
  64.             } else if (ifstmt.getCondition() instanceof JGeExpr) {
  65.                 JGeExpr eq = (JGeExpr) ifstmt.getCondition();
  66.                 JimpleLocal var = null;
  67.                 AState a = null;
  68.  
  69.             } else if (ifstmt.getCondition() instanceof JLtExpr) {
  70.                 JLtExpr eq = (JLtExpr) ifstmt.getCondition();
  71.                 JimpleLocal var = null;
  72.                 AState a = null;
  73.  
  74.             } else if (ifstmt.getCondition() instanceof JLeExpr) {
  75.                 JLeExpr eq = (JLeExpr) ifstmt.getCondition();
  76.                 JimpleLocal var = null;
  77.                 AState a = null;
  78.             }
  79.         }
  80.     }
Add Comment
Please, Sign In to add comment