hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
changeset 43676 c6eed495a42b
parent 42544 58de8aaf9365
child 44315 1e2f842b0c96
equal deleted inserted replaced
43675:a2b322083029 43676:c6eed495a42b
  1750 #endif
  1750 #endif
  1751 
  1751 
  1752   if (x->needs_null_check() &&
  1752   if (x->needs_null_check() &&
  1753       (needs_patching ||
  1753       (needs_patching ||
  1754        MacroAssembler::needs_explicit_null_check(x->offset()))) {
  1754        MacroAssembler::needs_explicit_null_check(x->offset()))) {
  1755     // emit an explicit null check because the offset is too large
  1755     // Emit an explicit null check because the offset is too large.
  1756     __ null_check(object.result(), new CodeEmitInfo(info));
  1756     // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
       
  1757     // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
       
  1758     __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
  1757   }
  1759   }
  1758 
  1760 
  1759   LIR_Address* address;
  1761   LIR_Address* address;
  1760   if (needs_patching) {
  1762   if (needs_patching) {
  1761     // we need to patch the offset in the instruction so don't allow
  1763     // we need to patch the offset in the instruction so don't allow
  1836     LIR_Opr obj = object.result();
  1838     LIR_Opr obj = object.result();
  1837     if (stress_deopt) {
  1839     if (stress_deopt) {
  1838       obj = new_register(T_OBJECT);
  1840       obj = new_register(T_OBJECT);
  1839       __ move(LIR_OprFact::oopConst(NULL), obj);
  1841       __ move(LIR_OprFact::oopConst(NULL), obj);
  1840     }
  1842     }
  1841     // emit an explicit null check because the offset is too large
  1843     // Emit an explicit null check because the offset is too large.
  1842     __ null_check(obj, new CodeEmitInfo(info));
  1844     // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
       
  1845     // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
       
  1846     __ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching);
  1843   }
  1847   }
  1844 
  1848 
  1845   LIR_Opr reg = rlock_result(x, field_type);
  1849   LIR_Opr reg = rlock_result(x, field_type);
  1846   LIR_Address* address;
  1850   LIR_Address* address;
  1847   if (needs_patching) {
  1851   if (needs_patching) {