Skip to content

Commit

Permalink
add the processing of the failure to obtain static fields by instance…
Browse files Browse the repository at this point in the history
…Klass
  • Loading branch information
18855466553 committed May 8, 2024
1 parent a3b10aa commit 0cab9c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hotspot/src/share/vm/opto/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2552,16 +2552,18 @@ TypeOopPtr::TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int o
} else if (klass() == ciEnv::current()->Class_klass() &&
_offset >= InstanceMirrorKlass::offset_of_static_fields()) {
// Static fields
assert(o != NULL, "must be constant");
ciField* field = NULL;
if (o != NULL) {
ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass();
field = k->get_field_by_offset(_offset, true);
}
assert(field != NULL, "missing field");
BasicType basic_elem_type = field->layout_type();
_is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
basic_elem_type == T_ARRAY);
if (field != NULL) {
BasicType basic_elem_type = field->layout_type();
_is_ptr_to_narrowoop = UseCompressedOops && is_reference_type(basic_elem_type);
} else {
// unsafe access
_is_ptr_to_narrowoop = UseCompressedOops;
}
} else {
// Instance fields which contains a compressed oop references.
field = ik->get_field_by_offset(_offset, false);
Expand Down

0 comments on commit 0cab9c8

Please sign in to comment.