changeset 18441:d11ce424f09d

Allow updating HotSpotMonitorValue.slot.
author Josef Eisl <josef.eisl@jku.at>
date Tue, 11 Nov 2014 18:17:17 +0100
parents 7aae90a0031c
children 758ecda76985
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java
diffstat 3 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Nov 11 17:03:16 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Nov 11 18:17:17 2014 +0100
@@ -696,10 +696,12 @@
                     }
                 };
                 ValueConsumer stateConsumer = (operand, mode, flags) -> {
-                    int operandNum = operandNumber(operand);
-                    if (!liveKill.get(operandNum)) {
-                        liveGen.set(operandNum);
-                        Debug.log("liveGen in state for operand %d", operandNum);
+                    if (isVariableOrRegister(operand)) {
+                        int operandNum = operandNumber(operand);
+                        if (!liveKill.get(operandNum)) {
+                            liveGen.set(operandNum);
+                            Debug.log("liveGen in state for operand %d", operandNum);
+                        }
                     }
                 };
                 ValueConsumer defConsumer = (operand, mode, flags) -> {
@@ -1167,9 +1169,11 @@
             };
 
             InstructionValueConsumer stateProc = (op, operand, mode, flags) -> {
-                int opId = op.id();
-                int blockFrom = getFirstLirInstructionId((blockForId(opId)));
-                addUse((AllocatableValue) operand, blockFrom, opId + 1, RegisterPriority.None, operand.getLIRKind());
+                if (isVariableOrRegister(operand)) {
+                    int opId = op.id();
+                    int blockFrom = getFirstLirInstructionId((blockForId(opId)));
+                    addUse((AllocatableValue) operand, blockFrom, opId + 1, RegisterPriority.None, operand.getLIRKind());
+                }
             };
 
             // create a list with all caller-save registers (cpu, fpu, xmm)
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java	Tue Nov 11 17:03:16 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java	Tue Nov 11 18:17:17 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.hotspot;
 
+import static com.oracle.graal.api.code.ValueUtil.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.meta.*;
@@ -47,6 +49,10 @@
                     monitor.setOwner((JavaValue) proc.doValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS));
                 }
             }
+            Value slot = monitor.getSlot();
+            if (isVirtualStackSlot(slot) && processed(slot)) {
+                monitor.setSlot(asStackSlotValue(proc.doValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS)));
+            }
             return value;
         } else {
             return super.processValue(inst, proc, value);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Tue Nov 11 17:03:16 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Tue Nov 11 18:17:17 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import static com.oracle.graal.api.code.ValueUtil.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 
@@ -33,7 +35,7 @@
     private static final long serialVersionUID = 8241681800464483691L;
 
     private JavaValue owner;
-    private final StackSlotValue slot;
+    private StackSlotValue slot;
     private final boolean eliminated;
 
     public HotSpotMonitorValue(JavaValue owner, StackSlotValue slot, boolean eliminated) {
@@ -82,4 +84,9 @@
         }
         return false;
     }
+
+    public void setSlot(StackSlotValue stackSlot) {
+        assert slot == null || (isVirtualStackSlot(slot) && (slot.equals(stackSlot) || isStackSlot(stackSlot))) : String.format("Can not set slot for %s to %s", this, stackSlot);
+        slot = stackSlot;
+    }
 }