diff graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2783:9bc0c2eb00d6

Made graph builder removal of BlockBegin work.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 25 May 2011 12:04:58 +0200
parents 915456e4959e
children e62cfea1c134
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 25 11:15:24 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 25 12:04:58 2011 +0200
@@ -27,6 +27,7 @@
 import static com.sun.cri.ci.CiCallingConvention.Type.*;
 import static com.sun.cri.ci.CiValue.*;
 
+import java.lang.reflect.*;
 import java.util.*;
 
 import com.oracle.graal.graph.*;
@@ -257,6 +258,7 @@
             TTY.println("END Generating LIR for block B" + block.blockID());
         }
 
+        block.setLastState(lastState);
         this.currentBlock = null;
         blockDoEpilog();
     }
@@ -273,12 +275,18 @@
         return x.operand();
     }
 
-    private void setOperandsForLocals() {
+    private FrameState setOperandsForLocals() {
         CiCallingConvention args = compilation.frameMap().incomingArguments();
+        int bci = 0;
+        if (Modifier.isSynchronized(compilation.method.accessFlags())) {
+            bci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
+        }
+        FrameState fs = new FrameState(bci, compilation.method.maxLocals(), 0, 0, compilation.graph);
         for (Node node : compilation.graph.start().usages()) {
             if (node instanceof Local) {
                 Local local = (Local) node;
                 int i = local.index();
+                fs.storeLocal(i, local);
 
                 CiValue src = args.locations[i];
                 assert src.isLegal() : "check";
@@ -290,6 +298,7 @@
                 setResult(local, dest);
             }
         }
+        return fs;
     }
 
     @Override
@@ -892,7 +901,12 @@
             if (prologue != null) {
                 emitXir(prologue, null, null, null, false);
             }
-            setOperandsForLocals();
+            FrameState fs = setOperandsForLocals();
+            lastState = fs;
+        } else if (block.blockPredecessors().size() == 1) {
+            FrameState fs = block.blockPredecessors().get(0).lastState();
+            assert fs != null;
+            lastState = fs;
         }
     }