changeset 22478:822922922f3c

Explicitly store slot kinds in DebugInfo.
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 28 Aug 2015 13:18:24 +0200
parents c3ad14a83248
children f5fee32d3d6e
files jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/StackLockValue.java jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/ValueUtil.java jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/VirtualObject.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCompiledCode.java jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaValue.java src/share/vm/jvmci/jvmciCodeInstaller.cpp src/share/vm/jvmci/jvmciCodeInstaller.hpp src/share/vm/jvmci/jvmciJavaAccess.hpp
diffstat 10 files changed, 150 insertions(+), 120 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java	Fri Aug 28 13:18:24 2015 +0200
@@ -63,7 +63,13 @@
      * 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;
+
+    /**
+     * An array describing the Java kind of the {@link #values}. It records a kind for the locals
+     * and the operand stack.
+     */
+    public final Kind[] slotKinds;
 
     /**
      * The number of locals in the values array.
@@ -169,12 +175,14 @@
      * @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, Kind[] slotKinds, int numLocals, int numStack,
+                    int numLocks) {
         super(caller, method, bci);
         assert values != null;
         this.rethrowException = rethrowException;
         this.duringCall = duringCall;
         this.values = values;
+        this.slotKinds = slotKinds;
         this.numLocals = numLocals;
         this.numStack = numStack;
         this.numLocks = numLocks;
@@ -186,18 +194,17 @@
      * slot following a double word item. This should really be checked in FrameState itself but
      * because of Word type rewriting and alternative backends that can't be done.
      */
-    public boolean validateFormat(boolean derivedOk) {
+    public boolean validateFormat() {
         if (caller() != null) {
-            caller().validateFormat(derivedOk);
+            caller().validateFormat();
         }
         for (int i = 0; i < numLocals + numStack; i++) {
             if (values[i] != null) {
-                Kind kind = values[i].getKind();
+                Kind kind = slotKinds[i];
                 if (kind.needsTwoSlots()) {
-                    assert values.length > i + 1 : String.format("missing second word %s", this);
-                    assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal : this;
+                    assert slotKinds.length > i + 1 : String.format("missing second word %s", this);
+                    assert slotKinds[i + 1] == Kind.Illegal : this;
                 }
-                assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isUnknownReference() : "Unexpected derived value: " + values[i];
             }
         }
         return true;
@@ -209,7 +216,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];
     }
 
@@ -219,7 +226,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];
     }
 
@@ -229,7 +236,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/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/StackLockValue.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/StackLockValue.java	Fri Aug 28 13:18:24 2015 +0200
@@ -28,24 +28,23 @@
 /**
  * Represents lock information in the debug information.
  */
-public final class StackLockValue extends AbstractValue implements JavaValue {
+public final class StackLockValue implements JavaValue {
 
-    private Value owner;
+    private JavaValue owner;
     private StackSlotValue slot;
     private final boolean eliminated;
 
-    public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) {
-        super(LIRKind.Illegal);
+    public StackLockValue(JavaValue object, StackSlotValue slot, boolean eliminated) {
         this.owner = object;
         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/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/ValueUtil.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/ValueUtil.java	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -36,16 +36,21 @@
         return Value.ILLEGAL.equals(value);
     }
 
+    public static boolean isIllegalJavaValue(JavaValue value) {
+        assert value != null;
+        return Value.ILLEGAL.equals(value);
+    }
+
     public static boolean isLegal(Value value) {
         return !isIllegal(value);
     }
 
-    public static boolean isVirtualObject(Value value) {
+    public static boolean isVirtualObject(JavaValue value) {
         assert value != null;
         return value instanceof VirtualObject;
     }
 
-    public static VirtualObject asVirtualObject(Value value) {
+    public static VirtualObject asVirtualObject(JavaValue value) {
         assert value != null;
         return (VirtualObject) value;
     }
@@ -55,6 +60,11 @@
         return value instanceof JavaConstant;
     }
 
+    public static boolean isConstantJavaValue(JavaValue value) {
+        assert value != null;
+        return value instanceof JavaConstant;
+    }
+
     public static JavaConstant asConstant(Value value) {
         assert value != null;
         return (JavaConstant) value;
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/VirtualObject.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/VirtualObject.java	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -31,10 +31,11 @@
  * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
  * object.
  */
-public final class VirtualObject extends AbstractValue implements JavaValue {
+public final class VirtualObject implements JavaValue {
 
     private final ResolvedJavaType type;
-    private Value[] values;
+    private JavaValue[] values;
+    private Kind[] slotKinds;
     private final int id;
 
     /**
@@ -46,24 +47,20 @@
      *
      * @param type the type of the object whose allocation was removed during compilation. This can
      *            be either an instance of an array type.
-     * @param values an array containing all the values to be stored into the object when it is
-     *            recreated
      * @param id a unique id that identifies the object within the debug information for one
      *            position in the compiled code.
      * @return a new {@link VirtualObject} instance.
      */
-    public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
-        return new VirtualObject(type, values, id);
+    public static VirtualObject get(ResolvedJavaType type, int id) {
+        return new VirtualObject(type, id);
     }
 
-    private VirtualObject(ResolvedJavaType type, Value[] values, int id) {
-        super(LIRKind.reference(Kind.Object));
+    private VirtualObject(ResolvedJavaType type, int id) {
         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);
@@ -118,11 +115,18 @@
     /**
      * 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;
     }
 
     /**
+     * Returns an array containing the Java kind of all values in the object.
+     */
+    public Kind[] getSlotKinds() {
+        return slotKinds;
+    }
+
+    /**
      * Returns the unique id that identifies the object within the debug information for one
      * position in the compiled code.
      */
@@ -130,16 +134,18 @@
         return id;
     }
 
-    private static boolean checkValues(ResolvedJavaType type, Value[] values) {
+    private boolean checkValues() {
+        assert (values == null) == (slotKinds == null);
         if (values != null) {
+            assert values.length == slotKinds.length;
             if (!type.isArray()) {
                 ResolvedJavaField[] fields = type.getInstanceFields(true);
                 int fieldIndex = 0;
                 for (int i = 0; i < values.length; i++) {
                     ResolvedJavaField field = fields[fieldIndex++];
-                    Kind valKind = values[i].getKind().getStackKind();
+                    Kind valKind = slotKinds[i].getStackKind();
                     if (field.getKind() == Kind.Object) {
-                        assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind();
+                        assert valKind.isObject() : field + ": " + valKind + " != " + field.getKind();
                     } else {
                         if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) {
                             assert fields[fieldIndex].getKind() == Kind.Int;
@@ -154,12 +160,12 @@
                 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;
+                        assert slotKinds[i].isObject() : slotKinds[i] + " != " + componentKind;
                     }
                 } else {
                     for (int i = 0; i < values.length; i++) {
-                        assert values[i].getKind() == componentKind || componentKind.getBitCount() >= values[i].getKind().getBitCount() ||
-                                        (componentKind == Kind.Int && values[i].getKind().getBitCount() >= Kind.Int.getBitCount()) : values[i].getKind() + " != " + componentKind;
+                        assert slotKinds[i] == componentKind || componentKind.getBitCount() >= slotKinds[i].getBitCount() ||
+                                        (componentKind == Kind.Int && slotKinds[i].getBitCount() >= Kind.Int.getBitCount()) : slotKinds[i] + " != " + componentKind;
                     }
                 }
             }
@@ -172,15 +178,17 @@
      *
      * @param values an array containing all the values to be stored into the object when it is
      *            recreated.
+     * @param slotKinds an array containing the Java kinds of the values.
      */
-    public void setValues(Value[] values) {
-        assert checkValues(type, values);
+    public void setValues(JavaValue[] values, Kind[] slotKinds) {
         this.values = values;
+        this.slotKinds = slotKinds;
+        assert checkValues();
     }
 
     @Override
     public int hashCode() {
-        return getLIRKind().hashCode() + type.hashCode();
+        return 42 + type.hashCode();
     }
 
     @Override
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCompiledCode.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCompiledCode.java	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -138,7 +138,7 @@
                 Infopoint info = (Infopoint) site;
                 if (info.debugInfo != null) {
                     BytecodeFrame frame = info.debugInfo.frame();
-                    assert frame == null || frame.validateFormat(false);
+                    assert frame == null || frame.validateFormat();
                 }
             }
         }
--- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -49,6 +49,11 @@
     PrimitiveConstant FALSE = new PrimitiveConstant(Kind.Boolean, 0L);
 
     /**
+     * Returns the Java kind of this constant.
+     */
+    Kind getKind();
+
+    /**
      * Checks whether this constant is null.
      *
      * @return {@code true} if this constant is the null constant
--- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaValue.java	Thu Aug 27 13:35:19 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaValue.java	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -23,12 +23,7 @@
 package jdk.internal.jvmci.meta;
 
 /**
- * Interface for things that represent a Java value.
+ * Marker interface for things that represent a Java value.
  */
 public interface JavaValue {
-
-    /**
-     * Returns the kind of this value.
-     */
-    Kind getKind();
 }
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Thu Aug 27 13:35:19 2015 -0700
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Fri Aug 28 13:18:24 2015 +0200
@@ -178,41 +178,39 @@
   record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
 }
 
-ScopeValue* CodeInstaller::get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
-  second = NULL;
-  if (value == AbstractValue::ILLEGAL()) {
-    return _illegal_value;
-  }
-
+static Location::Type get_oop_type(oop value) {
   oop lirKind = AbstractValue::lirKind(value);
   oop platformKind = LIRKind::platformKind(lirKind);
-  jint referenceMask = LIRKind::referenceMask(lirKind);
-  assert(referenceMask != -1, "derived pointers are not allowed");
-  assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask");
-  bool reference = referenceMask == 1;
+  assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask");
+  
+  if (JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind)) == T_INT) {
+    return Location::narrowoop;
+  } else {
+    return Location::oop;
+  }
+}
 
-  BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind));
-
-  if (value->is_a(RegisterValue::klass())) {
+ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
+  second = NULL;
+  if (value == AbstractValue::ILLEGAL()) {
+    assert(type == T_ILLEGAL, "expected legal value");
+    return _illegal_value;
+  } else if (value->is_a(RegisterValue::klass())) {
     oop reg = RegisterValue::reg(value);
     jint number = code_Register::number(reg);
     VMReg hotspotRegister = get_hotspot_reg(number);
     if (is_general_purpose_reg(hotspotRegister)) {
       Location::Type locationType;
-      if (type == T_INT) {
-        locationType = reference ? Location::narrowoop : Location::int_in_long;
-      } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
-        locationType = Location::int_in_long;
-      } else if (type == T_FLOAT) {
+      if (type == T_OBJECT) {
+        locationType = get_oop_type(value);
+      } else if (type == T_LONG) {
+        locationType = Location::lng;
+      } else {
+        assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in cpu register");
         locationType = Location::int_in_long;
-      } else if (type == T_LONG) {
-        locationType = reference ? Location::oop : Location::lng;
-      } else {
-        assert(type == T_OBJECT && reference, "unexpected type in cpu register");
-        locationType = Location::oop;
       }
       ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
-      if (type == T_LONG && !reference) {
+      if (type == T_LONG) {
         second = value;
       }
       return value;
@@ -225,7 +223,6 @@
       } else {
         locationType = Location::dbl;
       }
-      assert(!reference, "unexpected type in floating point register");
       ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
       if (type == T_DOUBLE) {
         second = value;
@@ -239,51 +236,47 @@
     }
 
     Location::Type locationType;
-    if (type == T_LONG) {
-      locationType = reference ? Location::oop : Location::lng;
-    } else if (type == T_INT) {
-      locationType = reference ? Location::narrowoop : Location::normal;
-    } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
-      locationType = Location::normal;
-    } else if (type == T_FLOAT) {
-      assert(!reference, "unexpected type in stack slot");
-      locationType = Location::normal;
+    if (type == T_OBJECT) {
+      locationType = get_oop_type(value);
+    } else if (type == T_LONG) {
+      locationType = Location::lng;
     } else if (type == T_DOUBLE) {
-      assert(!reference, "unexpected type in stack slot");
       locationType = Location::dbl;
     } else {
-      assert(type == T_OBJECT && reference, "unexpected type in stack slot");
-      locationType = Location::oop;
+      assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in stack slot");
+      locationType = Location::normal;
     }
     ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
-    if (type == T_DOUBLE || (type == T_LONG && !reference)) {
+    if (type == T_DOUBLE || type == T_LONG) {
       second = value;
     }
     return value;
-  } else if (value->is_a(JavaConstant::klass())){
+  } else if (value->is_a(JavaConstant::klass())) {
     record_metadata_in_constant(value, _oop_recorder);
     if (value->is_a(PrimitiveConstant::klass())) {
-      assert(!reference, "unexpected primitive constant type");
-      if(value->is_a(RawConstant::klass())) {
+      if (value->is_a(RawConstant::klass())) {
         jlong prim = PrimitiveConstant::primitive(value);
         return new ConstantLongValue(prim);
-      } else if (type == T_INT || type == T_FLOAT) {
-        jint prim = (jint)PrimitiveConstant::primitive(value);
-        switch (prim) {
-          case -1: return _int_m1_scope_value;
-          case  0: return _int_0_scope_value;
-          case  1: return _int_1_scope_value;
-          case  2: return _int_2_scope_value;
-          default: return new ConstantIntValue(prim);
+      } else {
+        assert(type == JVMCIRuntime::kindToBasicType(Kind::typeChar(PrimitiveConstant::kind(value))), "primitive constant type doesn't match");
+        if (type == T_INT || type == T_FLOAT) {
+          jint prim = (jint)PrimitiveConstant::primitive(value);
+          switch (prim) {
+            case -1: return _int_m1_scope_value;
+            case  0: return _int_0_scope_value;
+            case  1: return _int_1_scope_value;
+            case  2: return _int_2_scope_value;
+            default: return new ConstantIntValue(prim);
+          }
+        } else {
+          assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type");
+          jlong prim = PrimitiveConstant::primitive(value);
+          second = _int_1_scope_value;
+          return new ConstantLongValue(prim);
         }
-      } else {
-        assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type");
-        jlong prim = PrimitiveConstant::primitive(value);
-        second = _int_1_scope_value;
-        return new ConstantLongValue(prim);
       }
     } else {
-        assert(reference, "unexpected object constant type");
+      assert(type == T_OBJECT, "unexpected object constant");
       if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) {
         return _oop_null_scope_value;
       } else {
@@ -294,6 +287,7 @@
       }
     }
   } else if (value->is_a(VirtualObject::klass())) {
+    assert(type == T_OBJECT, "unexpected virtual object");
     int id = VirtualObject::id(value);
     ScopeValue* object = objects->at(id);
     assert(object != NULL, "missing value");
@@ -314,10 +308,13 @@
   bool isLongArray = klass == Universe::longArrayKlassObj();
 
   objArrayOop values = VirtualObject::values(value);
+  objArrayOop slotKinds = VirtualObject::slotKinds(value);
   for (jint i = 0; i < values->length(); i++) {
     ScopeValue* cur_second = NULL;
     oop object = values->obj_at(i);
-    ScopeValue* value = get_scope_value(object, objects, cur_second);
+    oop kind = slotKinds->obj_at(i);
+    BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind));
+    ScopeValue* value = get_scope_value(object, type, objects, cur_second);
 
     if (isLongArray && cur_second == NULL) {
       // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
@@ -334,13 +331,13 @@
 }
 
 MonitorValue* CodeInstaller::get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects) {
-  guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type MonitorValue");
+  guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type StackLockValue");
 
   ScopeValue* second = NULL;
-  ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), objects, second);
+  ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second);
   assert(second == NULL, "monitor cannot occupy two stack slots");
 
-  ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), objects, second);
+  ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), T_LONG, objects, second);
   assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
   assert(lock_data_value->is_location(), "invalid monitor location");
   Location lock_data_loc = ((LocationValue*)lock_data_value)->location();
@@ -726,7 +723,7 @@
     // Stubs do not record scope info, just oop maps
     return;
   }
-  
+
   GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info);
   record_scope(pc_offset, position, objectMapping);
 }
@@ -775,8 +772,10 @@
     jint expression_count = BytecodeFrame::numStack(frame);
     jint monitor_count = BytecodeFrame::numLocks(frame);
     objArrayOop values = BytecodeFrame::values(frame);
+    objArrayOop slotKinds = BytecodeFrame::slotKinds(frame);
 
     assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length");
+    assert(local_count + expression_count == slotKinds->length(), "unexpected slotKinds length");
 
     GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
     GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
@@ -791,13 +790,17 @@
       ScopeValue* second = NULL;
       oop value = values->obj_at(i);
       if (i < local_count) {
-        ScopeValue* first = get_scope_value(value, objects, second);
+        oop kind = slotKinds->obj_at(i);
+        BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind));
+        ScopeValue* first = get_scope_value(value, type, objects, second);
         if (second != NULL) {
           locals->append(second);
         }
         locals->append(first);
       } else if (i < local_count + expression_count) {
-        ScopeValue* first = get_scope_value(value, objects, second);
+        oop kind = slotKinds->obj_at(i);
+        BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind));
+        ScopeValue* first = get_scope_value(value, type, objects, second);
         if (second != NULL) {
           expressions->append(second);
         }
--- a/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Thu Aug 27 13:35:19 2015 -0700
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Fri Aug 28 13:18:24 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -117,7 +117,7 @@
   static bool is_general_purpose_reg(VMReg hotspotRegister);
 
 private:
-  ScopeValue* get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
+  ScopeValue* get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
   MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
 
   // extract the fields of the CompilationResult
--- a/src/share/vm/jvmci/jvmciJavaAccess.hpp	Thu Aug 27 13:35:19 2015 -0700
+++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp	Fri Aug 28 13:18:24 2015 +0200
@@ -172,7 +172,8 @@
     typeArrayOop_field(RegisterSaveLayout, slots, "[I")                                                                                                        \
   end_class                                                                                                                                                    \
   start_class(BytecodeFrame)                                                                                                                                   \
-    objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/Value;")                                                                                 \
+    objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/JavaValue;")                                                                           \
+    objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/internal/jvmci/meta/Kind;")                                                                             \
     int_field(BytecodeFrame, numLocals)                                                                                                                        \
     int_field(BytecodeFrame, numStack)                                                                                                                         \
     int_field(BytecodeFrame, numLocks)                                                                                                                         \
@@ -188,6 +189,7 @@
   start_class(JavaConstant)                                                                                                                                    \
   end_class                                                                                                                                                    \
   start_class(PrimitiveConstant)                                                                                                                               \
+    oop_field(PrimitiveConstant, kind, "Ljdk/internal/jvmci/meta/Kind;")                                                                                       \
     long_field(PrimitiveConstant, primitive)                                                                                                                   \
   end_class                                                                                                                                                    \
   start_class(RawConstant)                                                                                                                                     \
@@ -241,12 +243,13 @@
   end_class                                                                                                                                                    \
   start_class(VirtualObject)                                                                                                                                   \
     int_field(VirtualObject, id)                                                                                                                               \
-    oop_field(VirtualObject, type, "Ljdk/internal/jvmci/meta/ResolvedJavaType;")                                                                                 \
-    objArrayOop_field(VirtualObject, values, "[Ljdk/internal/jvmci/meta/Value;")                                                                                 \
+    oop_field(VirtualObject, type, "Ljdk/internal/jvmci/meta/ResolvedJavaType;")                                                                               \
+    objArrayOop_field(VirtualObject, values, "[Ljdk/internal/jvmci/meta/JavaValue;")                                                                           \
+    objArrayOop_field(VirtualObject, slotKinds, "[Ljdk/internal/jvmci/meta/Kind;")                                                                             \
   end_class                                                                                                                                                    \
   start_class(StackLockValue)                                                                                                                                  \
-    oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/Value;")                                                                                          \
-    oop_field(StackLockValue, slot, "Ljdk/internal/jvmci/code/StackSlotValue;")                                                                                  \
+    oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/JavaValue;")                                                                                    \
+    oop_field(StackLockValue, slot, "Ljdk/internal/jvmci/code/StackSlotValue;")                                                                                \
     boolean_field(StackLockValue, eliminated)                                                                                                                  \
   end_class                                                                                                                                                    \
   start_class(SpeculationLog)                                                                                                                                  \