use of org.graalvm.compiler.graph.LinkedNodeStack in project graal by oracle.
the class GraphUtil method killWithUnusedFloatingInputs.
public static void killWithUnusedFloatingInputs(Node node, boolean mayKillGuard) {
LinkedNodeStack stack = null;
Node cur = node;
do {
assert checkKill(cur, mayKillGuard);
cur.markDeleted();
outer: for (Node in : cur.inputs()) {
if (in.isAlive()) {
in.removeUsage(cur);
if (in.hasNoUsages()) {
cur.maybeNotifyZeroUsages(in);
}
if (isFloatingNode(in)) {
if (in.hasNoUsages()) {
if (in instanceof GuardNode) {
// Guard nodes are only killed if their anchor dies.
continue outer;
}
} else if (in instanceof PhiNode) {
if (!((PhiNode) in).isDegenerated()) {
continue outer;
}
in.replaceAtUsages(null);
} else {
continue outer;
}
if (stack == null) {
stack = new LinkedNodeStack();
}
stack.push(in);
}
}
}
if (stack == null || stack.isEmpty()) {
break;
} else {
cur = stack.pop();
}
} while (true);
}
Aggregations