diff graal/GraalCompiler/src/com/sun/c1x/graph/IR.java @ 2840:75e0d39833a0

new CompilerGraph, create only one Return and one Unwind per CompilerGraph
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 31 May 2011 16:53:19 +0200
parents c1c8a0291771
children 633e66de40fe
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 31 13:42:01 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 31 16:53:19 2011 +0200
@@ -32,6 +32,7 @@
 import com.sun.c1x.ir.*;
 import com.sun.c1x.lir.*;
 import com.sun.c1x.observer.*;
+import com.sun.c1x.value.*;
 
 /**
  * This class implements the overall container for the HIR (high-level IR) graph
@@ -49,8 +50,6 @@
      */
     public LIRBlock startBlock;
 
-    private int maxLocks;
-
     /**
      * The linear-scan ordered list of blocks.
      */
@@ -210,21 +209,18 @@
     }
 
     /**
-     * Updates the maximum number of locks held at any one time.
-     *
-     * @param locks a lock count that will replace the current {@linkplain #maxLocks() max locks} if it is greater
-     */
-    public void updateMaxLocks(int locks) {
-        if (locks > maxLocks) {
-            maxLocks = locks;
-        }
-    }
-
-    /**
-     * Gets the number of locks.
-     * @return the number of locks
+     * Gets the maximum number of locks in the graph's frame states.
      */
     public final int maxLocks() {
+        int maxLocks = 0;
+        for (Node node : compilation.graph.getNodes()) {
+            if (node instanceof FrameState) {
+                int lockCount = ((FrameState) node).locksSize();
+                if (lockCount > maxLocks) {
+                    maxLocks = lockCount;
+                }
+            }
+        }
         return maxLocks;
     }