/** Replaces <code>out</code> in the Chain by <code>in</code>. */ @Override public void swapWith(E out, E in) { innerChain.swapWith(out, in); out.redirectJumpsToThisTo(in); }
/** * Replaces conditional branches by unconditional branches as given by the mapping. **/ protected void replaceStmts(Map<Stmt, GotoStmt> stmtsToReplace) { Chain units = sb.getUnits(); Iterator<Stmt> stmtsIt = stmtsToReplace.keySet().iterator(); while (stmtsIt.hasNext()) { // important not to call clearUnitBoxes() on booted since // replacement uses the same UnitBox Unit booted = stmtsIt.next(); Unit replacement = stmtsToReplace.get(booted); units.swapWith(booted, replacement); } } }
units.swapWith(s, newInvoke);
containerUnits.swapWith(s, Jimple.v().newAssignStmt(((IdentityStmt) s).getLeftOp(), thisToAdd)); } else if (rhs instanceof ParameterRef) { ParameterRef pref = (ParameterRef) rhs; containerUnits.swapWith(s, Jimple.v().newAssignStmt(((IdentityStmt) s).getLeftOp(), ie.getArg(pref.getIndex()))); containerUnits.swapWith(s, Jimple.v().newGotoStmt(exitPoint)); continue; AssignStmt as = Jimple.v().newAssignStmt(lhs, ro); containerUnits.insertBefore(as, s); containerUnits.swapWith(s, Jimple.v().newGotoStmt(exitPoint)); } else if (s instanceof ReturnVoidStmt) { containerUnits.swapWith(s, Jimple.v().newGotoStmt(exitPoint));
IdentityStmt is = (IdentityStmt) st; if (is.getRightOp() instanceof ThisRef) { units.swapWith(st, Jimple.v().newIdentityStmt(is.getLeftOp(), Jimple.v().newParameterRef(is.getRightOp().getType(), 0))); } else {
units.swapWith(s, newstmt); s = newstmt; changed = true;
newInvoke.addAllTagsOf(s); units.swapWith(s, newInvoke);
newInvoke.addAllTagsOf(s); units.swapWith(s, newInvoke);
if(elim==1) newstmt=Jimple.v().newGotoStmt(is.getTarget()); if(newstmt!=null) { units.swapWith(s,newstmt); s=newstmt; changed=true;
if(elim==1) newstmt=Jimple.v().newGotoStmt(is.getTarget()); if(newstmt!=null) { units.swapWith(s,newstmt); s=newstmt; changed=true;