changeset 12702:44c0e08c4150

Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 07 Nov 2013 10:42:37 +0100
parents 42a60780c2c9
children b6f66fb9f106
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Wed Nov 06 16:47:48 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Thu Nov 07 10:42:37 2013 +0100
@@ -50,8 +50,8 @@
     final class LoweringToolImpl implements LoweringTool {
 
         private final PhaseContext context;
-        private final GuardingNode guardAnchor;
         private final NodeBitMap activeGuards;
+        private GuardingNode guardAnchor;
         private FixedWithNextNode lastFixedNode;
         private ControlFlowGraph cfg;
 
@@ -237,7 +237,7 @@
             if (anchor == null) {
                 anchor = block.getBeginNode();
             }
-            process(block, activeGuards, anchor);
+            anchor = process(block, activeGuards, anchor);
 
             // Process always reached block first.
             Block alwaysReachedBlock = block.getPostdominator();
@@ -262,9 +262,9 @@
             }
         }
 
-        private void process(final Block b, final NodeBitMap activeGuards, final GuardingNode anchor) {
+        private GuardingNode process(final Block b, final NodeBitMap activeGuards, final GuardingNode startAnchor) {
 
-            final LoweringToolImpl loweringTool = new LoweringToolImpl(context, anchor, activeGuards, b.getBeginNode(), schedule.getCFG());
+            final LoweringToolImpl loweringTool = new LoweringToolImpl(context, startAnchor, activeGuards, b.getBeginNode(), schedule.getCFG());
 
             // Lower the instructions of this block.
             List<ScheduledNode> nodes = schedule.nodesFor(b);
@@ -288,6 +288,9 @@
                     assert checkUsagesAreScheduled(node);
                     Mark preLoweringMark = node.graph().getMark();
                     ((Lowerable) node).lower(loweringTool);
+                    if (node == startAnchor && node.isDeleted()) {
+                        loweringTool.guardAnchor = BeginNode.prevBegin(nextNode);
+                    }
                     assert checkPostNodeLowering(node, loweringTool, preLoweringMark);
                 }
 
@@ -311,6 +314,7 @@
                     loweringTool.setLastFixedNode((FixedWithNextNode) nextLastFixed);
                 }
             }
+            return loweringTool.getCurrentGuardAnchor();
         }
 
         /**