8235636: gc/shenandoah/compiler/TestUnsafeOffheapSwap.java fails after JDK-8226411

Reviewed-by: rkennke
This commit is contained in:
Roland Westrelin 2019-12-06 16:21:26 -05:00
parent 3f7ecfb5b1
commit 51bc2d15a4

View File

@ -668,6 +668,17 @@ bool ShenandoahBarrierC2Support::is_dominator_same_ctrl(Node* c, Node* d, Node*
if (m->is_Phi() && m->in(0)->is_Loop()) {
assert(phase->ctrl_or_self(m->in(LoopNode::EntryControl)) != c, "following loop entry should lead to new control");
} else {
if (m->is_Store() || m->is_LoadStore()) {
// Take anti-dependencies into account
Node* mem = m->in(MemNode::Memory);
for (DUIterator_Fast imax, i = mem->fast_outs(imax); i < imax; i++) {
Node* u = mem->fast_out(i);
if (u->is_Load() && phase->C->can_alias(m->adr_type(), phase->C->get_alias_index(u->adr_type())) &&
phase->ctrl_or_self(u) == c) {
wq.push(u);
}
}
}
for (uint i = 0; i < m->req(); i++) {
if (m->in(i) != NULL && phase->ctrl_or_self(m->in(i)) == c) {
wq.push(m->in(i));
@ -2753,6 +2764,20 @@ void MemoryGraphFixer::fix_mem(Node* ctrl, Node* new_ctrl, Node* mem, Node* mem_
MergeMemNode* mm = NULL;
int alias = _alias;
DEBUG_ONLY(if (trace) { tty->print("ZZZ raw mem is"); mem->dump(); });
// Process loads first to not miss an anti-dependency: if the memory
// edge of a store is updated before a load is processed then an
// anti-dependency may be missed.
for (DUIterator i = mem->outs(); mem->has_out(i); i++) {
Node* u = mem->out(i);
if (u->_idx < last && u->is_Load() && _phase->C->get_alias_index(u->adr_type()) == alias) {
Node* m = find_mem(_phase->get_ctrl(u), u);
if (m != mem) {
DEBUG_ONLY(if (trace) { tty->print("ZZZ setting memory of use"); u->dump(); });
_phase->igvn().replace_input_of(u, MemNode::Memory, m);
--i;
}
}
}
for (DUIterator i = mem->outs(); mem->has_out(i); i++) {
Node* u = mem->out(i);
if (u->_idx < last) {