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;
}
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;
}
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);
}
}
}
}
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;
}
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;
}
Aggregations