< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page
*** 22,10 ***
--- 22,11 ---
   * questions.
   *
   */
  
  #include "classfile/javaClasses.hpp"
+ #include "code/aotCodeCache.hpp"
  #include "compiler/compileLog.hpp"
  #include "gc/shared/barrierSet.hpp"
  #include "gc/shared/c2/barrierSetC2.hpp"
  #include "gc/shared/tlab_globals.hpp"
  #include "memory/allocation.inline.hpp"

*** 1975,11 ***
  // Helper to recognize certain Klass fields which are invariant across
  // some group of array types (e.g., int[] or all T[] where T < Object).
  const Type*
  LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
                                   ciKlass* klass) const {
!   assert(!UseCompactObjectHeaders || tkls->offset() != in_bytes(Klass::prototype_header_offset()),
           "must not happen");
    if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
      // The field is Klass::_access_flags.  Return its (constant) value.
      // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
      assert(Opcode() == Op_LoadUS, "must load an unsigned short from _access_flags");
--- 1976,13 ---
  // Helper to recognize certain Klass fields which are invariant across
  // some group of array types (e.g., int[] or all T[] where T < Object).
  const Type*
  LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
                                   ciKlass* klass) const {
!   assert(!UseCompactObjectHeaders ||
+          AOTCodeCache::is_on_for_dump() ||
+          tkls->offset() != in_bytes(Klass::prototype_header_offset()),
           "must not happen");
    if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
      // The field is Klass::_access_flags.  Return its (constant) value.
      // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
      assert(Opcode() == Op_LoadUS, "must load an unsigned short from _access_flags");

*** 2160,11 ***
          // The field is Klass::_super_check_offset.  Return its (constant) value.
          // (Folds up type checking code.)
          assert(Opcode() == Op_LoadI, "must load an int from _super_check_offset");
          return TypeInt::make(klass->super_check_offset());
        }
!       if (UseCompactObjectHeaders) {
          if (tkls->offset() == in_bytes(Klass::prototype_header_offset())) {
            // The field is Klass::_prototype_header. Return its (constant) value.
            assert(this->Opcode() == Op_LoadX, "must load a proper type from _prototype_header");
            return TypeX::make(klass->prototype_header());
          }
--- 2163,13 ---
          // The field is Klass::_super_check_offset.  Return its (constant) value.
          // (Folds up type checking code.)
          assert(Opcode() == Op_LoadI, "must load an int from _super_check_offset");
          return TypeInt::make(klass->super_check_offset());
        }
!       // Class encoding in prototype header may change between runs.
+       // Force loading prototype header when AOT code is generated.
+       if (UseCompactObjectHeaders && !AOTCodeCache::is_on_for_dump()) {
          if (tkls->offset() == in_bytes(Klass::prototype_header_offset())) {
            // The field is Klass::_prototype_header. Return its (constant) value.
            assert(this->Opcode() == Op_LoadX, "must load a proper type from _prototype_header");
            return TypeX::make(klass->prototype_header());
          }
< prev index next >