src/hotspot/share/opto/graphKit.cpp
changeset 53625 0a9dfdbb01d1
parent 53595 8462b295c08b
child 53706 b5b373bda814
equal deleted inserted replaced
53624:8b81c509995e 53625:0a9dfdbb01d1
  2850   if (!UseTypeProfile || !TypeProfileCasts) return NULL;
  2850   if (!UseTypeProfile || !TypeProfileCasts) return NULL;
  2851 
  2851 
  2852   Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
  2852   Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
  2853 
  2853 
  2854   // Make sure we haven't already deoptimized from this tactic.
  2854   // Make sure we haven't already deoptimized from this tactic.
  2855   if (too_many_traps(reason) || too_many_recompiles(reason))
  2855   if (too_many_traps_or_recompiles(reason))
  2856     return NULL;
  2856     return NULL;
  2857 
  2857 
  2858   // (No, this isn't a call, but it's enough like a virtual call
  2858   // (No, this isn't a call, but it's enough like a virtual call
  2859   // to use the same ciMethod accessor to get the profile info...)
  2859   // to use the same ciMethod accessor to get the profile info...)
  2860   // If we have a speculative type use it instead of profiling (which
  2860   // If we have a speculative type use it instead of profiling (which
  2905   // type == NULL if profiling tells us this object is always null
  2905   // type == NULL if profiling tells us this object is always null
  2906   if (type != NULL) {
  2906   if (type != NULL) {
  2907     Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
  2907     Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
  2908     Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
  2908     Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
  2909 
  2909 
  2910     if (!too_many_traps(null_reason) && !too_many_recompiles(null_reason) &&
  2910     if (!too_many_traps_or_recompiles(null_reason) &&
  2911         !too_many_traps(class_reason) &&
  2911         !too_many_traps_or_recompiles(class_reason)) {
  2912         !too_many_recompiles(class_reason)) {
       
  2913       Node* not_null_obj = NULL;
  2912       Node* not_null_obj = NULL;
  2914       // not_null is true if we know the object is not null and
  2913       // not_null is true if we know the object is not null and
  2915       // there's no need for a null check
  2914       // there's no need for a null check
  2916       if (!not_null) {
  2915       if (!not_null) {
  2917         Node* null_ctl = top();
  2916         Node* null_ctl = top();
  2932       }
  2931       }
  2933       replace_in_map(not_null_obj, exact_obj);
  2932       replace_in_map(not_null_obj, exact_obj);
  2934       obj = exact_obj;
  2933       obj = exact_obj;
  2935     }
  2934     }
  2936   } else {
  2935   } else {
  2937     if (!too_many_traps(Deoptimization::Reason_null_assert) &&
  2936     if (!too_many_traps_or_recompiles(Deoptimization::Reason_null_assert)) {
  2938         !too_many_recompiles(Deoptimization::Reason_null_assert)) {
       
  2939       Node* exact_obj = null_assert(obj);
  2937       Node* exact_obj = null_assert(obj);
  2940       replace_in_map(obj, exact_obj);
  2938       replace_in_map(obj, exact_obj);
  2941       obj = exact_obj;
  2939       obj = exact_obj;
  2942     }
  2940     }
  2943   }
  2941   }