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

src/share/vm/runtime/deoptimization.cpp

Print this page
rev 5771 : 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:
rev 5772 : imported patch chris

*** 1484,1493 **** --- 1484,1494 ---- assert(trap_mdo == get_method_data(thread, trap_method, false), "sanity"); uint this_trap_count = 0; bool maybe_prior_trap = false; bool maybe_prior_recompile = false; pdata = query_update_method_data(trap_mdo, trap_bci, reason, + nm->method(), //outputs: this_trap_count, maybe_prior_trap, maybe_prior_recompile); // Because the interpreter also counts null, div0, range, and class
*** 1529,1539 **** // (Note that PerMethodRecompilationCutoff is enforced elsewhere.) make_not_entrant = true; } // Go back to the compiler if there are too many traps in this method. ! if (this_trap_count >= (uint)PerMethodTrapLimit) { // If there are too many traps in this method, force a recompile. // This will allow the compiler to see the limit overflow, and // take corrective action, if possible. // (This condition is an unlikely backstop only, because the // PerBytecodeTrapLimit is more likely to take effect first, --- 1530,1540 ---- // (Note that PerMethodRecompilationCutoff is enforced elsewhere.) make_not_entrant = true; } // Go back to the compiler if there are too many traps in this method. ! if (this_trap_count >= per_method_trap_limit(reason)) { // If there are too many traps in this method, force a recompile. // This will allow the compiler to see the limit overflow, and // take corrective action, if possible. // (This condition is an unlikely backstop only, because the // PerBytecodeTrapLimit is more likely to take effect first,
*** 1617,1626 **** --- 1618,1628 ---- ProfileData* Deoptimization::query_update_method_data(MethodData* trap_mdo, int trap_bci, Deoptimization::DeoptReason reason, + Method* compiled_method, //outputs: uint& ret_this_trap_count, bool& ret_maybe_prior_trap, bool& ret_maybe_prior_recompile) { uint prior_trap_count = trap_mdo->trap_count(reason);
*** 1640,1652 **** DeoptReason per_bc_reason = reason_recorded_per_bytecode_if_any(reason); if (per_bc_reason != Reason_none) { // Find the profile data for this BCI. If there isn't one, // try to allocate one from the MDO's set of spares. // This will let us detect a repeated trap at this point. ! pdata = trap_mdo->allocate_bci_to_data(trap_bci); if (pdata != NULL) { // Query the trap state of this profile datum. int tstate0 = pdata->trap_state(); if (!trap_state_has_reason(tstate0, per_bc_reason)) maybe_prior_trap = false; if (!trap_state_is_recompiled(tstate0)) --- 1642,1661 ---- DeoptReason per_bc_reason = reason_recorded_per_bytecode_if_any(reason); if (per_bc_reason != Reason_none) { // Find the profile data for this BCI. If there isn't one, // try to allocate one from the MDO's set of spares. // This will let us detect a repeated trap at this point. ! pdata = trap_mdo->allocate_bci_to_data(trap_bci, reason_is_speculate(reason) ? compiled_method : NULL); if (pdata != NULL) { + if (reason_is_speculate(reason) && !pdata->is_SpeculativeTrapData()) { + if (LogCompilation && xtty != NULL) { + ttyLocker ttyl; + // no more room for speculative traps in this MDO + xtty->elem("speculative_traps_oom"); + } + } // Query the trap state of this profile datum. int tstate0 = pdata->trap_state(); if (!trap_state_has_reason(tstate0, per_bc_reason)) maybe_prior_trap = false; if (!trap_state_is_recompiled(tstate0))
*** 1680,1691 **** --- 1689,1702 ---- ResourceMark rm; // Ignored outputs: uint ignore_this_trap_count; bool ignore_maybe_prior_trap; bool ignore_maybe_prior_recompile; + assert(!reason_is_speculate(reason), "reason speculate only used by compiler"); query_update_method_data(trap_mdo, trap_bci, (DeoptReason)reason, + NULL, ignore_this_trap_count, ignore_maybe_prior_trap, ignore_maybe_prior_recompile); }
*** 1809,1819 **** "unhandled", "constraint", "div0_check", "age", "predicate", ! "loop_limit_check" }; const char* Deoptimization::_trap_action_name[Action_LIMIT] = { // Note: Keep this in sync. with enum DeoptAction. "none", "maybe_recompile", --- 1820,1831 ---- "unhandled", "constraint", "div0_check", "age", "predicate", ! "loop_limit_check", ! "speculate_class_check" }; const char* Deoptimization::_trap_action_name[Action_LIMIT] = { // Note: Keep this in sync. with enum DeoptAction. "none", "maybe_recompile",
src/share/vm/runtime/deoptimization.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File