if (u instanceof GotoStmt) { GotoStmt gtStmt = (GotoStmt) u; if (gtStmt.getTarget() instanceof AssignStmt) { AssignStmt assign = (AssignStmt) gtStmt.getTarget(); if (assign.getRightOp() instanceof CastExpr) { CastExpr ce = (CastExpr) assign.getRightOp(); while (!gtStmt.getBoxesPointingToThis().isEmpty()) { gtStmt.getBoxesPointingToThis().get(0).setUnit(newStmt);
((GotoStmt) loopTail).setTarget(copiedHead); } else if (loopTail instanceof IfStmt) { if (((IfStmt) loopTail).getTarget() == condition.getHead()) {
= first instanceof GotoStmt ? ((GotoStmt) first).getTargetBox().getUnit() : firstReorderingUnit; final GotoStmt gotoFirstReorderingNotGotoStmt = Jimple.v().newGotoStmt(firstReorderingNotGotoStmt); units.insertBeforeNoRedirect(gotoFirstReorderingNotGotoStmt, reorderingUnit); ? Jimple.v().newGotoStmt(((GotoStmt) reorderingUnit).getTargetBox().getUnit()) : Jimple.v().newGotoStmt(reorderingUnit);
/** * Creates a new jimple GotoStmt and adds all tags from createdFrom to this * statement. * * @param target * @param createdFrom * @return */ protected Unit gotoStmtFor(Unit target, Host createdFrom) { GotoStmt stmt = Jimple.v().newGotoStmt(target); stmt.addAllTagsOf(createdFrom); return stmt; }
private Stmt getFinalTarget(Stmt stmt) { Stmt finalTarget = null, target; // if not a goto, this is the final target if (!(stmt instanceof GotoStmt)) { return stmt; } // first map this statement to itself, so we can detect cycles stmtMap.put(stmt, stmt); target = (Stmt) ((GotoStmt) stmt).getTarget(); // check if target is in statement map if (stmtMap.containsKey(target)) { // see if it maps to itself finalTarget = stmtMap.get(target); if (finalTarget == target) { // this is part of a cycle finalTarget = null; } } else { finalTarget = getFinalTarget(target); } stmtMap.put(stmt, finalTarget); return finalTarget; } // getFinalTarget
((GotoStmt) s).setTarget(b.succ.firstElement().getHeadJStmt()); } else {
@Override protected void internalTransform(Body b, String phaseName, Map<String, String> options) { for (Iterator<Unit> unitIt = b.getUnits().snapshotIterator(); unitIt.hasNext();) { Unit u = unitIt.next(); if (u instanceof GotoStmt) { GotoStmt stmt = (GotoStmt) u; while (stmt.getTarget() instanceof GotoStmt) { GotoStmt nextTarget = (GotoStmt) stmt.getTarget(); stmt.setTarget(nextTarget.getTarget()); } } else if (u instanceof IfStmt) { IfStmt stmt = (IfStmt) u; while (stmt.getTarget() instanceof GotoStmt) { GotoStmt nextTarget = (GotoStmt) stmt.getTarget(); stmt.setTarget(nextTarget.getTarget()); } } } }
@Override public void caseGotoStmt(GotoStmt stmt) { Stmt target = (Stmt) stmt.getTarget(); addInsn(buildGotoInsn(target), stmt); }
private void patch_Stmt(Stmt src, Stmt oldDst, Stmt newDst) { if (src instanceof GotoStmt) { ((GotoStmt) src).setTarget(newDst); return;
public GotoStmt newGotoStmt(GotoStmt s) { return Jimple.v().newGotoStmt(s.getTarget()); }
((GotoStmt)loopTail).setTarget(copiedHead); else if (loopTail instanceof IfStmt) { if (((IfStmt)loopTail).getTarget() == condition.getHead())
s = (Stmt) ((GotoStmt) s).getTarget();
((GotoStmt)loopTail).setTarget(copiedHead); else if (loopTail instanceof IfStmt) { if (((IfStmt)loopTail).getTarget() == condition.getHead())
private boolean checkProtectionArea(AugmentedStmt as, DefinitionStmt s) { IterableSet esuccs = new IterableSet(); esuccs.addAll(as.csuccs); esuccs.removeAll(as.bsuccs); // esuccs contains the exception sucessors of as // System.out.println("ESUCCS are:"+esuccs); Iterator it = esuccs.iterator(); while (it.hasNext()) { // going through each exception sucessor AugmentedStmt tempas = (AugmentedStmt) it.next(); Stmt temps = tempas.get_Stmt(); if (temps instanceof GotoStmt) { Unit target = ((GotoStmt) temps).getTarget(); if (target != s) { // System.out.println("DID NOT Match indirectly"); return false; } else { // System.out.println("Matched indirectly"); } } else { if (temps != s) { // System.out.println("DID NOT Match directly"); return false; } else { // System.out.println("Matched directly"); } } } return true; }
((GotoStmt)s).setTarget(b.succ.firstElement().getHeadJStmt());