< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page
*** 1932,10 ***
--- 1932,17 ---
  // 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 {
+   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());
+     }
+   }
    if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
      // The field is Klass::_modifier_flags.  Return its (constant) value.
      // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
      assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
      return TypeInt::make(klass->modifier_flags());

*** 2104,10 ***
--- 2111,17 ---
          // 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());
+         }
+       }
        // Compute index into primary_supers array
        juint depth = (tkls->offset() - in_bytes(Klass::primary_supers_offset())) / sizeof(Klass*);
        // Check for overflowing; use unsigned compare to handle the negative case.
        if( depth < ciKlass::primary_super_limit() ) {
          // The field is an element of Klass::_primary_supers.  Return its (constant) value.

*** 2194,11 ***
        return Type::get_zero_type(_type->basic_type());
      }
    }
  
    Node* alloc = is_new_object_mark_load();
!   if (alloc != nullptr) {
      return TypeX::make(markWord::prototype().value());
    }
  
    return _type;
  }
--- 2208,11 ---
        return Type::get_zero_type(_type->basic_type());
      }
    }
  
    Node* alloc = is_new_object_mark_load();
!   if (!UseCompactObjectHeaders && alloc != nullptr) {
      return TypeX::make(markWord::prototype().value());
    }
  
    return _type;
  }
< prev index next >