@Override protected void afterAdd(final int index, final Instruction item, final boolean appended) { final Instruction next = index < size() - 1 ? get(index + 1) : null; final Instruction previous = index > 0 ? get(index - 1) : null; if (previous != null) { previous.setNext(item); } if (next != null) { next.setPrevious(item); } item.setPrevious(previous); item.setNext(next); }
@Override protected void afterAdd(final int index, final Instruction item, final boolean appended) { final Instruction next = index < size() - 1 ? get(index + 1) : null; final Instruction previous = index > 0 ? get(index - 1) : null; if (previous != null) { previous.setNext(item); } if (next != null) { next.setPrevious(item); } item.setPrevious(previous); item.setNext(next); }
@Override protected void afterAdd(final int index, final Instruction item, final boolean appended) { final Instruction next = index < size() - 1 ? get(index + 1) : null; final Instruction previous = index > 0 ? get(index - 1) : null; if (previous != null) { previous.setNext(item); } if (next != null) { next.setPrevious(item); } item.setPrevious(previous); item.setNext(next); }
final Instruction blockStart = instructions.get(i); final ExceptionHandler blockStartExceptionHandler = findInnermostExceptionHandler(blockStart.getOffset()); final Instruction instruction = instructions.get(i); final OpCode opCode = instruction.getOpCode(); final ControlFlowNode node = new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i));
final Instruction blockStart = instructions.get(i); final ExceptionHandler blockStartExceptionHandler = findInnermostExceptionHandler(blockStart.getOffset()); final Instruction instruction = instructions.get(i); final OpCode opCode = instruction.getOpCode(); final ControlFlowNode node = new ControlFlowNode(_nodes.size(), blockStart, instructions.get(i));
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); }
@Override protected void beforeSet(final int index, final Instruction item) { final Instruction current = get(index); item.setPrevious(current.getPrevious()); item.setNext(current.getNext()); current.setPrevious(null); current.setNext(null); }
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
@Override protected void beforeSet(final int index, final Instruction item) { final Instruction current = get(index); item.setPrevious(current.getPrevious()); item.setNext(current.getNext()); current.setPrevious(null); current.setNext(null); }
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
@Override protected void beforeSet(final int index, final Instruction item) { final Instruction current = get(index); item.setPrevious(current.getPrevious()); item.setNext(current.getNext()); current.setPrevious(null); current.setNext(null); }