8068915: uncommon trap w/ Reason_speculate_class_check causes performance regression due to continuous deoptimizations
Reviewed-by: kvn, roland, jrose
This commit is contained in:
parent
7227e9ba53
commit
efd80ec6af
@ -1989,6 +1989,11 @@ void GraphKit::uncommon_trap(int trap_request,
|
|||||||
Deoptimization::trap_request_index(trap_request) < 0 &&
|
Deoptimization::trap_request_index(trap_request) < 0 &&
|
||||||
too_many_recompiles(reason)) {
|
too_many_recompiles(reason)) {
|
||||||
// This BCI is causing too many recompilations.
|
// 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;
|
action = Deoptimization::Action_none;
|
||||||
trap_request = Deoptimization::make_trap_request(reason, action);
|
trap_request = Deoptimization::make_trap_request(reason, action);
|
||||||
} else {
|
} else {
|
||||||
@ -2763,7 +2768,7 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
|
|||||||
Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
|
Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
|
||||||
|
|
||||||
// Make sure we haven't already deoptimized from this tactic.
|
// 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;
|
return NULL;
|
||||||
|
|
||||||
// (No, this isn't a call, but it's enough like a virtual call
|
// (No, this isn't a call, but it's enough like a virtual call
|
||||||
@ -2785,8 +2790,7 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
|
|||||||
&exact_obj);
|
&exact_obj);
|
||||||
{ PreserveJVMState pjvms(this);
|
{ PreserveJVMState pjvms(this);
|
||||||
set_control(slow_ctl);
|
set_control(slow_ctl);
|
||||||
uncommon_trap(reason,
|
uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
|
||||||
Deoptimization::Action_maybe_recompile);
|
|
||||||
}
|
}
|
||||||
if (safe_for_replace) {
|
if (safe_for_replace) {
|
||||||
replace_in_map(not_null_obj, exact_obj);
|
replace_in_map(not_null_obj, exact_obj);
|
||||||
@ -2815,8 +2819,8 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
|
|||||||
if (type != NULL) {
|
if (type != NULL) {
|
||||||
Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
|
Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
|
||||||
Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
|
Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
|
||||||
if (!too_many_traps(null_reason) &&
|
if (!too_many_traps(null_reason) && !too_many_recompiles(null_reason) &&
|
||||||
!too_many_traps(class_reason)) {
|
!too_many_traps(class_reason) && !too_many_recompiles(class_reason)) {
|
||||||
Node* not_null_obj = NULL;
|
Node* not_null_obj = NULL;
|
||||||
// not_null is true if we know the object is not null and
|
// not_null is true if we know the object is not null and
|
||||||
// there's no need for a null check
|
// there's no need for a null check
|
||||||
@ -2836,19 +2840,18 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
|
|||||||
GraphKit kit(sfpt->jvms());
|
GraphKit kit(sfpt->jvms());
|
||||||
PreserveJVMState pjvms(&kit);
|
PreserveJVMState pjvms(&kit);
|
||||||
kit.set_control(slow_ctl);
|
kit.set_control(slow_ctl);
|
||||||
kit.uncommon_trap(class_reason,
|
kit.uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
|
||||||
Deoptimization::Action_maybe_recompile);
|
|
||||||
} else {
|
} else {
|
||||||
PreserveJVMState pjvms(this);
|
PreserveJVMState pjvms(this);
|
||||||
set_control(slow_ctl);
|
set_control(slow_ctl);
|
||||||
uncommon_trap(class_reason,
|
uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
|
||||||
Deoptimization::Action_maybe_recompile);
|
|
||||||
}
|
}
|
||||||
replace_in_map(not_null_obj, exact_obj);
|
replace_in_map(not_null_obj, exact_obj);
|
||||||
obj = exact_obj;
|
obj = exact_obj;
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
Node* exact_obj = null_assert(obj);
|
||||||
replace_in_map(obj, exact_obj);
|
replace_in_map(obj, exact_obj);
|
||||||
obj = exact_obj;
|
obj = exact_obj;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user