src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/graphKit.cpp

src/share/vm/opto/graphKit.cpp

Print this page
rev 5771 : 8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
Summary: type methods shouldn't always operate on speculative part
Reviewed-by:
rev 5772 : imported patch typefixes-8027422-chris
rev 5774 : 8031752: Failed speculative optimizations should be reattempted when root of compilation is different
Summary: support for speculative traps that keep track of the root of the compilation in which a trap occurs.
Reviewed-by:

*** 609,621 **** // create the stack trace. // Usual case: Bail to interpreter. // Reserve the right to recompile if we haven't seen anything yet. Deoptimization::DeoptAction action = Deoptimization::Action_maybe_recompile; if (treat_throw_as_hot ! && (method()->method_data()->trap_recompiled_at(bci()) || C->too_many_traps(reason))) { // We cannot afford to take more traps here. Suffer in the interpreter. if (C->log() != NULL) C->log()->elem("hot_throw preallocated='0' reason='%s' mcount='%d'", Deoptimization::trap_reason_name(reason), --- 609,622 ---- // create the stack trace. // Usual case: Bail to interpreter. // Reserve the right to recompile if we haven't seen anything yet. + assert(!Deoptimization::reason_is_speculate(reason), "unsupported"); Deoptimization::DeoptAction action = Deoptimization::Action_maybe_recompile; if (treat_throw_as_hot ! && (method()->method_data()->trap_recompiled_at(bci(), NULL) || C->too_many_traps(reason))) { // We cannot afford to take more traps here. Suffer in the interpreter. if (C->log() != NULL) C->log()->elem("hot_throw preallocated='0' reason='%s' mcount='%d'", Deoptimization::trap_reason_name(reason),
*** 2736,2747 **** ciKlass* require_klass, ciKlass* spec_klass, bool safe_for_replace) { if (!UseTypeProfile || !TypeProfileCasts) return NULL; // Make sure we haven't already deoptimized from this tactic. ! if (too_many_traps(Deoptimization::Reason_class_check)) return NULL; // (No, this isn't a call, but it's enough like a virtual call // to use the same ciMethod accessor to get the profile info...) // If we have a speculative type use it instead of profiling (which --- 2737,2750 ---- ciKlass* require_klass, ciKlass* spec_klass, bool safe_for_replace) { if (!UseTypeProfile || !TypeProfileCasts) return NULL; + Deoptimization::DeoptReason reason = spec_klass == NULL ? Deoptimization::Reason_class_check : Deoptimization::Reason_speculate_class_check; + // Make sure we haven't already deoptimized from this tactic. ! if (too_many_traps(reason)) return NULL; // (No, this isn't a call, but it's enough like a virtual call // to use the same ciMethod accessor to get the profile info...) // If we have a speculative type use it instead of profiling (which
*** 2759,2769 **** Node* exact_obj = not_null_obj; // will get updated in place... Node* slow_ctl = type_check_receiver(exact_obj, exact_kls, 1.0, &exact_obj); { PreserveJVMState pjvms(this); set_control(slow_ctl); ! uncommon_trap(Deoptimization::Reason_class_check, Deoptimization::Action_maybe_recompile); } if (safe_for_replace) { replace_in_map(not_null_obj, exact_obj); } --- 2762,2772 ---- Node* exact_obj = not_null_obj; // will get updated in place... Node* slow_ctl = type_check_receiver(exact_obj, exact_kls, 1.0, &exact_obj); { PreserveJVMState pjvms(this); set_control(slow_ctl); ! uncommon_trap(reason, Deoptimization::Action_maybe_recompile); } if (safe_for_replace) { replace_in_map(not_null_obj, exact_obj); }
*** 2786,2797 **** Node* GraphKit::maybe_cast_profiled_obj(Node* obj, ciKlass* type, bool not_null) { // type == NULL if profiling tells us this object is always null if (type != NULL) { ! if (!too_many_traps(Deoptimization::Reason_null_check) && ! !too_many_traps(Deoptimization::Reason_class_check)) { Node* not_null_obj = NULL; // not_null is true if we know the object is not null and // there's no need for a null check if (!not_null) { Node* null_ctl = top(); --- 2789,2802 ---- Node* GraphKit::maybe_cast_profiled_obj(Node* obj, ciKlass* type, bool not_null) { // type == NULL if profiling tells us this object is always null if (type != NULL) { ! Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check; ! Deoptimization::DeoptReason null_reason = Deoptimization::Reason_null_check; ! if (!too_many_traps(null_reason) && ! !too_many_traps(class_reason)) { Node* not_null_obj = NULL; // not_null is true if we know the object is not null and // there's no need for a null check if (!not_null) { Node* null_ctl = top();
*** 2806,2816 **** Node* slow_ctl = type_check_receiver(exact_obj, exact_kls, 1.0, &exact_obj); { PreserveJVMState pjvms(this); set_control(slow_ctl); ! uncommon_trap(Deoptimization::Reason_class_check, Deoptimization::Action_maybe_recompile); } replace_in_map(not_null_obj, exact_obj); obj = exact_obj; } --- 2811,2821 ---- Node* slow_ctl = type_check_receiver(exact_obj, exact_kls, 1.0, &exact_obj); { PreserveJVMState pjvms(this); set_control(slow_ctl); ! uncommon_trap(class_reason, Deoptimization::Action_maybe_recompile); } replace_in_map(not_null_obj, exact_obj); obj = exact_obj; }
*** 2875,2885 **** known_statically = (static_res == SSC_always_true || static_res == SSC_always_false); } } if (known_statically && UseTypeSpeculation) { ! // If we know the type check always succeed then we don't use the // profiling data at this bytecode. Don't lose it, feed it to the // type system as a speculative type. not_null_obj = record_profiled_receiver_for_speculation(not_null_obj); } else { const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); --- 2880,2890 ---- known_statically = (static_res == SSC_always_true || static_res == SSC_always_false); } } if (known_statically && UseTypeSpeculation) { ! // If we know the type check always succeeds then we don't use the // profiling data at this bytecode. Don't lose it, feed it to the // type system as a speculative type. not_null_obj = record_profiled_receiver_for_speculation(not_null_obj); } else { const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
src/share/vm/opto/graphKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File