public ControlFlowGraph(final ControlFlowNode... nodes) { _nodes = ArrayUtilities.asUnmodifiableList(VerifyArgument.noNullElements(nodes, "nodes")); assert nodes.length >= 3; assert getEntryPoint().getNodeType() == ControlFlowNodeType.EntryPoint; assert getRegularExit().getNodeType() == ControlFlowNodeType.RegularExit; assert getExceptionalExit().getNodeType() == ControlFlowNodeType.ExceptionalExit; }
public ControlFlowGraph(final ControlFlowNode... nodes) { _nodes = ArrayUtilities.asUnmodifiableList(VerifyArgument.noNullElements(nodes, "nodes")); assert nodes.length >= 3; assert getEntryPoint().getNodeType() == ControlFlowNodeType.EntryPoint; assert getRegularExit().getNodeType() == ControlFlowNodeType.RegularExit; assert getExceptionalExit().getNodeType() == ControlFlowNodeType.ExceptionalExit; }
public ControlFlowGraph(final ControlFlowNode... nodes) { _nodes = ArrayUtilities.asUnmodifiableList(VerifyArgument.noNullElements(nodes, "nodes")); assert nodes.length >= 3; assert getEntryPoint().getNodeType() == ControlFlowNodeType.EntryPoint; assert getRegularExit().getNodeType() == ControlFlowNodeType.RegularExit; assert getExceptionalExit().getNodeType() == ControlFlowNodeType.ExceptionalExit; }
for (final ControlFlowNode exit : cfg.getExceptionalExit().getPredecessors()) { if (exit.getNodeType() == ControlFlowNodeType.Normal && tryBlock.contains(exit.getEnd())) {
for (final ControlFlowNode exit : cfg.getExceptionalExit().getPredecessors()) { if (exit.getNodeType() == ControlFlowNodeType.Normal && tryBlock.contains(exit.getEnd())) {
for (final ControlFlowNode exit : cfg.getExceptionalExit().getPredecessors()) { if (exit.getNodeType() == ControlFlowNodeType.Normal && tryBlock.contains(exit.getEnd())) {
private static boolean shouldIncludeExceptionalExit(final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getStart().getOffset()); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } if (node.getStart().getNext() != node.getEnd()) { return false; } if (head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW) { return InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); } return false; }
private static boolean shouldIncludeExceptionalExit(final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getStart().getOffset()); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } if (node.getStart().getNext() != node.getEnd()) { return false; } if (head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW) { return InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); } return false; }
private static ControlFlowNode findInnermostExceptionHandlerNode( final ControlFlowGraph cfg, final int offsetInTryBlock, final boolean finallyOnly) { ExceptionHandler result = null; ControlFlowNode resultNode = null; final List<ControlFlowNode> nodes = cfg.getNodes(); for (int i = nodes.size() - 1; i >= 0; i--) { final ControlFlowNode node = nodes.get(i); final ExceptionHandler handler = node.getExceptionHandler(); if (handler == null) { break; } if (finallyOnly && handler.isCatch()) { continue; } final InstructionBlock tryBlock = handler.getTryBlock(); if (tryBlock.getFirstInstruction().getOffset() <= offsetInTryBlock && offsetInTryBlock < tryBlock.getLastInstruction().getEndOffset() && (result == null || tryBlock.getFirstInstruction().getOffset() > result.getTryBlock().getFirstInstruction().getOffset())) { result = handler; resultNode = node; } } return resultNode != null ? resultNode : cfg.getExceptionalExit(); }
private static ControlFlowNode findInnermostExceptionHandlerNode( final ControlFlowGraph cfg, final int offsetInTryBlock, final boolean finallyOnly) { ExceptionHandler result = null; ControlFlowNode resultNode = null; final List<ControlFlowNode> nodes = cfg.getNodes(); for (int i = nodes.size() - 1; i >= 0; i--) { final ControlFlowNode node = nodes.get(i); final ExceptionHandler handler = node.getExceptionHandler(); if (handler == null) { break; } if (finallyOnly && handler.isCatch()) { continue; } final InstructionBlock tryBlock = handler.getTryBlock(); if (tryBlock.getFirstInstruction().getOffset() <= offsetInTryBlock && offsetInTryBlock < tryBlock.getLastInstruction().getEndOffset() && (result == null || tryBlock.getFirstInstruction().getOffset() > result.getTryBlock().getFirstInstruction().getOffset())) { result = handler; resultNode = node; } } return resultNode != null ? resultNode : cfg.getExceptionalExit(); }
private static ControlFlowNode findInnermostExceptionHandlerNode( final ControlFlowGraph cfg, final int offsetInTryBlock, final boolean finallyOnly) { ExceptionHandler result = null; ControlFlowNode resultNode = null; final List<ControlFlowNode> nodes = cfg.getNodes(); for (int i = nodes.size() - 1; i >= 0; i--) { final ControlFlowNode node = nodes.get(i); final ExceptionHandler handler = node.getExceptionHandler(); if (handler == null) { break; } if (finallyOnly && handler.isCatch()) { continue; } final InstructionBlock tryBlock = handler.getTryBlock(); if (tryBlock.getFirstInstruction().getOffset() <= offsetInTryBlock && offsetInTryBlock < tryBlock.getLastInstruction().getEndOffset() && (result == null || tryBlock.getFirstInstruction().getOffset() > result.getTryBlock().getFirstInstruction().getOffset())) { result = handler; resultNode = node; } } return resultNode != null ? resultNode : cfg.getExceptionalExit(); }
private static boolean shouldIncludeExceptionalExit(final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getStart().getOffset()); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } if (node.getStart().getNext() != node.getEnd()) { return false; } if (head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW) { return InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); } return false; }
private static boolean shouldIncludeExceptionalExit( final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getEnd().getOffset(), false); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } return head.getNodeType() == ControlFlowNodeType.Normal && node.getNodeType() == ControlFlowNodeType.Normal && node.getStart().getNext() == node.getEnd() && head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW && InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); }
private static boolean shouldIncludeExceptionalExit( final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getEnd().getOffset(), false); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } return head.getNodeType() == ControlFlowNodeType.Normal && node.getNodeType() == ControlFlowNodeType.Normal && node.getStart().getNext() == node.getEnd() && head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW && InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); }
private static boolean shouldIncludeExceptionalExit( final ControlFlowGraph cfg, final ControlFlowNode head, final ControlFlowNode node) { if (node.getNodeType() != ControlFlowNodeType.Normal) { return false; } if (!node.getDominanceFrontier().contains(cfg.getExceptionalExit()) && !node.dominates(cfg.getExceptionalExit())) { final ControlFlowNode innermostHandlerNode = findInnermostExceptionHandlerNode(cfg, node.getEnd().getOffset(), false); if (innermostHandlerNode == null || !node.getDominanceFrontier().contains(innermostHandlerNode)) { return false; } } return head.getNodeType() == ControlFlowNodeType.Normal && node.getNodeType() == ControlFlowNodeType.Normal && node.getStart().getNext() == node.getEnd() && head.getStart().getOpCode().isStore() && node.getStart().getOpCode().isLoad() && node.getEnd().getOpCode() == OpCode.ATHROW && InstructionHelper.getLoadOrStoreSlot(head.getStart()) == InstructionHelper.getLoadOrStoreSlot(node.getStart()); }