/** * Constructor. * * @param start * the start instruction for the subroutine */ public Subroutine(InstructionHandle start) { this.start = start; this.instructionSet = new BitSet(); this.cfgSub = new CFG(); this.blockMap = new IdentityHashMap<>(); this.escapeTargetListMap = new IdentityHashMap<>(); this.returnBlockSet = new BitSet(); this.exitBlockSet = new BitSet(); this.unhandledExceptionBlockSet = new BitSet(); this.workList = new LinkedList<>(); }
/** * 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; }
/** * Constructor. * * @param start * the start instruction for the subroutine */ public Subroutine(InstructionHandle start) { this.start = start; this.instructionSet = new BitSet(); this.cfgSub = new CFG(); this.blockMap = new IdentityHashMap<InstructionHandle, BasicBlock>(); this.escapeTargetListMap = new IdentityHashMap<BasicBlock, List<EscapeTarget>>(); this.returnBlockSet = new BitSet(); this.exitBlockSet = new BitSet(); this.unhandledExceptionBlockSet = new BitSet(); this.workList = new LinkedList<WorkListItem>(); }
/** * 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; }