changeset 9600:20c09d314168

Improve markFloating in LoopFragment (avoids recursion explosion)
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 07 May 2013 14:04:36 +0200
parents ffbb0a365039
children 278a50fb49c7
files graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Tue May 07 11:37:23 2013 +0200
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Tue May 07 14:04:36 2013 +0200
@@ -183,10 +183,11 @@
             }
         }
 
+        final NodeBitMap notloopNodes = graph.createNodeBitMap(true);
         for (AbstractBeginNode b : blocks) {
             for (Node n : b.getBlockNodes()) {
                 for (Node usage : n.usages()) {
-                    markFloating(usage, nodes);
+                    markFloating(usage, nodes, notloopNodes);
                 }
             }
         }
@@ -194,10 +195,13 @@
         return nodes;
     }
 
-    private static boolean markFloating(Node n, NodeBitMap loopNodes) {
+    private static boolean markFloating(Node n, NodeBitMap loopNodes, NodeBitMap notloopNodes) {
         if (loopNodes.isMarked(n)) {
             return true;
         }
+        if (notloopNodes.isMarked(n)) {
+            return false;
+        }
         if (n instanceof FixedNode) {
             return false;
         }
@@ -208,11 +212,12 @@
             if (mark) {
                 loopNodes.mark(n);
             } else {
+                notloopNodes.mark(n);
                 return false;
             }
         }
         for (Node usage : n.usages()) {
-            if (markFloating(usage, loopNodes)) {
+            if (markFloating(usage, loopNodes, notloopNodes)) {
                 mark = true;
             }
         }
@@ -220,6 +225,7 @@
             loopNodes.mark(n);
             return true;
         }
+        notloopNodes.mark(n);
         return false;
     }