/** * Add a unique edge to the graph. There must be no other edge already in * the CFG with the same source and destination blocks. * * @param source * the source basic block * @param dest * the destination basic block * @param type * the type of edge; see constants in EdgeTypes interface * @return the newly created Edge * @throws IllegalStateException * if there is already an edge in the CFG with the same source * and destination block */ public Edge createEdge(BasicBlock source, BasicBlock dest, @Edge.Type int type) { Edge edge = createEdge(source, dest); edge.setType(type); return edge; }
/** * Add an edge to the subroutine's CFG. * * @param sourceBlock * the source basic block * @param destBlock * the destination basic block * @param edgeType * the type of edge */ public void addEdge(BasicBlock sourceBlock, BasicBlock destBlock, @Edge.Type int edgeType) { if (VERIFY_INTEGRITY) { if (destBlock.isExceptionHandler() && edgeType != HANDLED_EXCEPTION_EDGE) { throw new IllegalStateException("In method " + SignatureConverter.convertMethodSignature(methodGen) + ": exception handler " + destBlock.getFirstInstruction() + " reachable by non exception edge type " + edgeType); } } cfgSub.createEdge(sourceBlock, destBlock, edgeType); }
/** * Inline all JSR subroutines into the top-level subroutine. This produces a * complete CFG for the entire method, in which all JSR subroutines are * inlined. * * @return the CFG for the method */ private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit()); BasicBlock resultStartBlock = rootContext.getBlock(topLevelSubroutine.getStartBlock()); result.createEdge(result.getEntry(), resultStartBlock, START_EDGE); inline(rootContext); return result; }
result.createEdge(resultBlock, resultJSRStartBlock, GOTO_EDGE); result.createEdge(resultBlock, resultTarget, edge.getType()); result.createEdge(resultBlock, resultCallerTargetBlock, escapeTarget.getEdgeType()); result.createEdge(resultBlock, result.getExit(), RETURN_EDGE); result.createEdge(resultBlock, result.getExit(), EXIT_EDGE); result.createEdge(resultBlock, result.getExit(), UNHANDLED_EXCEPTION_EDGE);
/** * Add a unique edge to the graph. There must be no other edge already in * the CFG with the same source and destination blocks. * * @param source * the source basic block * @param dest * the destination basic block * @param type * the type of edge; see constants in EdgeTypes interface * @return the newly created Edge * @throws IllegalStateException * if there is already an edge in the CFG with the same source * and destination block */ public Edge createEdge(BasicBlock source, BasicBlock dest, @Edge.Type int type) { Edge edge = createEdge(source, dest); edge.setType(type); return edge; }
/** * Add an edge to the subroutine's CFG. * * @param sourceBlock * the source basic block * @param destBlock * the destination basic block * @param edgeType * the type of edge */ public void addEdge(BasicBlock sourceBlock, BasicBlock destBlock, @Edge.Type int edgeType) { if (VERIFY_INTEGRITY) { if (destBlock.isExceptionHandler() && edgeType != HANDLED_EXCEPTION_EDGE) { throw new IllegalStateException("In method " + SignatureConverter.convertMethodSignature(methodGen) + ": exception handler " + destBlock.getFirstInstruction() + " reachable by non exception edge type " + edgeType); } } cfgSub.createEdge(sourceBlock, destBlock, edgeType); }
/** * Inline all JSR subroutines into the top-level subroutine. This produces a * complete CFG for the entire method, in which all JSR subroutines are * inlined. * * @return the CFG for the method */ private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit()); BasicBlock resultStartBlock = rootContext.getBlock(topLevelSubroutine.getStartBlock()); result.createEdge(result.getEntry(), resultStartBlock, START_EDGE); inline(rootContext); return result; }
result.createEdge(resultBlock, resultJSRStartBlock, GOTO_EDGE); result.createEdge(resultBlock, resultTarget, edge.getType()); result.createEdge(resultBlock, resultCallerTargetBlock, escapeTarget.getEdgeType()); result.createEdge(resultBlock, result.getExit(), RETURN_EDGE); result.createEdge(resultBlock, result.getExit(), EXIT_EDGE); result.createEdge(resultBlock, result.getExit(), UNHANDLED_EXCEPTION_EDGE);