changeset 18189:e75eb4720d4e

Introduce new JavaValue interface for use in debug info.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 30 Oct 2014 14:10:46 +0100
parents 8652481a1110
children c8d83f6db9a2
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaValue.java graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.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 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java src/share/vm/graal/graalJavaAccess.hpp
diffstat 14 files changed, 121 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Thu Oct 30 14:10:46 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
      * Note that the number of locals and the number of stack slots may be smaller than the maximum
      * number of locals and stack slots as specified in the compiled method.
      */
-    public final Value[] values;
+    public final JavaValue[] values;
 
     /**
      * The number of locals in the values array.
@@ -143,7 +143,7 @@
      * @param numStack the depth of the stack
      * @param numLocks the number of locked objects
      */
-    public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks) {
+    public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, int numLocals, int numStack, int numLocks) {
         super(caller, method, bci);
         assert values != null;
         this.rethrowException = rethrowException;
@@ -182,7 +182,7 @@
      * @param i the local variable index
      * @return the value that can be used to reconstruct the local's current value
      */
-    public Value getLocalValue(int i) {
+    public JavaValue getLocalValue(int i) {
         return values[i];
     }
 
@@ -192,7 +192,7 @@
      * @param i the stack index
      * @return the value that can be used to reconstruct the stack slot's current value
      */
-    public Value getStackValue(int i) {
+    public JavaValue getStackValue(int i) {
         return values[i + numLocals];
     }
 
@@ -202,7 +202,7 @@
      * @param i the lock index
      * @return the value that can be used to reconstruct the lock's current value
      */
-    public Value getLockValue(int i) {
+    public JavaValue getLockValue(int i) {
         return values[i + numLocals + numStack];
     }
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Thu Oct 30 14:10:46 2014 +0100
@@ -31,12 +31,12 @@
  * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
  * object.
  */
-public final class VirtualObject extends Value {
+public final class VirtualObject extends Value implements JavaValue {
 
     private static final long serialVersionUID = -2907197776426346021L;
 
     private final ResolvedJavaType type;
-    private Value[] values;
+    private JavaValue[] values;
     private final int id;
 
     /**
@@ -54,18 +54,18 @@
      *            position in the compiled code.
      * @return a new {@link VirtualObject} instance.
      */
-    public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
+    public static VirtualObject get(ResolvedJavaType type, JavaValue[] values, int id) {
         return new VirtualObject(type, values, id);
     }
 
-    private VirtualObject(ResolvedJavaType type, Value[] values, int id) {
+    private VirtualObject(ResolvedJavaType type, JavaValue[] values, int id) {
         super(LIRKind.reference(Kind.Object));
         this.type = type;
         this.values = values;
         this.id = id;
     }
 
-    private static StringBuilder appendValue(StringBuilder buf, Value value, Set<VirtualObject> visited) {
+    private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set<VirtualObject> visited) {
         if (value instanceof VirtualObject) {
             VirtualObject vo = (VirtualObject) value;
             buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id);
@@ -120,7 +120,7 @@
     /**
      * Returns an array containing all the values to be stored into the object when it is recreated.
      */
-    public Value[] getValues() {
+    public JavaValue[] getValues() {
         return values;
     }
 
@@ -132,7 +132,7 @@
         return id;
     }
 
-    private static boolean checkValues(ResolvedJavaType type, Value[] values) {
+    private static boolean checkValues(ResolvedJavaType type, JavaValue[] values) {
         if (values != null) {
             if (!type.isArray()) {
                 ResolvedJavaField[] fields = type.getInstanceFields(true);
@@ -140,8 +140,8 @@
                 for (int i = 0; i < values.length; i++) {
                     ResolvedJavaField field = fields[fieldIndex++];
                     Kind valKind = values[i].getKind().getStackKind();
-                    if (field.getKind() == Kind.Object) {
-                        assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind();
+                    if (field.getKind() == Kind.Object && values[i] instanceof Value) {
+                        assert ((Value) values[i]).getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind();
                     } else {
                         if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) {
                             assert fields[fieldIndex].getKind() == Kind.Int;
@@ -156,7 +156,9 @@
                 Kind componentKind = type.getComponentType().getKind().getStackKind();
                 if (componentKind == Kind.Object) {
                     for (int i = 0; i < values.length; i++) {
-                        assert values[i].getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind;
+                        if (values[i] instanceof Value) {
+                            assert ((Value) values[i]).getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind;
+                        }
                     }
                 } else {
                     for (int i = 0; i < values.length; i++) {
@@ -175,7 +177,7 @@
      * @param values an array containing all the values to be stored into the object when it is
      *            recreated.
      */
-    public void setValues(Value[] values) {
+    public void setValues(JavaValue[] values) {
         assert checkValues(type, values);
         this.values = values;
     }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java	Thu Oct 30 14:10:46 2014 +0100
@@ -26,7 +26,7 @@
  * Common base class for values that are stored in some location that's managed by the register
  * allocator (e.g. register, stack slot).
  */
-public abstract class AllocatableValue extends Value {
+public abstract class AllocatableValue extends Value implements JavaValue {
 
     private static final long serialVersionUID = 153019506717492133L;
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaConstant.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaConstant.java	Thu Oct 30 14:10:46 2014 +0100
@@ -28,7 +28,7 @@
  * {@code JavaConstant} instances that represent frequently used constant values, such as
  * {@link #NULL_OBJECT}.
  */
-public abstract class JavaConstant extends Value implements Constant {
+public abstract class JavaConstant extends Value implements Constant, JavaValue {
 
     private static final long serialVersionUID = -6355452536852663986L;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaValue.java	Thu Oct 30 14:10:46 2014 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.meta;
+
+/**
+ * Interface for things that represent a Java value.
+ */
+public interface JavaValue {
+
+    /**
+     * Returns the kind of this value.
+     */
+    Kind getKind();
+}
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java	Thu Oct 30 14:10:46 2014 +0100
@@ -505,18 +505,18 @@
         int numLocals = state.localsSize();
         int numStack = state.stackSize();
         int numLocks = state.lockDepth();
-        Value[] values = new Value[numLocals + numStack + numLocks];
+        JavaValue[] values = new JavaValue[numLocals + numStack + numLocks];
 
         for (int i = 0; i < numLocals; i++) {
-            values[i] = state.localAt(i);
+            values[i] = (JavaValue) state.localAt(i);
         }
 
         for (int i = 0; i < numStack; i++) {
-            values[numLocals + i] = state.stackAt(i);
+            values[numLocals + i] = (JavaValue) state.stackAt(i);
         }
 
         for (int i = 0; i < numStack; i++) {
-            values[numLocals + numStack + i] = state.lockAt(i);
+            values[numLocals + numStack + i] = (JavaValue) state.lockAt(i);
         }
 
         BytecodeFrame frame = new BytecodeFrame(caller, method, bci(), state.rethrowException(), duringCall, values, numLocals, numStack, numLocks);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu Oct 30 14:10:46 2014 +0100
@@ -83,7 +83,7 @@
                 for (Entry<VirtualObjectNode, VirtualObject> entry : virtualObjectsCopy.entrySet()) {
                     if (entry.getValue().getValues() == null) {
                         VirtualObjectNode vobj = entry.getKey();
-                        Value[] values = new Value[vobj.entryCount()];
+                        JavaValue[] values = new JavaValue[vobj.entryCount()];
                         if (values.length > 0) {
                             changed = true;
                             VirtualObjectState currentField = (VirtualObjectState) objectStates.get(vobj);
@@ -133,7 +133,7 @@
             int numStack = state.stackSize();
             int numLocks = state.locksSize();
 
-            Value[] values = new Value[numLocals + numStack + numLocks];
+            JavaValue[] values = new JavaValue[numLocals + numStack + numLocks];
             computeLocals(state, numLocals, values);
             computeStack(state, numLocals, numStack, values);
             computeLocks(state, values);
@@ -148,33 +148,33 @@
         }
     }
 
-    protected void computeLocals(FrameState state, int numLocals, Value[] values) {
+    protected void computeLocals(FrameState state, int numLocals, JavaValue[] values) {
         for (int i = 0; i < numLocals; i++) {
             values[i] = computeLocalValue(state, i);
         }
     }
 
-    protected Value computeLocalValue(FrameState state, int i) {
+    protected JavaValue computeLocalValue(FrameState state, int i) {
         return toValue(state.localAt(i));
     }
 
-    protected void computeStack(FrameState state, int numLocals, int numStack, Value[] values) {
+    protected void computeStack(FrameState state, int numLocals, int numStack, JavaValue[] values) {
         for (int i = 0; i < numStack; i++) {
             values[numLocals + i] = computeStackValue(state, i);
         }
     }
 
-    protected Value computeStackValue(FrameState state, int i) {
+    protected JavaValue computeStackValue(FrameState state, int i) {
         return toValue(state.stackAt(i));
     }
 
-    protected void computeLocks(FrameState state, Value[] values) {
+    protected void computeLocks(FrameState state, JavaValue[] values) {
         for (int i = 0; i < state.locksSize(); i++) {
             values[state.localsSize() + state.stackSize() + i] = computeLockValue(state, i);
         }
     }
 
-    protected Value computeLockValue(FrameState state, int i) {
+    protected JavaValue computeLockValue(FrameState state, int i) {
         return toValue(state.lockAt(i));
     }
 
@@ -183,7 +183,7 @@
     private static final DebugMetric STATE_VARIABLES = Debug.metric("StateVariables");
     private static final DebugMetric STATE_CONSTANTS = Debug.metric("StateConstants");
 
-    protected Value toValue(ValueNode value) {
+    protected JavaValue toValue(ValueNode value) {
         try {
             if (value instanceof VirtualObjectNode) {
                 VirtualObjectNode obj = (VirtualObjectNode) value;
@@ -215,7 +215,7 @@
                     STATE_VARIABLES.increment();
                     Value operand = nodeOperands.get(value);
                     assert operand != null && (operand instanceof Variable || operand instanceof JavaConstant) : operand + " for " + value;
-                    return operand;
+                    return (JavaValue) operand;
 
                 } else {
                     // return a dummy value because real value not needed
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java	Thu Oct 30 14:10:46 2014 +0100
@@ -762,7 +762,7 @@
             Set<Register> infoUsedRegs = new TreeSet<>();
             Set<StackSlot> infoUsedStackSlots = new HashSet<>();
             List<Infopoint> infoList = crb.compilationResult.getInfopoints();
-            Queue<Value[]> workList = new LinkedList<>();
+            Queue<JavaValue[]> workList = new LinkedList<>();
             for (Infopoint info : infoList) {
                 BytecodeFrame frame = info.debugInfo.frame();
                 while (frame != null) {
@@ -771,28 +771,28 @@
                 }
             }
             while (!workList.isEmpty()) {
-                Value[] values = workList.poll();
-                for (Value val : values) {
-                    if (isLegal(val)) {
-                        if (isRegister(val)) {
-                            Register reg = asRegister(val);
+                JavaValue[] values = workList.poll();
+                for (JavaValue val : values) {
+                    if (!Value.ILLEGAL.equals(val)) {
+                        if (val instanceof RegisterValue) {
+                            Register reg = ((RegisterValue) val).getRegister();
                             infoUsedRegs.add(reg);
                             if (hsailRegConfig.isAllocatableSReg(reg)) {
                                 numSRegs = Math.max(numSRegs, reg.encoding + 1);
                             } else if (hsailRegConfig.isAllocatableDReg(reg)) {
                                 numDRegs = Math.max(numDRegs, reg.encoding + 1);
                             }
-                        } else if (isStackSlot(val)) {
-                            StackSlot slot = asStackSlot(val);
+                        } else if (val instanceof StackSlot) {
+                            StackSlot slot = (StackSlot) val;
                             Kind slotKind = slot.getKind();
                             int slotSizeBytes = (slotKind.isObject() ? 8 : slotKind.getByteCount());
                             int slotOffsetMax = HSAIL.getStackOffsetStart(slot, slotSizeBytes * 8) + slotSizeBytes;
                             numStackSlotBytes = Math.max(numStackSlotBytes, slotOffsetMax);
                             infoUsedStackSlots.add(slot);
-                        } else if (isVirtualObject(val)) {
+                        } else if (val instanceof VirtualObject) {
                             workList.add(((VirtualObject) val).getValues());
                         } else {
-                            assert isConstant(val) : "Unsupported value: " + val;
+                            assert val instanceof JavaConstant : "Unsupported value: " + val;
                         }
                     }
                 }
@@ -1005,22 +1005,20 @@
                 BytecodeFrame frame = info.debugInfo.frame();
                 while (frame != null) {
                     for (int i = 0; i < frame.numLocals + frame.numStack; i++) {
-                        Value val = frame.values[i];
-                        if (isLegal(val)) {
-                            if (isRegister(val)) {
-                                Register reg = asRegister(val);
-                                if (val.getKind().isObject()) {
-                                    assert (hsailRegConfig.isAllocatableDReg(reg));
-                                    int bitIndex = reg.encoding();
-                                    setOopMapBit(infoIndex, bitIndex);
-                                }
-                            } else if (isStackSlot(val)) {
-                                StackSlot slot = asStackSlot(val);
-                                if (val.getKind().isObject()) {
-                                    assert (HSAIL.getStackOffsetStart(slot, 64) % 8 == 0);
-                                    int bitIndex = numDRegs + HSAIL.getStackOffsetStart(slot, 64) / 8;
-                                    setOopMapBit(infoIndex, bitIndex);
-                                }
+                        JavaValue val = frame.values[i];
+                        if (val instanceof RegisterValue) {
+                            Register reg = ((RegisterValue) val).getRegister();
+                            if (val.getKind().isObject()) {
+                                assert (hsailRegConfig.isAllocatableDReg(reg));
+                                int bitIndex = reg.encoding();
+                                setOopMapBit(infoIndex, bitIndex);
+                            }
+                        } else if (val instanceof StackSlot) {
+                            StackSlot slot = (StackSlot) val;
+                            if (val.getKind().isObject()) {
+                                assert (HSAIL.getStackOffsetStart(slot, 64) % 8 == 0);
+                                int bitIndex = numDRegs + HSAIL.getStackOffsetStart(slot, 64) / 8;
+                                setOopMapBit(infoIndex, bitIndex);
                             }
                         }
                     }
@@ -1136,7 +1134,7 @@
             outterFrameState = createFrameState(lowLevelFrame.caller(), hsailFrame, providers, config, numSRegs, numDRegs, virtualObjects);
         }
         StructuredGraph hostGraph = hsailFrame.graph();
-        Function<? super Value, ? extends ValueNode> lirValueToHirNode = v -> getNodeForValueFromFrame(v, hsailFrame, hostGraph, providers, config, numSRegs, numDRegs, virtualObjects);
+        Function<? super JavaValue, ? extends ValueNode> lirValueToHirNode = v -> getNodeForValueFromFrame(v, hsailFrame, hostGraph, providers, config, numSRegs, numDRegs, virtualObjects);
         ValueNode[] locals = new ValueNode[lowLevelFrame.numLocals];
         for (int i = 0; i < lowLevelFrame.numLocals; i++) {
             locals[i] = lirValueToHirNode.apply(lowLevelFrame.getLocalValue(i));
@@ -1184,7 +1182,7 @@
         throw GraalInternalError.unimplemented();
     }
 
-    private static ValueNode getNodeForValueFromFrame(Value localValue, ParameterNode hsailFrame, StructuredGraph hostGraph, HotSpotProviders providers, HotSpotVMConfig config, int numSRegs,
+    private static ValueNode getNodeForValueFromFrame(JavaValue localValue, ParameterNode hsailFrame, StructuredGraph hostGraph, HotSpotProviders providers, HotSpotVMConfig config, int numSRegs,
                     int numDRegs, Map<VirtualObject, VirtualObjectNode> virtualObjects) {
         ValueNode valueNode;
         if (localValue instanceof JavaConstant) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Thu Oct 30 14:10:46 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,14 +47,14 @@
     }
 
     @Override
-    protected Value computeLockValue(FrameState state, int lockIndex) {
+    protected JavaValue computeLockValue(FrameState state, int lockIndex) {
         int lockDepth = lockIndex;
         if (state.outerFrameState() != null) {
             lockDepth += state.outerFrameState().nestedLockDepth();
         }
         StackSlot slot = lockStack.makeLockSlot(lockDepth);
         ValueNode lock = state.lockAt(lockIndex);
-        Value object = toValue(lock);
+        JavaValue object = toValue(lock);
         boolean eliminated = object instanceof VirtualObject && state.monitorIdAt(lockIndex) != null;
         assert state.monitorIdAt(lockIndex) == null || state.monitorIdAt(lockIndex).getLockDepth() == lockDepth;
         return new HotSpotMonitorValue(object, slot, eliminated);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java	Thu Oct 30 14:10:46 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,11 @@
     protected Value processValue(LIRInstruction inst, InstructionValueProcedure proc, Value value) {
         if (value instanceof HotSpotMonitorValue) {
             HotSpotMonitorValue monitor = (HotSpotMonitorValue) value;
-            if (processed(monitor.getOwner())) {
-                monitor.setOwner(proc.doValue(inst, monitor.getOwner(), OperandMode.ALIVE, STATE_FLAGS));
+            if (monitor.getOwner() instanceof Value) {
+                Value owner = (Value) monitor.getOwner();
+                if (processed(owner)) {
+                    monitor.setOwner((JavaValue) proc.doValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS));
+                }
             }
             return value;
         } else {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMonitorValue.java	Thu Oct 30 14:10:46 2014 +0100
@@ -28,26 +28,26 @@
 /**
  * Represents lock information in the debug information.
  */
-public final class HotSpotMonitorValue extends Value {
+public final class HotSpotMonitorValue extends Value implements JavaValue {
 
     private static final long serialVersionUID = 8241681800464483691L;
 
-    private Value owner;
+    private JavaValue owner;
     private final StackSlot slot;
     private final boolean eliminated;
 
-    public HotSpotMonitorValue(Value owner, StackSlot slot, boolean eliminated) {
+    public HotSpotMonitorValue(JavaValue owner, StackSlot slot, boolean eliminated) {
         super(LIRKind.Illegal);
         this.owner = owner;
         this.slot = slot;
         this.eliminated = eliminated;
     }
 
-    public Value getOwner() {
+    public JavaValue getOwner() {
         return owner;
     }
 
-    public void setOwner(Value newOwner) {
+    public void setOwner(JavaValue newOwner) {
         this.owner = newOwner;
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Thu Oct 30 14:10:46 2014 +0100
@@ -79,10 +79,12 @@
      */
     protected static final EnumSet<OperandFlag> STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK);
 
-    protected void processValues(LIRInstruction inst, Value[] values, InstructionValueProcedure proc) {
+    protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueProcedure proc) {
         for (int i = 0; i < values.length; i++) {
-            Value value = values[i];
-            values[i] = processValue(inst, proc, value);
+            if (values[i] instanceof Value) {
+                Value value = (Value) values[i];
+                values[i] = (JavaValue) processValue(inst, proc, value);
+            }
         }
     }
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Thu Oct 30 13:03:33 2014 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Thu Oct 30 14:10:46 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.printer;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-
 import java.io.*;
 import java.util.*;
 
@@ -184,12 +182,12 @@
         return sb.toString();
     }
 
-    protected String valueToString(Value value, List<VirtualObject> virtualObjects) {
+    protected String valueToString(JavaValue value, List<VirtualObject> virtualObjects) {
         if (value == null) {
             return "-";
         }
-        if (isVirtualObject(value) && !virtualObjects.contains(asVirtualObject(value))) {
-            virtualObjects.add(asVirtualObject(value));
+        if (value instanceof VirtualObject && !virtualObjects.contains(value)) {
+            virtualObjects.add((VirtualObject) value);
         }
         return value.toString();
     }
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu Oct 30 13:03:33 2014 +0100
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Oct 30 14:10:46 2014 +0100
@@ -177,7 +177,7 @@
     typeArrayOop_field(BitSet, words, "[J")                                                                                                                    \
   end_class                                                                                                                                                    \
   start_class(BytecodeFrame)                                                                                                                                   \
-    objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/Value;")                                                                             \
+    objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/JavaValue;")                                                                         \
     int_field(BytecodeFrame, numLocals)                                                                                                                        \
     int_field(BytecodeFrame, numStack)                                                                                                                         \
     int_field(BytecodeFrame, numLocks)                                                                                                                         \
@@ -249,10 +249,10 @@
   start_class(VirtualObject)                                                                                                                                   \
     int_field(VirtualObject, id)                                                                                                                               \
     oop_field(VirtualObject, type, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                                             \
-    objArrayOop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/Value;")                                                                             \
+    objArrayOop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/JavaValue;")                                                                         \
   end_class                                                                                                                                                    \
   start_class(HotSpotMonitorValue)                                                                                                                             \
-    oop_field(HotSpotMonitorValue, owner, "Lcom/oracle/graal/api/meta/Value;")                                                                                 \
+    oop_field(HotSpotMonitorValue, owner, "Lcom/oracle/graal/api/meta/JavaValue;")                                                                             \
     oop_field(HotSpotMonitorValue, slot, "Lcom/oracle/graal/api/code/StackSlot;")                                                                              \
     boolean_field(HotSpotMonitorValue, eliminated)                                                                                                             \
   end_class                                                                                                                                                    \