--- old/src/hotspot/share/c1/c1_GraphBuilder.cpp 2019-03-07 19:52:20.033912950 -0800 +++ new/src/hotspot/share/c1/c1_GraphBuilder.cpp 2019-03-07 19:52:19.781904090 -0800 @@ -1716,7 +1716,7 @@ } LoadField* load_field = new LoadField(append(obj), offset, field, true, state_before, needs_patching); - if (field->is_never_null()) { + if (field->is_q_type()) { load_field->set_never_null(true); } push(type, append(load_field)); --- old/src/hotspot/share/c1/c1_LIRGenerator.cpp 2019-03-07 19:52:20.693936157 -0800 +++ new/src/hotspot/share/c1/c1_LIRGenerator.cpp 2019-03-07 19:52:20.449927578 -0800 @@ -1543,9 +1543,12 @@ if (x->needs_null_check() && (needs_patching || MacroAssembler::needs_explicit_null_check(x->offset()))) { - if (needs_patching && x->field()->is_never_null()) { - // We are storing a field of type "QT;", but T is not yet loaded, so we don't - // know whether this field is flattened or not. Let's deoptimize and recompile. + if (needs_patching && x->field()->is_q_type()) { + // We are storing a field of type "QT;" into holder class H, but H is not yet + // loaded. (If H had been loaded, then T must also have already been loaded + // due to the "Q" signature, and needs_patching would be false). + assert(!x->field()->holder()->is_loaded(), "must be"); + // We don't know the offset of this field. Let's deopt and recompile. CodeStub* stub = new DeoptimizeStub(new CodeEmitInfo(info), Deoptimization::Reason_unloaded, Deoptimization::Action_make_not_entrant); @@ -1868,7 +1871,7 @@ return _barrier_set->resolve(this, decorators, obj); } -Value LIRGenerator::non_nullable_load_field_prolog(LoadField* x, CodeEmitInfo* info) { +Value LIRGenerator::q_type_load_field_prolog(LoadField* x, CodeEmitInfo* info) { ciField* field = x->field(); ciInstanceKlass* holder = field->holder(); Value default_value = NULL; @@ -1971,8 +1974,8 @@ #endif Value default_value = NULL; - if (x->field()->is_never_null()) { - default_value = non_nullable_load_field_prolog(x, info); + if (x->field()->is_q_type()) { + default_value = q_type_load_field_prolog(x, info); } bool stress_deopt = StressLoopInvariantCodeMotion && info && info->deoptimize_on_exception(); --- old/src/hotspot/share/c1/c1_LIRGenerator.hpp 2019-03-07 19:52:21.357959505 -0800 +++ new/src/hotspot/share/c1/c1_LIRGenerator.hpp 2019-03-07 19:52:21.117951066 -0800 @@ -266,7 +266,7 @@ void do_update_CRC32C(Intrinsic* x); void do_vectorizedMismatch(Intrinsic* x); - Value non_nullable_load_field_prolog(LoadField* x, CodeEmitInfo* info); + Value q_type_load_field_prolog(LoadField* x, CodeEmitInfo* info); void access_flattened_array(bool is_load, LIRItem& array, LIRItem& index, LIRItem& obj_item); bool needs_flattened_array_store_check(StoreIndexed* x); void check_flattened_array(LIRItem& array, CodeStub* slow_path); --- old/src/hotspot/share/ci/ciField.hpp 2019-03-07 19:52:21.981981446 -0800 +++ new/src/hotspot/share/ci/ciField.hpp 2019-03-07 19:52:21.737972867 -0800 @@ -202,7 +202,7 @@ klass_name == ciSymbol::java_lang_Long_LongCache())); } - bool is_never_null() const { + bool is_q_type() const { // Cannot use (type()->basic_type() == T_VALUETYPE) -- if the class is not loaded, // type() is an unloaded ciInstanceKlass! return signature()->char_at(0) == 'Q';