Search in sources :

Example 11 with WithExceptionNode

use of org.graalvm.compiler.nodes.WithExceptionNode in project graal by oracle.

the class InliningUtil method handleMissingAfterExceptionFrameState.

@SuppressWarnings("try")
public static FrameState handleMissingAfterExceptionFrameState(FrameState nonReplaceableFrameState, Invoke invoke, EconomicMap<Node, Node> replacements, boolean alwaysDuplicateStateAfter) {
    StructuredGraph graph = nonReplaceableFrameState.graph();
    NodeWorkList workList = graph.createNodeWorkList();
    workList.add(nonReplaceableFrameState);
    for (Node node : workList) {
        FrameState fs = (FrameState) node;
        for (Node usage : fs.usages().snapshot()) {
            if (!usage.isAlive()) {
                continue;
            }
            if (usage instanceof FrameState) {
                workList.add(usage);
            } else {
                StateSplit stateSplit = (StateSplit) usage;
                FixedNode fixedStateSplit = stateSplit.asFixedNode();
                if (fixedStateSplit instanceof AbstractMergeNode) {
                    AbstractMergeNode merge = (AbstractMergeNode) fixedStateSplit;
                    while (merge.isAlive()) {
                        AbstractEndNode end = merge.forwardEnds().first();
                        try (DebugCloseable position = end.withNodeSourcePosition()) {
                            DeoptimizeNode deoptimizeNode = addDeoptimizeNode(graph, DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler);
                            end.replaceAtPredecessor(deoptimizeNode);
                            GraphUtil.killCFG(end);
                        }
                    }
                } else if (fixedStateSplit instanceof ExceptionObjectNode) {
                    /**
                     * The target invoke does not have an exception edge. This means that the
                     * bytecode parser made the wrong assumption of making an exception for the
                     * partial intrinsic exit. We therefore replace the WithExceptionNode with a
                     * non throwing version -- the deoptimization occurs when the invoke throws.
                     */
                    WithExceptionNode oldException = (WithExceptionNode) fixedStateSplit.predecessor();
                    FixedNode newNode = oldException.replaceWithNonThrowing();
                    if (replacements != null && oldException != newNode) {
                        replacements.put(oldException, newNode);
                    }
                    if (newNode instanceof StateSplit) {
                        handleAfterBciFrameState(((StateSplit) newNode).stateAfter(), invoke, alwaysDuplicateStateAfter);
                    }
                } else {
                    try (DebugCloseable position = fixedStateSplit.withNodeSourcePosition()) {
                        FixedNode deoptimizeNode = addDeoptimizeNode(graph, DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler);
                        if (fixedStateSplit instanceof AbstractBeginNode) {
                            deoptimizeNode = BeginNode.begin(deoptimizeNode);
                        }
                        fixedStateSplit.replaceAtPredecessor(deoptimizeNode);
                        GraphUtil.killCFG(fixedStateSplit);
                    }
                }
            }
        }
    }
    return nonReplaceableFrameState;
}
Also used : AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) BeginNode(org.graalvm.compiler.nodes.BeginNode) MonitorIdNode(org.graalvm.compiler.nodes.java.MonitorIdNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) FixedGuardNode(org.graalvm.compiler.nodes.FixedGuardNode) PiNode(org.graalvm.compiler.nodes.PiNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) MonitorExitNode(org.graalvm.compiler.nodes.java.MonitorExitNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) GuardedNode(org.graalvm.compiler.nodes.extended.GuardedNode) GuardingNode(org.graalvm.compiler.nodes.extended.GuardingNode) StartNode(org.graalvm.compiler.nodes.StartNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) DeoptimizeNode(org.graalvm.compiler.nodes.DeoptimizeNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) AbstractEndNode(org.graalvm.compiler.nodes.AbstractEndNode) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) FrameState(org.graalvm.compiler.nodes.FrameState) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) NodeWorkList(org.graalvm.compiler.graph.NodeWorkList) AbstractEndNode(org.graalvm.compiler.nodes.AbstractEndNode) DeoptimizeNode(org.graalvm.compiler.nodes.DeoptimizeNode) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) StateSplit(org.graalvm.compiler.nodes.StateSplit)

Example 12 with WithExceptionNode

use of org.graalvm.compiler.nodes.WithExceptionNode in project graal by oracle.

the class PlaceholderLogicNode method rewireFrameStatesAfterFSA.

private void rewireFrameStatesAfterFSA(ValueNode replacee, UnmodifiableEconomicMap<Node, Node> duplicates) {
    DeoptimizingNode replaceeDeopt = (DeoptimizingNode) replacee;
    GraalError.guarantee(replaceeDeopt.canDeoptimize(), "Method expects the replacee to have deopt state");
    FrameState stateBefore = null;
    FrameState stateDuring = null;
    FrameState stateAfter = null;
    if (replaceeDeopt instanceof DeoptimizingNode.DeoptBefore) {
        stateBefore = ((DeoptimizingNode.DeoptBefore) replaceeDeopt).stateBefore();
    }
    if (replaceeDeopt instanceof DeoptimizingNode.DeoptDuring) {
        stateDuring = ((DeoptimizingNode.DeoptDuring) replaceeDeopt).stateDuring();
    }
    if (replaceeDeopt instanceof DeoptimizingNode.DeoptAfter) {
        stateAfter = ((DeoptimizingNode.DeoptAfter) replaceeDeopt).stateAfter();
    }
    if (stateAfter == null && stateDuring == null && stateBefore == null) {
        /*
             * There should only be no state available to transfer during testing or if the
             * replacee's graph itself is a substitution.
             */
        StructuredGraph graph = replacee.graph();
        boolean condition = graph.isStateAfterClearedForTesting() || graph.isSubstitution();
        GraalError.guarantee(condition, "No state available to transfer");
        return;
    }
    final ExceptionObjectNode exceptionObject;
    if (replacee instanceof WithExceptionNode) {
        WithExceptionNode withExceptionNode = (WithExceptionNode) replacee;
        if (withExceptionNode.exceptionEdge() instanceof ExceptionObjectNode) {
            exceptionObject = (ExceptionObjectNode) withExceptionNode.exceptionEdge();
        } else {
            GraalError.guarantee(withExceptionNode.exceptionEdge() instanceof UnreachableBeginNode, "Unexpected exception edge %s", withExceptionNode.exceptionEdge());
            exceptionObject = null;
        }
    } else {
        exceptionObject = null;
    }
    for (DeoptimizingNode deoptNode : deoptNodes) {
        DeoptimizingNode deoptDup = (DeoptimizingNode) duplicates.get(deoptNode.asNode());
        if (deoptDup.canDeoptimize()) {
            if (deoptDup instanceof ExceptionObjectNode) {
                ExceptionObjectNode newExceptionObject = (ExceptionObjectNode) deoptDup;
                rewireExceptionFrameState(exceptionObject, newExceptionObject, newExceptionObject);
                continue;
            }
            if (deoptDup instanceof DeoptimizingNode.DeoptBefore) {
                GraalError.guarantee(stateBefore != null, "Invalid stateBefore being transferred.");
                ((DeoptimizingNode.DeoptBefore) deoptDup).setStateBefore(stateBefore);
            }
            if (deoptDup instanceof DeoptimizingNode.DeoptDuring) {
                // compute a state "during" for a DeoptDuring inside the snippet depending
                // on what kind of states we had on the node we are replacing.
                // If the original node had a state "during" already, we just use that,
                // otherwise we need to find a strategy to compute a state during based on
                // some other state (before or after).
                DeoptimizingNode.DeoptDuring deoptDupDuring = (DeoptimizingNode.DeoptDuring) deoptDup;
                if (stateDuring != null) {
                    deoptDupDuring.setStateDuring(stateDuring);
                } else if (stateAfter != null) {
                    deoptDupDuring.computeStateDuring(stateAfter);
                } else if (stateBefore != null) {
                    boolean guarantee = ((DeoptBefore) replaceeDeopt).canUseAsStateDuring() || !deoptDupDuring.hasSideEffect();
                    GraalError.guarantee(guarantee, "Can't use stateBefore as stateDuring for state split %s", deoptDupDuring);
                    deoptDupDuring.setStateDuring(stateBefore);
                } else {
                    throw GraalError.shouldNotReachHere("No stateDuring assigned.");
                }
            }
            if (deoptDup instanceof DeoptimizingNode.DeoptAfter) {
                DeoptimizingNode.DeoptAfter deoptDupAfter = (DeoptimizingNode.DeoptAfter) deoptDup;
                if (stateAfter != null) {
                    deoptDupAfter.setStateAfter(stateAfter);
                } else {
                    boolean guarantee = stateBefore != null && !deoptDupAfter.hasSideEffect();
                    GraalError.guarantee(guarantee, "Can't use stateBefore as stateAfter for state split %s", deoptDupAfter);
                    deoptDupAfter.setStateAfter(stateBefore);
                }
            }
        }
    }
}
Also used : InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) DeoptBefore(org.graalvm.compiler.nodes.DeoptimizingNode.DeoptBefore) FrameState(org.graalvm.compiler.nodes.FrameState) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode)

Example 13 with WithExceptionNode

use of org.graalvm.compiler.nodes.WithExceptionNode in project graal by oracle.

the class PlaceholderLogicNode method assignNecessaryFrameStates.

private void assignNecessaryFrameStates(ValueNode replacee, UnmodifiableEconomicMap<Node, Node> duplicates, FixedNode replaceeGraphCFGPredecessor) {
    FrameState stateAfter = null;
    if (replacee instanceof StateSplit && ((StateSplit) replacee).hasSideEffect()) {
        stateAfter = ((StateSplit) replacee).stateAfter();
        GraalError.guarantee(stateAfter != null, "Statesplit with side-effect %s needs a framestate", replacee);
    } else {
        /*
             * We dont have a state split as a replacee, thus we take the prev state as the state
             * after for the node in the snippet.
             */
        stateAfter = GraphUtil.findLastFrameState(replaceeGraphCFGPredecessor);
    }
    final ExceptionObjectNode exceptionObject;
    if (replacee instanceof WithExceptionNode) {
        WithExceptionNode withExceptionNode = (WithExceptionNode) replacee;
        if (withExceptionNode.exceptionEdge() instanceof ExceptionObjectNode) {
            exceptionObject = (ExceptionObjectNode) withExceptionNode.exceptionEdge();
        } else {
            GraalError.guarantee(withExceptionNode.exceptionEdge() instanceof UnreachableBeginNode, "Unexpected exception edge %s", withExceptionNode.exceptionEdge());
            exceptionObject = null;
        }
    } else {
        exceptionObject = null;
    }
    NodeMap<NodeStateAssignment> assignedStateMappings = frameStateAssignment.getStateMapping();
    MapCursor<Node, NodeStateAssignment> stateAssignments = assignedStateMappings.getEntries();
    while (stateAssignments.advance()) {
        Node nodeRequiringState = stateAssignments.getKey();
        if (nodeRequiringState instanceof DeoptBciSupplier) {
            if (replacee instanceof DeoptBciSupplier) {
                ((DeoptBciSupplier) duplicates.get(nodeRequiringState)).setBci(((DeoptBciSupplier) replacee).bci());
            }
        }
        NodeStateAssignment assignment = stateAssignments.getValue();
        switch(assignment) {
            case AFTER_BCI:
                setReplaceeGraphStateAfter(nodeRequiringState, replacee, duplicates, stateAfter);
                break;
            case AFTER_EXCEPTION_BCI:
                if (nodeRequiringState instanceof ExceptionObjectNode) {
                    ExceptionObjectNode newExceptionObject = (ExceptionObjectNode) duplicates.get(nodeRequiringState);
                    rewireExceptionFrameState(exceptionObject, newExceptionObject, newExceptionObject);
                } else if (nodeRequiringState instanceof MergeNode) {
                    MergeNode mergeNode = (MergeNode) duplicates.get(nodeRequiringState);
                    rewireExceptionFrameState(exceptionObject, getExceptionValueFromMerge(mergeNode), mergeNode);
                } else {
                    GraalError.shouldNotReachHere("Unexpected exception state node: " + nodeRequiringState);
                }
                break;
            case BEFORE_BCI:
                FrameState stateBeforeSnippet = GraphUtil.findLastFrameState(replaceeGraphCFGPredecessor);
                ((StateSplit) duplicates.get(nodeRequiringState)).setStateAfter(stateBeforeSnippet.duplicate());
                break;
            case INVALID:
                /*
                     * We cannot assign a proper frame state for this snippet's node since there are
                     * effects which cannot be represented by a single state at the node
                     */
                throw GraalError.shouldNotReachHere("Invalid snippet replacing a node before frame state assignment with node " + nodeRequiringState + " for replacee " + replacee);
            default:
                throw GraalError.shouldNotReachHere("Unknown StateAssigment:" + assignment);
        }
        replacee.graph().getDebug().dump(DebugContext.VERY_DETAILED_LEVEL, replacee.graph(), "After duplicating after state for node %s in snippet", duplicates.get(nodeRequiringState));
    }
}
Also used : MergeNode(org.graalvm.compiler.nodes.MergeNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) DeoptBciSupplier(org.graalvm.compiler.nodes.DeoptBciSupplier) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) MemoryAnchorNode(org.graalvm.compiler.nodes.memory.MemoryAnchorNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) AbstractBoxingNode(org.graalvm.compiler.nodes.extended.AbstractBoxingNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) LogicConstantNode(org.graalvm.compiler.nodes.LogicConstantNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) AbstractNewObjectNode(org.graalvm.compiler.nodes.java.AbstractNewObjectNode) ExplodeLoopNode(org.graalvm.compiler.replacements.nodes.ExplodeLoopNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) LoopExitNode(org.graalvm.compiler.nodes.LoopExitNode) LoadSnippetVarargParameterNode(org.graalvm.compiler.replacements.nodes.LoadSnippetVarargParameterNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) LoadIndexedNode(org.graalvm.compiler.nodes.java.LoadIndexedNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) IfNode(org.graalvm.compiler.nodes.IfNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) GuardedNode(org.graalvm.compiler.nodes.extended.GuardedNode) MemoryMapControlSinkNode(org.graalvm.compiler.nodes.MemoryMapControlSinkNode) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) MemoryPhiNode(org.graalvm.compiler.nodes.memory.MemoryPhiNode) StartNode(org.graalvm.compiler.nodes.StartNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) StoreIndexedNode(org.graalvm.compiler.nodes.java.StoreIndexedNode) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) MemoryMapNode(org.graalvm.compiler.nodes.memory.MemoryMapNode) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) FrameState(org.graalvm.compiler.nodes.FrameState) NodeStateAssignment(org.graalvm.compiler.phases.common.SnippetFrameStateAssignment.NodeStateAssignment) StateSplit(org.graalvm.compiler.nodes.StateSplit)

Example 14 with WithExceptionNode

use of org.graalvm.compiler.nodes.WithExceptionNode in project graal by oracle.

the class PlaceholderLogicNode method instantiate.

/**
 * Replaces a given fixed node with this specialized snippet.
 *
 * @param metaAccess
 * @param replacee the node that will be replaced
 * @param replacer object that replaces the usages of {@code replacee}
 * @param args the arguments to be bound to the flattened positional parameters of the snippet
 * @param killReplacee is true, the replacee node is deleted
 * @return the map of duplicated nodes (original -&gt; duplicate)
 */
@SuppressWarnings("try")
public UnmodifiableEconomicMap<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args, boolean killReplacee) {
    if (!(replacee instanceof ControlSinkNode)) {
        /*
             * For all use cases of this, the replacee is killed sooner ({@code killReplacee ==
             * true}) or later (by the caller of this method). However, we cannot do that if the
             * snippet does not have a return node we because that means we kill the {@code
             * replacee.next()} which might be connected to a merge whose next node has not yet been
             * lowered [GR-33909].
             */
        GraalError.guarantee(this.returnNode != null, "Cannot kill %s because snippet %s does not have a return node", replacee, this);
    }
    DebugContext debug = replacee.getDebug();
    assert assertSnippetKills(replacee);
    try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
        args.info.instantiationCounter.increment(debug);
        // Inline the snippet nodes, replacing parameters with the given args in the process
        final FixedNode replaceeGraphPredecessor = (FixedNode) replacee.predecessor();
        StartNode entryPointNode = snippet.start();
        FixedNode firstCFGNode = entryPointNode.next();
        StructuredGraph replaceeGraph = replacee.graph();
        EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
        replacements.put(entryPointNode, AbstractBeginNode.prevBegin(replacee));
        EconomicMap<Node, Node> duplicates = inlineSnippet(replacee, debug, replaceeGraph, replacements);
        // Re-wire the control flow graph around the replacee
        FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
        replacee.replaceAtPredecessor(firstCFGNodeDuplicate);
        if (replacee.graph().getGuardsStage().areFrameStatesAtSideEffects()) {
            boolean replaceeHasSideEffect = replacee instanceof StateSplit && ((StateSplit) replacee).hasSideEffect();
            boolean replacementHasSideEffect = !sideEffectNodes.isEmpty();
            if (replacementHasSideEffect) {
                GraalError.guarantee(replaceeHasSideEffect, "Lowering node %s without side-effect to snippet %s with sideeffects=%s", replacee, info, this.sideEffectNodes);
            }
        }
        updateStamps(replacee, duplicates);
        rewireMemoryGraph(replacee, duplicates);
        rewireFrameStates(replacee, duplicates, replaceeGraphPredecessor);
        // Replace all usages of the replacee with the value returned by the snippet
        ValueNode returnValue = null;
        AbstractBeginNode originalWithExceptionNextNode = null;
        if (returnNode != null && !(replacee instanceof ControlSinkNode)) {
            ReturnNode returnDuplicate = (ReturnNode) duplicates.get(returnNode);
            returnValue = returnDuplicate.result();
            if (returnValue == null && replacee.usages().isNotEmpty() && replacee instanceof MemoryKill) {
                replacer.replace(replacee, null);
            } else {
                assert returnValue != null || replacee.hasNoUsages();
                replacer.replace(replacee, returnValue);
            }
            if (returnDuplicate.isAlive()) {
                FixedNode next = null;
                if (replacee instanceof FixedWithNextNode) {
                    FixedWithNextNode fwn = (FixedWithNextNode) replacee;
                    next = fwn.next();
                    fwn.setNext(null);
                } else if (replacee instanceof WithExceptionNode) {
                    WithExceptionNode withExceptionNode = (WithExceptionNode) replacee;
                    next = originalWithExceptionNextNode = withExceptionNode.next();
                    withExceptionNode.setNext(null);
                }
                returnDuplicate.replaceAndDelete(next);
            }
        }
        if (unwindPath != null && unwindPath.isAlive()) {
            GraalError.guarantee(replacee.graph().isBeforeStage(StageFlag.FLOATING_READS) || replacee instanceof WithExceptionNode, "Using a snippet with an UnwindNode after floating reads would require support for the memory graph (unless the replacee has an exception edge)");
            GraalError.guarantee(replacee instanceof WithExceptionNode, "Snippet has an UnwindNode, but replacee is not a node with an exception handler");
            // snippet exception handler
            UnwindNode snippetUnwindDuplicate = (UnwindNode) duplicates.get(unwindPath);
            ValueNode snippetExceptionValue = snippetUnwindDuplicate.exception();
            FixedWithNextNode snippetUnwindPath = (FixedWithNextNode) snippetUnwindDuplicate.predecessor();
            GraalError.guarantee(!(snippetExceptionValue instanceof ExceptionObjectNode) || snippetUnwindPath == snippetExceptionValue, "Snippet unwind predecessor must be the exception object %s: %s", snippetUnwindPath, snippetExceptionValue);
            GraalError.guarantee(!(snippetUnwindPath instanceof MergeNode) || snippetExceptionValue instanceof PhiNode, "If the snippet unwind predecessor is a merge node, the exception object must be a phi %s: %s", snippetUnwindPath, snippetExceptionValue);
            // replacee exception handler
            WithExceptionNode replaceeWithExceptionNode = (WithExceptionNode) replacee;
            AbstractBeginNode exceptionEdge = replaceeWithExceptionNode.exceptionEdge();
            if (exceptionEdge instanceof ExceptionObjectNode) {
                /*
                     * The exception object node is a begin node, i.e., it can be used as an anchor
                     * for other nodes, thus we need to re-route them to a valid anchor, i.e. the
                     * begin node of the unwind block.
                     */
                GraalError.guarantee(exceptionEdge.usages().filter(x -> x instanceof GuardedNode && ((GuardedNode) x).getGuard() == exceptionEdge).count() == 0, "Must not have guards attached to exception object node %s", exceptionEdge);
                replaceeWithExceptionNode.setExceptionEdge(null);
                // replace the old exception object with the one
                exceptionEdge.replaceAtUsages(snippetExceptionValue);
                GraalError.guarantee(originalWithExceptionNextNode != null, "Need to have next node to link placeholder to: %s", replacee);
                // replace exceptionEdge with snippetUnwindPath
                replaceExceptionObjectNode(exceptionEdge, snippetUnwindPath);
                GraphUtil.killCFG(snippetUnwindDuplicate);
            } else {
                GraalError.guarantee(exceptionEdge instanceof UnreachableBeginNode, "Unexpected exception edge: %s", exceptionEdge);
                markExceptionsUnreachable(unwindPath.exception(), duplicates);
            }
        } else {
            /*
                 * Since the snippet unwindPath is null or has been deleted, a placeholder
                 * WithExceptionNode needs to be added for any WithExceptionNode replacee. This
                 * placeholder WithExceptionNode temporarily preserves the replacee's original
                 * exception edge and is needed because lowering should not remove edges from the
                 * original CFG.
                 */
            if (replacee instanceof WithExceptionNode) {
                GraalError.guarantee(originalWithExceptionNextNode != null, "Need to have next node to link placeholder to: %s", replacee);
                WithExceptionNode newExceptionNode = replacee.graph().add(new PlaceholderWithExceptionNode());
                /*
                     * First attaching placeholder as predecessor of original WithExceptionNode next
                     * edge.
                     */
                ((FixedWithNextNode) originalWithExceptionNextNode.predecessor()).setNext(newExceptionNode);
                newExceptionNode.setNext(originalWithExceptionNextNode);
                /* Now connecting exception edge. */
                WithExceptionNode oldExceptionNode = (WithExceptionNode) replacee;
                AbstractBeginNode exceptionEdge = oldExceptionNode.exceptionEdge();
                oldExceptionNode.setExceptionEdge(null);
                newExceptionNode.setExceptionEdge(exceptionEdge);
            }
        }
        if (artificialReturnCondition != null) {
            ((PlaceholderLogicNode) duplicates.get(artificialReturnCondition)).markForDeletion();
        }
        if (fallbackInvoke != null) {
            GraalError.guarantee(replacee instanceof MacroWithExceptionNode, "%s can only be used in snippets replacing %s", FallbackInvokeWithExceptionNode.class.getSimpleName(), MacroWithExceptionNode.class.getSimpleName());
            WithExceptionNode fallbackInvokeNode = (WithExceptionNode) duplicates.get(fallbackInvoke);
            MacroWithExceptionNode macroNode = (MacroWithExceptionNode) replacee;
            // create fallback invoke
            InvokeWithExceptionNode invoke = macroNode.createInvoke(returnValue);
            // replace placeholder
            replaceeGraph.replaceWithExceptionSplit(fallbackInvokeNode, invoke);
            // register the invoke as the replacement for the fallback invoke
            duplicates.put(fallbackInvoke, invoke);
        }
        if (killReplacee) {
            // Remove the replacee from its graph
            GraphUtil.killCFG(replacee);
        }
        debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After lowering %s with %s", replacee, this);
        return duplicates;
    }
}
Also used : SingleMemoryKill(org.graalvm.compiler.nodes.memory.SingleMemoryKill) MultiMemoryKill(org.graalvm.compiler.nodes.memory.MultiMemoryKill) MemoryKill(org.graalvm.compiler.nodes.memory.MemoryKill) NodeCycles(org.graalvm.compiler.nodeinfo.NodeCycles) Arrays(java.util.Arrays) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) InputType(org.graalvm.compiler.nodeinfo.InputType) DeadCodeEliminationPhase(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase) LocationIdentity(org.graalvm.word.LocationIdentity) SingleMemoryKill(org.graalvm.compiler.nodes.memory.SingleMemoryKill) DeoptBefore(org.graalvm.compiler.nodes.DeoptimizingNode.DeoptBefore) IterativeConditionalEliminationPhase(org.graalvm.compiler.phases.common.IterativeConditionalEliminationPhase) Local(jdk.vm.ci.meta.Local) IS_IN_NATIVE_IMAGE(jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE) Canonicalizable(org.graalvm.compiler.nodes.spi.Canonicalizable) MemoryAnchorNode(org.graalvm.compiler.nodes.memory.MemoryAnchorNode) WriteBarrierAdditionPhase(org.graalvm.compiler.phases.common.WriteBarrierAdditionPhase) Map(java.util.Map) ConstantParameter(org.graalvm.compiler.api.replacements.Snippet.ConstantParameter) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) MemoryMap(org.graalvm.compiler.nodes.memory.MemoryMap) MultiMemoryKill(org.graalvm.compiler.nodes.memory.MultiMemoryKill) NodeSourcePosition(org.graalvm.compiler.graph.NodeSourcePosition) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) ReentrantNodeIterator(org.graalvm.compiler.phases.graph.ReentrantNodeIterator) StageFlag(org.graalvm.compiler.nodes.StructuredGraph.StageFlag) Simplifiable(org.graalvm.compiler.nodes.spi.Simplifiable) OptionKey(org.graalvm.compiler.options.OptionKey) NodeView(org.graalvm.compiler.nodes.NodeView) Fold(org.graalvm.compiler.api.replacements.Fold) Stamp(org.graalvm.compiler.core.common.type.Stamp) Snippet(org.graalvm.compiler.api.replacements.Snippet) FrameState(org.graalvm.compiler.nodes.FrameState) AbstractBoxingNode(org.graalvm.compiler.nodes.extended.AbstractBoxingNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) LoopTransformations(org.graalvm.compiler.loop.phases.LoopTransformations) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) GuardsStage(org.graalvm.compiler.nodes.StructuredGraph.GuardsStage) LogicConstantNode(org.graalvm.compiler.nodes.LogicConstantNode) LoweringTool(org.graalvm.compiler.nodes.spi.LoweringTool) GraalOptions(org.graalvm.compiler.core.common.GraalOptions) StateSplit(org.graalvm.compiler.nodes.StateSplit) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) Description(org.graalvm.compiler.debug.DebugContext.Description) CanonicalizerTool(org.graalvm.compiler.nodes.spi.CanonicalizerTool) SimplifierTool(org.graalvm.compiler.nodes.spi.SimplifierTool) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) RetryableBailoutException(org.graalvm.compiler.core.common.RetryableBailoutException) SnippetParameterInfo(org.graalvm.compiler.nodes.spi.SnippetParameterInfo) CYCLES_IGNORED(org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED) NodeClass(org.graalvm.compiler.graph.NodeClass) TypeReference(org.graalvm.compiler.core.common.type.TypeReference) ALTERNATE(java.util.FormattableFlags.ALTERNATE) MergeNode(org.graalvm.compiler.nodes.MergeNode) Position(org.graalvm.compiler.graph.Position) InliningLog(org.graalvm.compiler.nodes.InliningLog) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) AbstractNewObjectNode(org.graalvm.compiler.nodes.java.AbstractNewObjectNode) ExplodeLoopNode(org.graalvm.compiler.replacements.nodes.ExplodeLoopNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) NodeInfo(org.graalvm.compiler.nodeinfo.NodeInfo) PlaceholderStamp(org.graalvm.compiler.nodes.PiNode.PlaceholderStamp) DeoptBciSupplier(org.graalvm.compiler.nodes.DeoptBciSupplier) MemoryKill(org.graalvm.compiler.nodes.memory.MemoryKill) Replacements(org.graalvm.compiler.nodes.spi.Replacements) SnippetFrameStateAssignmentClosure(org.graalvm.compiler.phases.common.SnippetFrameStateAssignment.SnippetFrameStateAssignmentClosure) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) SnippetFrameStateAssignment(org.graalvm.compiler.phases.common.SnippetFrameStateAssignment) LoopExitNode(org.graalvm.compiler.nodes.LoopExitNode) NodeStateAssignment(org.graalvm.compiler.phases.common.SnippetFrameStateAssignment.NodeStateAssignment) VarargsParameter(org.graalvm.compiler.api.replacements.Snippet.VarargsParameter) LoadSnippetVarargParameterNode(org.graalvm.compiler.replacements.nodes.LoadSnippetVarargParameterNode) ValueNodeUtil(org.graalvm.compiler.nodes.ValueNodeUtil) PartialEscapePhase(org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase) PhiNode(org.graalvm.compiler.nodes.PhiNode) Providers(org.graalvm.compiler.phases.util.Providers) SIZE_IGNORED(org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED) Array(java.lang.reflect.Array) Constant(jdk.vm.ci.meta.Constant) NodeIntrinsic(org.graalvm.compiler.graph.Node.NodeIntrinsic) EconomicSet(org.graalvm.collections.EconomicSet) LocationIdentity.any(org.graalvm.word.LocationIdentity.any) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) Formatter(java.util.Formatter) Required(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase.Optionality.Required) StampFactory(org.graalvm.compiler.core.common.type.StampFactory) JavaKind(jdk.vm.ci.meta.JavaKind) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Option(org.graalvm.compiler.options.Option) EconomicMap(org.graalvm.collections.EconomicMap) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) PhaseSuite(org.graalvm.compiler.phases.PhaseSuite) LoopEx(org.graalvm.compiler.nodes.loop.LoopEx) Method(java.lang.reflect.Method) LoadIndexedNode(org.graalvm.compiler.nodes.java.LoadIndexedNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) Mark(org.graalvm.compiler.graph.Graph.Mark) ConstantReflectionProvider(jdk.vm.ci.meta.ConstantReflectionProvider) IfNode(org.graalvm.compiler.nodes.IfNode) GraphUtil(org.graalvm.compiler.nodes.util.GraphUtil) Predicate(java.util.function.Predicate) Collection(java.util.Collection) CounterKey(org.graalvm.compiler.debug.CounterKey) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) SchedulingStrategy(org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) JavaConstant(jdk.vm.ci.meta.JavaConstant) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) List(java.util.List) DebugContext.applyFormattingFlagsAndWidth(org.graalvm.compiler.debug.DebugContext.applyFormattingFlagsAndWidth) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) GuardedNode(org.graalvm.compiler.nodes.extended.GuardedNode) GraalError(org.graalvm.compiler.debug.GraalError) MemoryMapControlSinkNode(org.graalvm.compiler.nodes.MemoryMapControlSinkNode) MemoryAccess(org.graalvm.compiler.nodes.memory.MemoryAccess) Formattable(java.util.Formattable) Signature(jdk.vm.ci.meta.Signature) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) CollectionsUtil(org.graalvm.util.CollectionsUtil) MemoryPhiNode(org.graalvm.compiler.nodes.memory.MemoryPhiNode) StartNode(org.graalvm.compiler.nodes.StartNode) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) AtomicReference(java.util.concurrent.atomic.AtomicReference) Assertions(org.graalvm.compiler.debug.Assertions) ArrayLengthProvider(org.graalvm.compiler.nodes.spi.ArrayLengthProvider) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) MemoryMapImpl(org.graalvm.compiler.phases.common.FloatingReadPhase.MemoryMapImpl) InliningUtil(org.graalvm.compiler.phases.common.inlining.InliningUtil) NodePositionClosure(org.graalvm.compiler.nodes.VirtualState.NodePositionClosure) GuardLoweringPhase(org.graalvm.compiler.phases.common.GuardLoweringPhase) IncrementalCanonicalizerPhase(org.graalvm.compiler.phases.common.IncrementalCanonicalizerPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) StampTool(org.graalvm.compiler.nodes.type.StampTool) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) RemoveValueProxyPhase(org.graalvm.compiler.phases.common.RemoveValueProxyPhase) CStringConstant(org.graalvm.compiler.replacements.nodes.CStringConstant) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) Equivalence(org.graalvm.collections.Equivalence) NodeMap(org.graalvm.compiler.graph.NodeMap) OptionValues(org.graalvm.compiler.options.OptionValues) Iterator(java.util.Iterator) StoreIndexedNode(org.graalvm.compiler.nodes.java.StoreIndexedNode) FloatingReadPhase(org.graalvm.compiler.phases.common.FloatingReadPhase) MapCursor(org.graalvm.collections.MapCursor) ProfileData(org.graalvm.compiler.nodes.ProfileData) TimerKey(org.graalvm.compiler.debug.TimerKey) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) NodePredicates.isNotA(org.graalvm.compiler.graph.iterators.NodePredicates.isNotA) CoreProviders(org.graalvm.compiler.nodes.spi.CoreProviders) StampPair(org.graalvm.compiler.core.common.type.StampPair) MemoryMapNode(org.graalvm.compiler.nodes.memory.MemoryMapNode) Placeholder(org.graalvm.compiler.nodes.PiNode.Placeholder) NodeSize(org.graalvm.compiler.nodeinfo.NodeSize) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) MemoryEdgeProxy(org.graalvm.compiler.nodes.spi.MemoryEdgeProxy) UnmodifiableEconomicMap(org.graalvm.collections.UnmodifiableEconomicMap) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) BitSet(java.util.BitSet) WordBase(org.graalvm.word.WordBase) Collections(java.util.Collections) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) MemoryAnchorNode(org.graalvm.compiler.nodes.memory.MemoryAnchorNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) AbstractBoxingNode(org.graalvm.compiler.nodes.extended.AbstractBoxingNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) LogicConstantNode(org.graalvm.compiler.nodes.LogicConstantNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) AbstractNewObjectNode(org.graalvm.compiler.nodes.java.AbstractNewObjectNode) ExplodeLoopNode(org.graalvm.compiler.replacements.nodes.ExplodeLoopNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) LoopExitNode(org.graalvm.compiler.nodes.LoopExitNode) LoadSnippetVarargParameterNode(org.graalvm.compiler.replacements.nodes.LoadSnippetVarargParameterNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) LoadIndexedNode(org.graalvm.compiler.nodes.java.LoadIndexedNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) IfNode(org.graalvm.compiler.nodes.IfNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) GuardedNode(org.graalvm.compiler.nodes.extended.GuardedNode) MemoryMapControlSinkNode(org.graalvm.compiler.nodes.MemoryMapControlSinkNode) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) MemoryPhiNode(org.graalvm.compiler.nodes.memory.MemoryPhiNode) StartNode(org.graalvm.compiler.nodes.StartNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) StoreIndexedNode(org.graalvm.compiler.nodes.java.StoreIndexedNode) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) MemoryMapNode(org.graalvm.compiler.nodes.memory.MemoryMapNode) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) UnreachableBeginNode(org.graalvm.compiler.nodes.UnreachableBeginNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) MemoryMapControlSinkNode(org.graalvm.compiler.nodes.MemoryMapControlSinkNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) StartNode(org.graalvm.compiler.nodes.StartNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) MemoryPhiNode(org.graalvm.compiler.nodes.memory.MemoryPhiNode) GuardedNode(org.graalvm.compiler.nodes.extended.GuardedNode) DebugContext(org.graalvm.compiler.debug.DebugContext) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) MacroWithExceptionNode(org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) FallbackInvokeWithExceptionNode(org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) StateSplit(org.graalvm.compiler.nodes.StateSplit)

Example 15 with WithExceptionNode

use of org.graalvm.compiler.nodes.WithExceptionNode in project graal by oracle.

the class IntrinsicGraphBuilder method updateLastInstruction.

private <T extends ValueNode> void updateLastInstruction(T v) {
    if (v instanceof FixedNode) {
        FixedNode fixedNode = (FixedNode) v;
        if (lastInstr != null) {
            lastInstr.setNext(fixedNode);
        }
        if (fixedNode instanceof FixedWithNextNode) {
            FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) fixedNode;
            assert fixedWithNextNode.next() == null : "cannot append instruction to instruction which isn't end";
            lastInstr = fixedWithNextNode;
        } else if (fixedNode instanceof WithExceptionNode) {
            WithExceptionNode withExceptionNode = (WithExceptionNode) fixedNode;
            AbstractBeginNode normalSuccessor = graph.add(new BeginNode());
            ExceptionObjectNode exceptionSuccessor = graph.add(new ExceptionObjectNode(getMetaAccess()));
            setExceptionState(exceptionSuccessor);
            exceptionSuccessor.setNext(graph.add(new UnwindNode(exceptionSuccessor)));
            withExceptionNode.setNext(normalSuccessor);
            withExceptionNode.setExceptionEdge(exceptionSuccessor);
            lastInstr = normalSuccessor;
        } else {
            lastInstr = null;
        }
    }
}
Also used : FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) BeginNode(org.graalvm.compiler.nodes.BeginNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) ExceptionObjectNode(org.graalvm.compiler.nodes.java.ExceptionObjectNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode)

Aggregations

WithExceptionNode (org.graalvm.compiler.nodes.WithExceptionNode)15 AbstractBeginNode (org.graalvm.compiler.nodes.AbstractBeginNode)10 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)9 UnwindNode (org.graalvm.compiler.nodes.UnwindNode)9 Node (org.graalvm.compiler.graph.Node)8 FixedNode (org.graalvm.compiler.nodes.FixedNode)8 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)8 ValueNode (org.graalvm.compiler.nodes.ValueNode)8 ExceptionObjectNode (org.graalvm.compiler.nodes.java.ExceptionObjectNode)8 PhiNode (org.graalvm.compiler.nodes.PhiNode)7 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)6 IfNode (org.graalvm.compiler.nodes.IfNode)6 MergeNode (org.graalvm.compiler.nodes.MergeNode)6 ControlSinkNode (org.graalvm.compiler.nodes.ControlSinkNode)5 LogicNode (org.graalvm.compiler.nodes.LogicNode)5 UnreachableBeginNode (org.graalvm.compiler.nodes.UnreachableBeginNode)5 FallbackInvokeWithExceptionNode (org.graalvm.compiler.replacements.nodes.FallbackInvokeWithExceptionNode)5 MacroWithExceptionNode (org.graalvm.compiler.replacements.nodes.MacroWithExceptionNode)5 BeginNode (org.graalvm.compiler.nodes.BeginNode)4 DeoptimizingNode (org.graalvm.compiler.nodes.DeoptimizingNode)4