< prev index next > src/hotspot/share/opto/memnode.cpp
Print this page
// 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());
// 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.
return Type::get_zero_type(_type->basic_type());
}
}
Node* alloc = is_new_object_mark_load(phase);
- if (alloc != nullptr && !(alloc->Opcode() == Op_Allocate && UseBiasedLocking)) {
+ if (alloc != nullptr && !(alloc->Opcode() == Op_Allocate && UseBiasedLocking) && !UseCompactObjectHeaders) {
return TypeX::make(markWord::prototype().value());
}
return _type;
}
< prev index next >