changeset 15111:a775a766a3c8

Add more loop info to BciBlocks.
author Josef Eisl <josef.eisl@jku.at>
date Mon, 14 Apr 2014 19:16:33 +0200
parents ca92d97bb0d6
children 257ec29335cf
files graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Mon Apr 14 16:47:36 2014 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Mon Apr 14 19:16:33 2014 +0200
@@ -82,6 +82,12 @@
         public boolean isLoopHeader;
         public int loopId;
 
+        /**
+         * XXX to be removed - currently only used by baseline compiler
+         */
+        public Loop<BciBlock> loop;
+        public boolean isLoopEnd;
+
         public FixedWithNextNode firstInstruction;
         public AbstractFrameStateBuilder<?, ?> entryState;
 
@@ -145,13 +151,11 @@
         }
 
         public Loop<BciBlock> getLoop() {
-            // TODO Auto-generated method stub
-            return null;
+            return loop;
         }
 
         public int getLoopDepth() {
-            // TODO Auto-generated method stub
-            return 0;
+            return Long.bitCount(loops);
         }
 
         public boolean isLoopHeader() {
@@ -159,13 +163,11 @@
         }
 
         public boolean isLoopEnd() {
-            // TODO Auto-generated method stub
-            return false;
+            return isLoopEnd;
         }
 
         public boolean isExceptionEntry() {
-            // TODO Auto-generated method stub
-            return false;
+            return isExceptionEntry;
         }
 
         public BciBlock getSuccessor(int index) {
@@ -716,6 +718,10 @@
         for (BciBlock successor : block.getSuccessors()) {
             // Recursively process successors.
             loops |= computeBlockOrder(successor);
+            if (block.visited && successor.active) {
+                // Reached block via backward branch.
+                block.isLoopEnd = true;
+            }
         }
 
         block.loops = loops;