changeset 2668:32e8315bb6e4

fixed slot encoding in duplicateModified
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 12 May 2011 12:13:17 +0200
parents c4922e69711e
children 50b181d88c9f
files graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java
diffstat 2 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Thu May 12 11:17:31 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Thu May 12 12:13:17 2011 +0200
@@ -976,6 +976,7 @@
     }
 
     private FrameState stateBeforeRegisterFinalizer(RegisterFinalizer rf) {
+        assert rf.object().kind == CiKind.Object;
         return rf.stateAfter().duplicateModified(rf.bci(), CiKind.Void, rf.object());
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Thu May 12 11:17:31 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Thu May 12 12:13:17 2011 +0200
@@ -118,14 +118,12 @@
 
     /**
      * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the
-     * values in pushedValues pushed on the stack.
+     * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long
+     * or double is followed by a null slot.
      */
     public FrameState duplicateModified(int bci, CiKind popKind, Value... pushedValues) {
         int popSlots = popKind.sizeInSlots();
-        int pushSlots = 0;
-        for (Value v : pushedValues) {
-            pushSlots += v.kind.sizeInSlots();
-        }
+        int pushSlots = pushedValues.length;
         FrameState other = new FrameState(bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), graph());
         for (int i = 0; i < localsSize; i++) {
             other.inputs().set(i, localAt(i));
@@ -133,16 +131,12 @@
         for (int i = 0; i < stackSize - popSlots; i++) {
             other.inputs().set(localsSize + i, stackAt(i));
         }
-        int slot = stackSize - popSlots;
-        for (Value v : pushedValues) {
-            assert v.kind.sizeInSlots() > 0;
-            if (v.kind.sizeInSlots() == 2) {
-                other.inputs().set(localsSize + slot++, null);
-            }
-            other.inputs().set(localsSize + slot++, v);
+        int slot = localsSize + stackSize - popSlots;
+        for (int i = 0; i < pushSlots; i++) {
+            other.inputs().set(slot++, pushedValues[i]);
         }
         for (int i = 0; i < locksSize; i++) {
-            other.inputs().set(localsSize + i, lockAt(i));
+            other.inputs().set(localsSize + other.stackSize + i, lockAt(i));
         }
         return other;
     }