Search in sources :

Example 76 with FixedNode

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

the class ComputeInliningRelevance method getMaxProbabilitySux.

/**
 * Returns the most probable successor. If multiple successors share the maximum probability,
 * one is returned and the others are enqueued in pathBeginNodes.
 */
private static Node getMaxProbabilitySux(ControlSplitNode controlSplit, ArrayList<FixedNode> pathBeginNodes) {
    Node maxSux = null;
    double maxProbability = 0.0;
    int pathBeginCount = pathBeginNodes.size();
    for (Node sux : controlSplit.successors()) {
        double probability = controlSplit.probability((AbstractBeginNode) sux);
        if (probability > maxProbability) {
            maxProbability = probability;
            maxSux = sux;
            truncate(pathBeginNodes, pathBeginCount);
        } else if (probability == maxProbability) {
            pathBeginNodes.add((FixedNode) sux);
        }
    }
    return maxSux;
}
Also used : LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) StartNode(org.graalvm.compiler.nodes.StartNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode) ControlSplitNode(org.graalvm.compiler.nodes.ControlSplitNode) LoopExitNode(org.graalvm.compiler.nodes.LoopExitNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) FixedNode(org.graalvm.compiler.nodes.FixedNode)

Example 77 with FixedNode

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

the class InliningIterator method apply.

public LinkedList<Invoke> apply() {
    LinkedList<Invoke> invokes = new LinkedList<>();
    FixedNode current;
    forcedQueue(start);
    while ((current = nextQueuedNode()) != null) {
        assert current.isAlive();
        if (current instanceof Invoke && ((Invoke) current).callTarget() instanceof MethodCallTargetNode) {
            if (current != start) {
                invokes.addLast((Invoke) current);
            }
            queueSuccessors(current);
        } else if (current instanceof LoopBeginNode) {
            queueSuccessors(current);
        } else if (current instanceof LoopEndNode) {
        // nothing to do
        } else if (current instanceof AbstractMergeNode) {
            queueSuccessors(current);
        } else if (current instanceof FixedWithNextNode) {
            queueSuccessors(current);
        } else if (current instanceof EndNode) {
            queueMerge((EndNode) current);
        } else if (current instanceof ControlSinkNode) {
        // nothing to do
        } else if (current instanceof ControlSplitNode) {
            queueSuccessors(current);
        } else {
            assert false : current;
        }
    }
    assert invokes.size() == count(start.graph().getInvokes());
    return invokes;
}
Also used : FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) AbstractEndNode(org.graalvm.compiler.nodes.AbstractEndNode) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode) EndNode(org.graalvm.compiler.nodes.EndNode) ControlSplitNode(org.graalvm.compiler.nodes.ControlSplitNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode) LinkedList(java.util.LinkedList) Invoke(org.graalvm.compiler.nodes.Invoke) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode)

Example 78 with FixedNode

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

the class PostOrderNodeIterator method queueSuccessors.

private void queueSuccessors(FixedNode x, Set<Node> successors) {
    nodeStates.put(x, state);
    if (successors != null) {
        for (Node node : successors) {
            if (node != null) {
                nodeStates.put((FixedNode) node.predecessor(), state);
                nodeQueue.addFirst((AbstractBeginNode) node);
            }
        }
    } else {
        for (Node node : x.successors()) {
            if (node != null) {
                nodeQueue.addFirst((AbstractBeginNode) node);
            }
        }
    }
}
Also used : LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode) ControlSplitNode(org.graalvm.compiler.nodes.ControlSplitNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ControlSinkNode(org.graalvm.compiler.nodes.ControlSinkNode)

Example 79 with FixedNode

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

the class ReentrantNodeIterator method processLoop.

public static <StateT> LoopInfo<StateT> processLoop(NodeIteratorClosure<StateT> closure, LoopBeginNode loop, StateT initialState) {
    EconomicMap<FixedNode, StateT> blockEndStates = apply(closure, loop, initialState, loop);
    LoopInfo<StateT> info = new LoopInfo<>(loop.loopEnds().count(), loop.loopExits().count());
    for (LoopEndNode end : loop.loopEnds()) {
        if (blockEndStates.containsKey(end)) {
            info.endStates.put(end, blockEndStates.get(end));
        }
    }
    for (LoopExitNode exit : loop.loopExits()) {
        if (blockEndStates.containsKey(exit)) {
            info.exitStates.put(exit, blockEndStates.get(exit));
        }
    }
    return info;
}
Also used : LoopExitNode(org.graalvm.compiler.nodes.LoopExitNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode)

Example 80 with FixedNode

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

the class ScopedPostOrderNodeIterator method getScopes.

protected Deque<FixedNode> getScopes(StructuredGraph graph) {
    Deque<FixedNode> result = new ArrayDeque<>();
    result.push(graph.start());
    for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.TYPE)) {
        result.push(loopBegin);
    }
    return result;
}
Also used : LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) ArrayDeque(java.util.ArrayDeque)

Aggregations

FixedNode (org.graalvm.compiler.nodes.FixedNode)87 Node (org.graalvm.compiler.graph.Node)41 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)41 AbstractBeginNode (org.graalvm.compiler.nodes.AbstractBeginNode)39 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)39 ValueNode (org.graalvm.compiler.nodes.ValueNode)34 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)33 EndNode (org.graalvm.compiler.nodes.EndNode)27 AbstractEndNode (org.graalvm.compiler.nodes.AbstractEndNode)25 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)23 PhiNode (org.graalvm.compiler.nodes.PhiNode)22 ControlSplitNode (org.graalvm.compiler.nodes.ControlSplitNode)21 LoopExitNode (org.graalvm.compiler.nodes.LoopExitNode)21 LoopEndNode (org.graalvm.compiler.nodes.LoopEndNode)20 ControlSinkNode (org.graalvm.compiler.nodes.ControlSinkNode)17 MergeNode (org.graalvm.compiler.nodes.MergeNode)17 StartNode (org.graalvm.compiler.nodes.StartNode)17 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)16 DeoptimizeNode (org.graalvm.compiler.nodes.DeoptimizeNode)13 ProxyNode (org.graalvm.compiler.nodes.ProxyNode)13