--- a/hotspot/src/share/vm/opto/graphKit.cpp Thu Feb 05 14:57:52 2015 -0800
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Thu Feb 12 13:55:54 2015 -0800
@@ -1986,6 +1986,11 @@
Deoptimization::trap_request_index(trap_request) < 0 &&
too_many_recompiles(reason)) {
// This BCI is causing too many recompilations.
+ if (C->log() != NULL) {
+ C->log()->elem("observe that='trap_action_change' reason='%s' from='%s' to='none'",
+ Deoptimization::trap_reason_name(reason),
+ Deoptimization::trap_action_name(action));
+ }
action = Deoptimization::Action_none;
trap_request = Deoptimization::make_trap_request(reason, action);
} else {
@@ -2760,7 +2765,7 @@
Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
// Make sure we haven't already deoptimized from this tactic.
- if (too_many_traps(reason))
+ if (too_many_traps(reason) || too_many_recompiles(reason))
return NULL;
// (No, this isn't a call, but it's enough like a virtual call
@@ -2782,8 +2787,7 @@
&exact_obj);
{ PreserveJVMState pjvms(this);
set_control(slow_ctl);
- uncommon_trap(reason,
- Deoptimization::Action_maybe_recompile);
+ uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
}
if (safe_for_replace) {
replace_in_map(not_null_obj, exact_obj);
@@ -2812,8 +2816,12 @@
if (type != NULL) {
Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
- if (!too_many_traps(null_reason) &&
- !too_many_traps(class_reason)) {
+ ciMethod* trap_method = (sfpt == NULL) ? method() : sfpt->jvms()->method();
+ int trap_bci = (sfpt == NULL) ? bci() : sfpt->jvms()->bci();
+
+ if (!too_many_traps(null_reason) && !too_many_recompiles(null_reason) &&
+ !C->too_many_traps(trap_method, trap_bci, class_reason) &&
+ !C->too_many_recompiles(trap_method, trap_bci, 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
@@ -2833,19 +2841,18 @@
GraphKit kit(sfpt->jvms());
PreserveJVMState pjvms(&kit);
kit.set_control(slow_ctl);
- kit.uncommon_trap(class_reason,
- Deoptimization::Action_maybe_recompile);
+ kit.uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
} else {
PreserveJVMState pjvms(this);
set_control(slow_ctl);
- uncommon_trap(class_reason,
- Deoptimization::Action_maybe_recompile);
+ uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
}
replace_in_map(not_null_obj, exact_obj);
obj = exact_obj;
}
} else {
- if (!too_many_traps(Deoptimization::Reason_null_assert)) {
+ if (!too_many_traps(Deoptimization::Reason_null_assert) &&
+ !too_many_recompiles(Deoptimization::Reason_null_assert)) {
Node* exact_obj = null_assert(obj);
replace_in_map(obj, exact_obj);
obj = exact_obj;