diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 92b8b9b3911..f2faad16caf 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -66,7 +66,7 @@ CXXFLAGS += -DASSERT # CFLAGS_WARN holds compiler options to suppress/enable warnings. # Compiler warnings are treated as errors -CFLAGS_WARN = $(WARNINGS_ARE_ERRORS) +CFLAGS_WARN = $(WARNINGS_ARE_ERRORS) -Wno-register CFLAGS += $(CFLAGS_WARN) OBJECTNAMES = \ diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 58572f137db..7e839ba6599 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -2552,13 +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"); - ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass(); - ciField* 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); + 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); + } + 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);