1.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp Fri Apr 07 02:15:31 2017 +0900 1.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Tue Apr 11 19:17:58 2017 +0300 1.3 @@ -1700,8 +1700,10 @@ 1.4 if (x->needs_null_check() && 1.5 (needs_patching || 1.6 MacroAssembler::needs_explicit_null_check(x->offset()))) { 1.7 - // emit an explicit null check because the offset is too large 1.8 - __ null_check(object.result(), new CodeEmitInfo(info)); 1.9 + // Emit an explicit null check because the offset is too large. 1.10 + // If the class is not loaded and the object is NULL, we need to deoptimize to throw a 1.11 + // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code. 1.12 + __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching); 1.13 } 1.14 1.15 LIR_Address* address; 1.16 @@ -1785,8 +1787,10 @@ 1.17 obj = new_register(T_OBJECT); 1.18 __ move(LIR_OprFact::oopConst(NULL), obj); 1.19 } 1.20 - // emit an explicit null check because the offset is too large 1.21 - __ null_check(obj, new CodeEmitInfo(info)); 1.22 + // Emit an explicit null check because the offset is too large. 1.23 + // If the class is not loaded and the object is NULL, we need to deoptimize to throw a 1.24 + // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code. 1.25 + __ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching); 1.26 } 1.27 1.28 LIR_Opr reg = rlock_result(x, field_type);