# HG changeset patch # User Gilles Duboscq # Date 1394817078 -3600 # Node ID e1a2302a42bcd9ec4860d146d9d0c3ba7c2163f1 # Parent 0d5923064a88f2473131392198418e5be8b61f8c Improve cleanup during snippet lowering where the snippet never returns normally (unwind, deopt...) diff -r 0d5923064a88 -r e1a2302a42bc graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Sat Mar 15 10:28:52 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Fri Mar 14 18:11:18 2014 +0100 @@ -312,6 +312,8 @@ Mark preLoweringMark = node.graph().getMark(); ((Lowerable) node).lower(loweringTool); if (loweringTool.guardAnchor.asNode().isDeleted()) { + // TODO nextNode could be deleted but this is not currently supported + assert nextNode.isAlive(); loweringTool.guardAnchor = BeginNode.prevBegin(nextNode); } assert checkPostNodeLowering(node, loweringTool, preLoweringMark, unscheduledUsages); diff -r 0d5923064a88 -r e1a2302a42bc graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Sat Mar 15 10:28:52 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Fri Mar 14 18:11:18 2014 +0100 @@ -1012,12 +1012,6 @@ // Re-wire the control flow graph around the replacee FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode); replacee.replaceAtPredecessor(firstCFGNodeDuplicate); - FixedNode next = null; - if (replacee instanceof FixedWithNextNode) { - FixedWithNextNode fwn = (FixedWithNextNode) replacee; - next = fwn.next(); - fwn.setNext(null); - } if (replacee instanceof StateSplit) { for (StateSplit sideEffectNode : sideEffectNodes) { @@ -1052,6 +1046,12 @@ replacer.replace(replacee, returnValue, mmap); } if (returnDuplicate.isAlive()) { + FixedNode next = null; + if (replacee instanceof FixedWithNextNode) { + FixedWithNextNode fwn = (FixedWithNextNode) replacee; + next = fwn.next(); + fwn.setNext(null); + } returnDuplicate.clearInputs(); returnDuplicate.replaceAndDelete(next); }