diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 92d4e6b70f..7e839ba659 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -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);