mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8031320: Use Intel RTM instructions for locks
Use RTM for inflated locks and stack locks. Reviewed-by: iveresov, twisti, roland, dcubed
This commit is contained in:
parent
315e4838e9
commit
97a51c5c2a
46 changed files with 1251 additions and 87 deletions
|
@ -2439,6 +2439,7 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
|
|||
}
|
||||
}
|
||||
// Next, attempt to eliminate allocations
|
||||
_has_locks = false;
|
||||
progress = true;
|
||||
while (progress) {
|
||||
progress = false;
|
||||
|
@ -2457,11 +2458,13 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
|
|||
case Node::Class_Lock:
|
||||
case Node::Class_Unlock:
|
||||
assert(!n->as_AbstractLock()->is_eliminated(), "sanity");
|
||||
_has_locks = true;
|
||||
break;
|
||||
default:
|
||||
assert(n->Opcode() == Op_LoopLimit ||
|
||||
n->Opcode() == Op_Opaque1 ||
|
||||
n->Opcode() == Op_Opaque2, "unknown node type in macro list");
|
||||
n->Opcode() == Op_Opaque2 ||
|
||||
n->Opcode() == Op_Opaque3, "unknown node type in macro list");
|
||||
}
|
||||
assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
|
||||
progress = progress || success;
|
||||
|
@ -2502,6 +2505,30 @@ bool PhaseMacroExpand::expand_macro_nodes() {
|
|||
} else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
|
||||
_igvn.replace_node(n, n->in(1));
|
||||
success = true;
|
||||
#if INCLUDE_RTM_OPT
|
||||
} else if ((n->Opcode() == Op_Opaque3) && ((Opaque3Node*)n)->rtm_opt()) {
|
||||
assert(C->profile_rtm(), "should be used only in rtm deoptimization code");
|
||||
assert((n->outcnt() == 1) && n->unique_out()->is_Cmp(), "");
|
||||
Node* cmp = n->unique_out();
|
||||
#ifdef ASSERT
|
||||
// Validate graph.
|
||||
assert((cmp->outcnt() == 1) && cmp->unique_out()->is_Bool(), "");
|
||||
BoolNode* bol = cmp->unique_out()->as_Bool();
|
||||
assert((bol->outcnt() == 1) && bol->unique_out()->is_If() &&
|
||||
(bol->_test._test == BoolTest::ne), "");
|
||||
IfNode* ifn = bol->unique_out()->as_If();
|
||||
assert((ifn->outcnt() == 2) &&
|
||||
ifn->proj_out(1)->is_uncommon_trap_proj(Deoptimization::Reason_rtm_state_change), "");
|
||||
#endif
|
||||
Node* repl = n->in(1);
|
||||
if (!_has_locks) {
|
||||
// Remove RTM state check if there are no locks in the code.
|
||||
// Replace input to compare the same value.
|
||||
repl = (cmp->in(1) == n) ? cmp->in(2) : cmp->in(1);
|
||||
}
|
||||
_igvn.replace_node(n, repl);
|
||||
success = true;
|
||||
#endif
|
||||
}
|
||||
assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
|
||||
progress = progress || success;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue