final InstructionBlock newHandlerBlock; if (oldTry.getFirstInstruction() == jump || oldTry.getLastInstruction() == jump) { newTryBlock = new InstructionBlock( oldTry.getFirstInstruction() == jump ? start : oldTry.getFirstInstruction(), oldTry.getLastInstruction() == jump ? end : oldTry.getLastInstruction() ); if (oldHandler.getFirstInstruction() == jump || oldHandler.getLastInstruction() == jump) { newHandlerBlock = new InstructionBlock( oldHandler.getFirstInstruction() == jump ? start : oldHandler.getFirstInstruction(), oldHandler.getLastInstruction() == jump ? end : oldHandler.getLastInstruction() );
@Override public boolean test(final InstructionBlock b) { return b.contains(instruction); } };
private static ExceptionHandler findFirstHandler(final InstructionBlock tryBlock, final Collection<ExceptionHandler> handlers) { ExceptionHandler result = null; for (final ExceptionHandler handler : handlers) { if (handler.getTryBlock().equals(tryBlock) && (result == null || handler.getHandlerBlock().getFirstInstruction().getOffset() < result.getHandlerBlock().getFirstInstruction().getOffset())) { result = handler; } } return result; }
public final boolean intersects(final InstructionBlock block) { return block != null && block.getFirstInstruction().getOffset() <= getLastInstruction().getOffset() && block.getLastInstruction().getOffset() >= getFirstInstruction().getOffset(); }
final ExceptionHandler next = handlers.get(i + 1); if (current.getHandlerBlock().equals(next.getHandlerBlock())) { final Instruction lastInCurrent = current.getTryBlock().getLastInstruction(); final Instruction firstInNext = next.getTryBlock().getFirstInstruction(); final Instruction branchInBetween = firstInNext.getPrevious(); new InstructionBlock( current.getTryBlock().getFirstInstruction(), next.getTryBlock().getLastInstruction() ), new InstructionBlock( current.getHandlerBlock().getFirstInstruction(), current.getHandlerBlock().getLastInstruction() new InstructionBlock( current.getTryBlock().getFirstInstruction(), next.getTryBlock().getLastInstruction() ), new InstructionBlock( current.getHandlerBlock().getFirstInstruction(), current.getHandlerBlock().getLastInstruction() ), current.getCatchType()
final ControlFlowNode adjacentFinally = findInnermostFinallyHandlerNode(handler.getTryBlock().getLastInstruction().getOffset()); targetAddress = target.getExceptionHandler().getHandlerBlock().getFirstInstruction(); if (finallyBlock.getExceptionHandler().getHandlerBlock().contains(end)) { createEdge(node, finallyBlock.getEndFinallyNode(), JumpType.Normal); !parentHandler.getExceptionHandler().getTryBlock().contains(targetAddress)) { parentHandler.getExceptionHandler().getTryBlock().getLastInstruction().getOffset() ); parentHandler.getExceptionHandler().getTryBlock().contains(targetAddress)) { findNode(finallyBlock.getExceptionHandler().getHandlerBlock().getLastInstruction()), finallyBlock.getEndFinallyNode(), JumpType.Normal
final InstructionBlock otherHandler = other.getHandlerBlock(); if (handlerBlock.getFirstInstruction().getOffset() < otherHandler.getFirstInstruction().getOffset() && handlerBlock.intersects(otherHandler) && !(handlerBlock.contains(otherTry) && handlerBlock.contains(otherHandler)) && !otherTry.contains(tryBlock)) { ExceptionHandler.createCatch( tryBlock, new InstructionBlock( handlerBlock.getFirstInstruction(), otherHandler.getFirstInstruction().getPrevious() ), handler.getCatchType()
tryBlock.contains(exit.getEnd())) { tryBlock.contains(exit.getEnd())) { final ControlFlowNode endCatch = findNode( cfg, edge.getSource().getExceptionHandler().getHandlerBlock().getLastInstruction() ); if (handlerInfo.handler.getTryBlock().contains(endCatch.getEnd())) { toProcess.add(endCatch);
@Override public boolean test(final ExceptionHandler handler) { return handler.getHandlerBlock().getFirstInstruction() == next; } }
private static List<ExceptionHandler> findHandlers(final InstructionBlock tryBlock, final Collection<ExceptionHandler> handlers) { List<ExceptionHandler> result = null; for (final ExceptionHandler handler : handlers) { if (handler.getTryBlock().equals(tryBlock)) { if (result == null) { result = new ArrayList<>(); } result.add(handler); } } if (result == null) { return Collections.emptyList(); } Collections.sort( result, new Comparator<ExceptionHandler>() { @Override public int compare(@NotNull final ExceptionHandler o1, @NotNull final ExceptionHandler o2) { return Integer.compare( o1.getHandlerBlock().getFirstInstruction().getOffset(), o2.getHandlerBlock().getFirstInstruction().getOffset() ); } } ); return result; }
@Override public boolean test(final ByteCode code) { return code.instruction == e.getHandlerBlock().getLastInstruction(); } }
new InstructionBlock( _instructions.atOffset(entry.getStartOffset()), afterTry != null ? afterTry.getPrevious() : last(_instructions) ), new InstructionBlock( _instructions.atOffset(entry.getHandlerOffset()), _instructions.atOffset(entry.getHandlerOffset()) new InstructionBlock( _instructions.atOffset(entry.getStartOffset()), afterTry != null ? afterTry.getPrevious() : last(_instructions) ), new InstructionBlock( _instructions.atOffset(entry.getHandlerOffset()), _instructions.atOffset(entry.getHandlerOffset())
final ExceptionHandler next = handlers.get(i + 1); if (current.getHandlerBlock().equals(next.getHandlerBlock())) { final Instruction lastInCurrent = current.getTryBlock().getLastInstruction(); final Instruction firstInNext = next.getTryBlock().getFirstInstruction(); final Instruction branchInBetween = firstInNext.getPrevious(); new InstructionBlock( current.getTryBlock().getFirstInstruction(), next.getTryBlock().getLastInstruction() ), new InstructionBlock( current.getHandlerBlock().getFirstInstruction(), current.getHandlerBlock().getLastInstruction() new InstructionBlock( current.getTryBlock().getFirstInstruction(), next.getTryBlock().getLastInstruction() ), new InstructionBlock( current.getHandlerBlock().getFirstInstruction(), current.getHandlerBlock().getLastInstruction() ), current.getCatchType()
public final boolean contains(final InstructionBlock block) { return block != null && block.getFirstInstruction().getOffset() >= getFirstInstruction().getOffset() && block.getLastInstruction().getOffset() <= getLastInstruction().getOffset(); }
final ControlFlowNode adjacentFinally = findInnermostFinallyHandlerNode(handler.getTryBlock().getLastInstruction().getOffset()); targetAddress = target.getExceptionHandler().getHandlerBlock().getFirstInstruction(); if (finallyBlock.getExceptionHandler().getHandlerBlock().contains(end)) { createEdge(node, finallyBlock.getEndFinallyNode(), JumpType.Normal); !parentHandler.getExceptionHandler().getTryBlock().contains(targetAddress)) { parentHandler.getExceptionHandler().getTryBlock().getLastInstruction().getOffset() ); parentHandler.getExceptionHandler().getTryBlock().contains(targetAddress)) { findNode(finallyBlock.getExceptionHandler().getHandlerBlock().getLastInstruction()), finallyBlock.getEndFinallyNode(), JumpType.Normal
final InstructionBlock otherHandler = other.getHandlerBlock(); if (handlerBlock.getFirstInstruction().getOffset() < otherHandler.getFirstInstruction().getOffset() && handlerBlock.intersects(otherHandler) && !(handlerBlock.contains(otherTry) && handlerBlock.contains(otherHandler)) && !otherTry.contains(tryBlock)) { ExceptionHandler.createCatch( tryBlock, new InstructionBlock( handlerBlock.getFirstInstruction(), otherHandler.getFirstInstruction().getPrevious() ), handler.getCatchType()
tryBlock.contains(exit.getEnd())) { tryBlock.contains(exit.getEnd())) { final ControlFlowNode endCatch = findNode( cfg, edge.getSource().getExceptionHandler().getHandlerBlock().getLastInstruction() ); if (handlerInfo.handler.getTryBlock().contains(endCatch.getEnd())) { toProcess.add(endCatch);
@Override public boolean test(final ExceptionHandler handler) { return handler.getHandlerBlock().getFirstInstruction() == next; } }
private static List<ExceptionHandler> findHandlers(final InstructionBlock tryBlock, final Collection<ExceptionHandler> handlers) { List<ExceptionHandler> result = null; for (final ExceptionHandler handler : handlers) { if (handler.getTryBlock().equals(tryBlock)) { if (result == null) { result = new ArrayList<>(); } result.add(handler); } } if (result == null) { return Collections.emptyList(); } Collections.sort( result, new Comparator<ExceptionHandler>() { @Override public int compare(@NotNull final ExceptionHandler o1, @NotNull final ExceptionHandler o2) { return Integer.compare( o1.getHandlerBlock().getFirstInstruction().getOffset(), o2.getHandlerBlock().getFirstInstruction().getOffset() ); } } ); return result; }
@Override public boolean test(final ByteCode code) { return code.instruction == e.getHandlerBlock().getLastInstruction(); } }