< 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;
< prev index next >