1.1 --- a/src/share/vm/runtime/deoptimization.cpp Mon Jan 27 13:14:53 2014 +0100 1.2 +++ b/src/share/vm/runtime/deoptimization.cpp Tue Feb 25 18:16:24 2014 +0100 1.3 @@ -1486,6 +1486,7 @@ 1.4 bool maybe_prior_trap = false; 1.5 bool maybe_prior_recompile = false; 1.6 pdata = query_update_method_data(trap_mdo, trap_bci, reason, 1.7 + nm->method(), 1.8 //outputs: 1.9 this_trap_count, 1.10 maybe_prior_trap, 1.11 @@ -1531,7 +1532,7 @@ 1.12 } 1.13 1.14 // Go back to the compiler if there are too many traps in this method. 1.15 - if (this_trap_count >= (uint)PerMethodTrapLimit) { 1.16 + if (this_trap_count >= per_method_trap_limit(reason)) { 1.17 // If there are too many traps in this method, force a recompile. 1.18 // This will allow the compiler to see the limit overflow, and 1.19 // take corrective action, if possible. 1.20 @@ -1619,6 +1620,7 @@ 1.21 Deoptimization::query_update_method_data(MethodData* trap_mdo, 1.22 int trap_bci, 1.23 Deoptimization::DeoptReason reason, 1.24 + Method* compiled_method, 1.25 //outputs: 1.26 uint& ret_this_trap_count, 1.27 bool& ret_maybe_prior_trap, 1.28 @@ -1642,9 +1644,16 @@ 1.29 // Find the profile data for this BCI. If there isn't one, 1.30 // try to allocate one from the MDO's set of spares. 1.31 // This will let us detect a repeated trap at this point. 1.32 - pdata = trap_mdo->allocate_bci_to_data(trap_bci); 1.33 + pdata = trap_mdo->allocate_bci_to_data(trap_bci, reason_is_speculate(reason) ? compiled_method : NULL); 1.34 1.35 if (pdata != NULL) { 1.36 + if (reason_is_speculate(reason) && !pdata->is_SpeculativeTrapData()) { 1.37 + if (LogCompilation && xtty != NULL) { 1.38 + ttyLocker ttyl; 1.39 + // no more room for speculative traps in this MDO 1.40 + xtty->elem("speculative_traps_oom"); 1.41 + } 1.42 + } 1.43 // Query the trap state of this profile datum. 1.44 int tstate0 = pdata->trap_state(); 1.45 if (!trap_state_has_reason(tstate0, per_bc_reason)) 1.46 @@ -1682,8 +1691,10 @@ 1.47 uint ignore_this_trap_count; 1.48 bool ignore_maybe_prior_trap; 1.49 bool ignore_maybe_prior_recompile; 1.50 + assert(!reason_is_speculate(reason), "reason speculate only used by compiler"); 1.51 query_update_method_data(trap_mdo, trap_bci, 1.52 (DeoptReason)reason, 1.53 + NULL, 1.54 ignore_this_trap_count, 1.55 ignore_maybe_prior_trap, 1.56 ignore_maybe_prior_recompile); 1.57 @@ -1811,7 +1822,8 @@ 1.58 "div0_check", 1.59 "age", 1.60 "predicate", 1.61 - "loop_limit_check" 1.62 + "loop_limit_check", 1.63 + "speculate_class_check" 1.64 }; 1.65 const char* Deoptimization::_trap_action_name[Action_LIMIT] = { 1.66 // Note: Keep this in sync. with enum DeoptAction.