private ControlFlowGraphBuilder(final List<Instruction> instructions, final List<ExceptionHandler> exceptionHandlers) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _exceptionHandlers = coalesceExceptionHandlers(VerifyArgument.notNull(exceptionHandlers, "exceptionHandlers")); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[_offsets.length]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private ControlFlowGraphBuilder(final List<Instruction> instructions, final List<ExceptionHandler> exceptionHandlers) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _exceptionHandlers = coalesceExceptionHandlers(VerifyArgument.notNull(exceptionHandlers, "exceptionHandlers")); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[_offsets.length]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private ControlFlowGraphBuilder(final List<Instruction> instructions, final List<ExceptionHandler> exceptionHandlers) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _exceptionHandlers = coalesceExceptionHandlers(VerifyArgument.notNull(exceptionHandlers, "exceptionHandlers")); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[_offsets.length]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private ExceptionHandlerMapper(final InstructionCollection instructions, final List<ExceptionTableEntry> tableEntries) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _tableEntries = VerifyArgument.notNull(tableEntries, "tableEntries"); _handlerPlaceholders = createHandlerPlaceholders(); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[instructions.size()]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -2, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private ExceptionHandlerMapper(final InstructionCollection instructions, final List<ExceptionTableEntry> tableEntries) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _tableEntries = VerifyArgument.notNull(tableEntries, "tableEntries"); _handlerPlaceholders = createHandlerPlaceholders(); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[instructions.size()]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -2, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private ExceptionHandlerMapper(final InstructionCollection instructions, final List<ExceptionTableEntry> tableEntries) { _instructions = VerifyArgument.notNull(instructions, "instructions"); _tableEntries = VerifyArgument.notNull(tableEntries, "tableEntries"); _handlerPlaceholders = createHandlerPlaceholders(); _offsets = new int[instructions.size()]; _hasIncomingJumps = new boolean[instructions.size()]; for (int i = 0; i < instructions.size(); i++) { _offsets[i] = instructions.get(i).getOffset(); } _entryPoint = new ControlFlowNode(_nextBlockId++, 0, ControlFlowNodeType.EntryPoint); _regularExit = new ControlFlowNode(_nextBlockId++, -1, ControlFlowNodeType.RegularExit); _exceptionalExit = new ControlFlowNode(_nextBlockId++, -2, ControlFlowNodeType.ExceptionalExit); _nodes.add(_entryPoint); _nodes.add(_regularExit); _nodes.add(_exceptionalExit); }
private void collectNodes(final ControlFlowNode node) { if (node == end || node == newEnd) { throw new IllegalStateException("Unexpected cycle involving finally constructs!"); } if (oldToNew.containsKey(node)) { return; } final int newBlockIndex = _nodes.size(); final ControlFlowNode copy; switch (node.getNodeType()) { case Normal: copy = new ControlFlowNode(newBlockIndex, node.getStart(), node.getEnd()); break; case FinallyHandler: copy = new ControlFlowNode(newBlockIndex, node.getExceptionHandler(), node.getEndFinallyNode()); break; default: throw ContractUtils.unsupported(); } copy.setCopyFrom(node); _nodes.add(copy); oldToNew.put(node, copy); if (node != start) { for (final ControlFlowNode predecessor : node.getPredecessors()) { collectNodes(predecessor); } } }
final ControlFlowNode entryPoint = new ControlFlowNode(index++, 0, ControlFlowNodeType.EntryPoint); final ControlFlowNode regularExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.RegularExit); final ControlFlowNode exceptionalExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.ExceptionalExit); final ControlFlowNode cfNode = new ControlFlowNode(index++, -1, ControlFlowNodeType.Normal);
private void collectNodes(final ControlFlowNode node) { if (node == end || node == newEnd) { throw new IllegalStateException("Unexpected cycle involving finally constructs!"); } if (oldToNew.containsKey(node)) { return; } final int newBlockIndex = _nodes.size(); final ControlFlowNode copy; switch (node.getNodeType()) { case Normal: copy = new ControlFlowNode(newBlockIndex, node.getStart(), node.getEnd()); break; case FinallyHandler: copy = new ControlFlowNode(newBlockIndex, node.getExceptionHandler(), node.getEndFinallyNode()); break; default: throw ContractUtils.unsupported(); } copy.setCopyFrom(node); _nodes.add(copy); oldToNew.put(node, copy); if (node != start) { for (final ControlFlowNode predecessor : node.getPredecessors()) { collectNodes(predecessor); } } }
_nodes.add(new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i))); endFinallyNode = new ControlFlowNode( index, handler.getHandlerBlock().getLastInstruction().getEndOffset(), _nodes.add(new ControlFlowNode(index, handler, endFinallyNode));
final ControlFlowNode entryPoint = new ControlFlowNode(index++, 0, ControlFlowNodeType.EntryPoint); final ControlFlowNode regularExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.RegularExit); final ControlFlowNode exceptionalExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.ExceptionalExit); final ControlFlowNode cfNode = new ControlFlowNode(index++, -1, ControlFlowNodeType.Normal);
final ControlFlowNode entryPoint = new ControlFlowNode(index++, 0, ControlFlowNodeType.EntryPoint); final ControlFlowNode regularExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.RegularExit); final ControlFlowNode exceptionalExit = new ControlFlowNode(index++, -1, ControlFlowNodeType.ExceptionalExit); final ControlFlowNode cfNode = new ControlFlowNode(index++, -1, ControlFlowNodeType.Normal);
_nodes.add(new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i))); endFinallyNode = new ControlFlowNode( index, handler.getHandlerBlock().getLastInstruction().getEndOffset(), _nodes.add(new ControlFlowNode(index, handler, endFinallyNode));
private void collectNodes(final ControlFlowNode node) { if (node == end || node == newEnd) { throw new IllegalStateException("Unexpected cycle involving finally constructs!"); } if (oldToNew.containsKey(node)) { return; } final int newBlockIndex = _nodes.size(); final ControlFlowNode copy; switch (node.getNodeType()) { case Normal: copy = new ControlFlowNode(newBlockIndex, node.getStart(), node.getEnd()); break; case FinallyHandler: copy = new ControlFlowNode(newBlockIndex, node.getExceptionHandler(), node.getEndFinallyNode()); break; default: throw ContractUtils.unsupported(); } copy.setCopyFrom(node); _nodes.add(copy); oldToNew.put(node, copy); if (node != start) { for (final ControlFlowNode predecessor : node.getPredecessors()) { collectNodes(predecessor); } } }
_nodes.add(new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i))); endFinallyNode = new ControlFlowNode( index, handler.getHandlerBlock().getLastInstruction().getEndOffset(), _nodes.add(new ControlFlowNode(index, handler, endFinallyNode));
final ControlFlowNode node = new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i)); _nodes.add(new ControlFlowNode(index, handler, null));
final ControlFlowNode node = new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i)); _nodes.add(new ControlFlowNode(index, handler, null));
final ControlFlowNode node = new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i)); _nodes.add(new ControlFlowNode(index, handler, null));