Search in sources :

Example 1 with NodeSuccessorList

use of org.graalvm.compiler.graph.NodeSuccessorList in project graal by oracle.

the class LoopDetector method makeSuccessorStubs.

/**
 * Process successor edges of a node. We create the successor nodes so that we can fill the
 * successor list, but no properties or edges are loaded yet. That is done when the successor is
 * on top of the worklist in {@link #processNextNode}.
 */
protected void makeSuccessorStubs(MethodScope methodScope, LoopScope loopScope, Node node, boolean updatePredecessors) {
    Edges edges = node.getNodeClass().getSuccessorEdges();
    for (int index = 0; index < edges.getDirectCount(); index++) {
        if (skipDirectEdge(node, edges, index)) {
            continue;
        }
        int orderId = readOrderId(methodScope);
        Node value = makeStubNode(methodScope, loopScope, orderId);
        edges.initializeNode(node, index, value);
        if (updatePredecessors && value != null) {
            edges.update(node, null, value);
        }
    }
    for (int index = edges.getDirectCount(); index < edges.getCount(); index++) {
        int size = methodScope.reader.getSVInt();
        if (size != -1) {
            NodeList<Node> nodeList = new NodeSuccessorList<>(node, size);
            edges.initializeList(node, index, nodeList);
            for (int idx = 0; idx < size; idx++) {
                int orderId = readOrderId(methodScope);
                Node value = makeStubNode(methodScope, loopScope, orderId);
                nodeList.initialize(idx, value);
                if (updatePredecessors && value != null) {
                    edges.update(node, null, value);
                }
            }
        }
    }
}
Also used : NodeSuccessorList(org.graalvm.compiler.graph.NodeSuccessorList) IntegerSwitchNode(org.graalvm.compiler.nodes.extended.IntegerSwitchNode) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) Node(org.graalvm.compiler.graph.Node) Edges(org.graalvm.compiler.graph.Edges)

Aggregations

Edges (org.graalvm.compiler.graph.Edges)1 Node (org.graalvm.compiler.graph.Node)1 NodeSuccessorList (org.graalvm.compiler.graph.NodeSuccessorList)1 FloatingNode (org.graalvm.compiler.nodes.calc.FloatingNode)1 IntegerSwitchNode (org.graalvm.compiler.nodes.extended.IntegerSwitchNode)1