changeset 2640:9e30cf6dcf96

More frame state fixes. All jtt tests passing now again.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 11 May 2011 14:02:08 +0200
parents 8e96b2b3a866
children d1c5a798b73c
files graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java
diffstat 2 files changed, 27 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 11 13:41:35 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Wed May 11 14:02:08 2011 +0200
@@ -469,6 +469,24 @@
         for (int i = 0; i < argumentCount; i++) {
             Value arg = invoke.argument(i);
             if (arg != null) {
+                //builder.push(arg.kind, arg);
+            }
+        }
+        return builder.create(invoke.bci());
+    }
+
+    protected FrameState stateBeforeInvokeWithArguments(Invoke invoke) {
+
+        FrameState stateAfter = invoke.stateAfter();
+        FrameStateBuilder builder = new FrameStateBuilder(compilation.method, invoke.graph());
+        builder.initializeFrom(stateAfter);
+        if (invoke.kind != CiKind.Void) {
+            builder.pop(invoke.kind);
+        }
+        int argumentCount = invoke.argumentCount(); // invoke.arguments() iterable?
+        for (int i = 0; i < argumentCount; i++) {
+            Value arg = invoke.argument(i);
+            if (arg != null) {
                 builder.push(arg.kind, arg);
             }
         }
@@ -478,7 +496,8 @@
     @Override
     public void visitInvoke(Invoke x) {
         RiMethod target = x.target();
-        LIRDebugInfo info = stateFor(x, stateBeforeInvoke(x));
+        LIRDebugInfo info = stateFor(x, stateBeforeInvokeWithArguments(x));
+        LIRDebugInfo info2 = stateFor(x, stateBeforeInvoke(x));
 
         XirSnippet snippet = null;
 
@@ -522,11 +541,11 @@
         if (destinationAddress instanceof CiConstant) {
             // Direct call
             assert ((CiConstant) destinationAddress).isDefaultValue() : "destination address should be zero";
-            lir.callDirect(target, resultOperand, argList, info, snippet.marks, pointerSlots);
+            lir.callDirect(target, resultOperand, argList, info2, snippet.marks, pointerSlots);
         } else {
             // Indirect call
             argList.add(destinationAddress);
-            lir.callIndirect(target, resultOperand, argList, info, snippet.marks, pointerSlots);
+            lir.callIndirect(target, resultOperand, argList, info2, snippet.marks, pointerSlots);
         }
 
         if (resultOperand.isLegal()) {
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Wed May 11 13:41:35 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Wed May 11 14:02:08 2011 +0200
@@ -990,12 +990,12 @@
             lockAddress = new MonitorAddress(lockNumber, graph);
             append(lockAddress);
         }
-        frameState.push(CiKind.Object, x);
         MonitorEnter monitorEnter = new MonitorEnter(x, lockAddress, lockNumber, graph);
-        frameState.apop();
         appendWithoutOptimization(monitorEnter, bci);
         frameState.lock(ir, x, lockNumber + 1);
-        monitorEnter.setStateAfter(frameState.create(bci));
+        if (bci == Instruction.SYNCHRONIZATION_ENTRY_BCI) {
+            monitorEnter.setStateAfter(frameState.create(0));
+        }
         killMemoryMap(); // prevent any optimizations across synchronization
     }
 
@@ -1268,14 +1268,14 @@
                 end = (BlockEnd) lastInstr;
                 break;
             }
+            stream.next();
+            bci = stream.currentBCI();
             if (lastInstr instanceof StateSplit) {
                 StateSplit stateSplit = (StateSplit) lastInstr;
                 if (stateSplit.stateAfter() == null && stateSplit.needsStateAfter()) {
                     stateSplit.setStateAfter(frameState.create(bci));
                 }
             }
-            stream.next();
-            bci = stream.currentBCI();
             blockStart = false;
         }