private Unit generateExceptionalReturn(Unit u, SootClass exception) { if (!generatedThrowStatements.containsKey(exception)) { List<Unit> units = new LinkedList<Unit>(); Local exceptionLocal = getFreshLocal(body, exception.getType()); units.addAll(createNewException(body, exceptionLocal, exception, u)); units.addAll(updateExceptionVariableAndReturn(body, exceptionLocal, u)); Unit target = units.get(0); body.getUnits().addAll(units); generatedThrowStatements.put(exception, target); } return generatedThrowStatements.get(exception); }
private Unit updateExceptionVariableAndGoToTrap(Unit u, Value v, Trap t) { if (!caughtExceptionLocal.containsKey(t.getHandlerUnit())) { // only create one local per trap so that we can // replace the CaughtExceptionRef later. caughtExceptionLocal.put(t.getHandlerUnit(), getFreshLocal(body, SootTranslationHelpers.v().getExceptionGlobal().getType())); } Local execptionLocal = caughtExceptionLocal.get(t.getHandlerUnit()); List<Unit> units = new LinkedList<Unit>(); units.add(assignStmtFor(execptionLocal, v, u)); units.add(gotoStmtFor(t.getHandlerUnit(), u)); body.getUnits().addAll(units); return units.get(0); }
private Unit createNewExceptionAndGoToTrap(Unit u, SootClass exception, Trap t) { // add a block that creates an exception object // and assigns it to $exception. if (!caughtExceptionLocal.containsKey(t.getHandlerUnit())) { // only create one local per trap so that we can // replace the CaughtExceptionRef later. caughtExceptionLocal.put(t.getHandlerUnit(), getFreshLocal(body, SootTranslationHelpers.v().getExceptionGlobal().getType())); } Local execptionLocal = caughtExceptionLocal.get(t.getHandlerUnit()); List<Unit> excCreation = createNewException(body, execptionLocal, exception, u); excCreation.add(gotoStmtFor(t.getHandlerUnit(), u)); body.getUnits().addAll(excCreation); return excCreation.get(0); }
List<Unit> vcall = createVirtualCall(body, callee, originalCall, ivk); if (counter < callees.size()) { body.getUnits().addAll(vcall); Local l = getFreshLocal(body, BooleanType.v()); List<Unit> stmts = new LinkedList<Unit>();