# HG changeset patch # User Thomas Wuerthinger # Date 1424641166 -3600 # Node ID c66037cb9cd1eeb7a5d7f88d5cdc0a3bc71bca21 # Parent 9a749d774c73eb5ef37a74a6509b1245c23476b6 Make Node#replaceAndDelete not accept null as an argument. diff -r 9a749d774c73 -r c66037cb9cd1 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Sun Feb 22 19:31:57 2015 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Sun Feb 22 22:39:26 2015 +0100 @@ -617,11 +617,11 @@ public void replaceAndDelete(Node other) { assert checkReplaceWith(other); - if (other != null) { - clearSuccessors(); - replaceAtUsages(other); - replaceAtPredecessor(other); - } + assert other != null; + clearInputs(); + clearSuccessors(); + replaceAtUsages(other); + replaceAtPredecessor(other); safeDelete(); } diff -r 9a749d774c73 -r c66037cb9cd1 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Sun Feb 22 19:31:57 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Sun Feb 22 22:39:26 2015 +0100 @@ -104,8 +104,9 @@ } } if (couldSet) { - replaceAndDelete(condition); - tool.addToWorkList(condition.usages()); + ValueNode currentCondition = condition; + replaceAndDelete(currentCondition); + tool.addToWorkList(currentCondition.usages()); } else { if (!isSubstitutionGraph()) { throw new GraalInternalError("Wrong usage of branch probability injection!"); diff -r 9a749d774c73 -r c66037cb9cd1 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Sun Feb 22 19:31:57 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Sun Feb 22 22:39:26 2015 +0100 @@ -30,10 +30,8 @@ import com.oracle.graal.graph.iterators.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.virtual.*; public class GraphUtil { @@ -41,7 +39,7 @@ @Override public final boolean apply(Node n) { - return n instanceof FloatingNode || n instanceof VirtualState || n instanceof CallTargetNode || n instanceof VirtualObjectNode; + return !(n instanceof FixedNode); } }; @@ -135,11 +133,9 @@ } public static void killWithUnusedFloatingInputs(Node node) { - List floatingInputs = node.inputs().filter(isFloatingNode()).snapshot(); node.safeDelete(); - - for (Node in : floatingInputs) { - if (in.isAlive() && in.hasNoUsages()) { + for (Node in : node.inputs()) { + if (in.isAlive() && in.hasNoUsages() && !(in instanceof FixedNode)) { killWithUnusedFloatingInputs(in); } } diff -r 9a749d774c73 -r c66037cb9cd1 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Sun Feb 22 19:31:57 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Sun Feb 22 22:39:26 2015 +0100 @@ -226,8 +226,10 @@ assert invoke.next() == continuation; invoke.setNext(null); returnMerge.setNext(continuation); - invoke.asNode().replaceAtUsages(returnValuePhi); - invoke.asNode().replaceAndDelete(null); + if (returnValuePhi != null) { + invoke.asNode().replaceAtUsages(returnValuePhi); + } + invoke.asNode().safeDelete(); ArrayList replacementNodes = new ArrayList<>(); diff -r 9a749d774c73 -r c66037cb9cd1 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Sun Feb 22 19:31:57 2015 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Sun Feb 22 22:39:26 2015 +0100 @@ -171,7 +171,7 @@ InliningUtil.inline(invoke, replacementGraph, false, null); Debug.dump(graph(), "After inlining replacement %s", replacementGraph); } else { - if (stateAfter() == null) { + if (invoke.stateAfter() == null) { throw new GraalInternalError("cannot lower to invoke without state: %s", this); } invoke.lower(tool);