< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page
@@ -435,11 +435,15 @@
      JVMCI_THROW_MSG_NULL(NullPointerException, "base object is null");
    }
  
    const char* base_desc = nullptr;
    JVMCIKlassHandle klass(THREAD);
-   if (offset == oopDesc::klass_offset_in_bytes()) {
+ 
+   // With compact object headers, we can test for the explicit offset within
+   // the header to figure out if compiler code is accessing the class.
+   int klass_offset = UseCompactObjectHeaders ? 4 : oopDesc::klass_offset_in_bytes();
+   if (offset == klass_offset) {
      if (JVMCIENV->isa_HotSpotObjectConstantImpl(base_object)) {
        Handle base_oop = JVMCIENV->asConstant(base_object, JVMCI_CHECK_NULL);
        klass = base_oop->klass();
      } else {
        goto unexpected;

@@ -2440,11 +2444,11 @@
  C2V_END
  
  
  C2V_VMENTRY_0(jint, arrayBaseOffset, (JNIEnv* env, jobject, jchar type_char))
    BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
-   return arrayOopDesc::header_size(type) * HeapWordSize;
+   return arrayOopDesc::base_offset_in_bytes(type);
  C2V_END
  
  C2V_VMENTRY_0(jint, arrayIndexScale, (JNIEnv* env, jobject, jchar type_char))
    BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
    return type2aelembytes(type);
< prev index next >