提交 54cab266 编写于 作者: V vlivanov

8068915: uncommon trap w/ Reason_speculate_class_check causes performance...

8068915: uncommon trap w/ Reason_speculate_class_check causes performance regression due to continuous deoptimizations
Reviewed-by: kvn, roland, jrose
上级 258baabe
...@@ -1980,6 +1980,11 @@ void GraphKit::uncommon_trap(int trap_request, ...@@ -1980,6 +1980,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 {
...@@ -2742,7 +2747,7 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj, ...@@ -2742,7 +2747,7 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
Deoptimization::DeoptReason reason = spec_klass == NULL ? Deoptimization::Reason_class_check : Deoptimization::Reason_speculate_class_check; 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. // 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
...@@ -2764,8 +2769,7 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj, ...@@ -2764,8 +2769,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);
...@@ -2793,8 +2797,8 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj, ...@@ -2793,8 +2797,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_null_check; Deoptimization::DeoptReason null_reason = Deoptimization::Reason_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
...@@ -2813,14 +2817,14 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj, ...@@ -2813,14 +2817,14 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
{ {
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册