src/share/vm/c1/c1_LIRGenerator.cpp

changeset 8735
dcaab7b518c4
parent 8657
739246e5f9f3
child 8856
ac27a9c85bea
child 8882
279a5dd96f9b
equal deleted inserted replaced
8734:c73c5d205d0a 8735:dcaab7b518c4
1698 #endif 1698 #endif
1699 1699
1700 if (x->needs_null_check() && 1700 if (x->needs_null_check() &&
1701 (needs_patching || 1701 (needs_patching ||
1702 MacroAssembler::needs_explicit_null_check(x->offset()))) { 1702 MacroAssembler::needs_explicit_null_check(x->offset()))) {
1703 // emit an explicit null check because the offset is too large 1703 // Emit an explicit null check because the offset is too large.
1704 __ null_check(object.result(), new CodeEmitInfo(info)); 1704 // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
1705 // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
1706 __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
1705 } 1707 }
1706 1708
1707 LIR_Address* address; 1709 LIR_Address* address;
1708 if (needs_patching) { 1710 if (needs_patching) {
1709 // we need to patch the offset in the instruction so don't allow 1711 // we need to patch the offset in the instruction so don't allow
1783 LIR_Opr obj = object.result(); 1785 LIR_Opr obj = object.result();
1784 if (stress_deopt) { 1786 if (stress_deopt) {
1785 obj = new_register(T_OBJECT); 1787 obj = new_register(T_OBJECT);
1786 __ move(LIR_OprFact::oopConst(NULL), obj); 1788 __ move(LIR_OprFact::oopConst(NULL), obj);
1787 } 1789 }
1788 // emit an explicit null check because the offset is too large 1790 // Emit an explicit null check because the offset is too large.
1789 __ null_check(obj, new CodeEmitInfo(info)); 1791 // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
1792 // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
1793 __ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching);
1790 } 1794 }
1791 1795
1792 LIR_Opr reg = rlock_result(x, field_type); 1796 LIR_Opr reg = rlock_result(x, field_type);
1793 LIR_Address* address; 1797 LIR_Address* address;
1794 if (needs_patching) { 1798 if (needs_patching) {

mercurial