Skip to content

Commit 991f8e6

Browse files
committed
8360031: C2 compilation asserts in MemBarNode::remove
Reviewed-by: dlong, kvn, shade
1 parent 1b11bea commit 991f8e6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/hotspot/share/opto/escape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ bool ConnectionGraph::compute_escape() {
201201
if (!UseStoreStoreForCtor || n->req() > MemBarNode::Precedent) {
202202
storestore_worklist.append(n->as_MemBarStoreStore());
203203
}
204-
break;
204+
// If MemBarStoreStore has a precedent edge add it to the worklist (like MemBarRelease)
205205
case Op_MemBarRelease:
206206
if (n->req() > MemBarNode::Precedent) {
207207
record_for_optimizer(n);

src/hotspot/share/opto/memnode.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,10 +4229,7 @@ MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) {
42294229
}
42304230

42314231
void MemBarNode::remove(PhaseIterGVN *igvn) {
4232-
if (outcnt() != 2) {
4233-
assert(Opcode() == Op_Initialize, "Only seen when there are no use of init memory");
4234-
assert(outcnt() == 1, "Only control then");
4235-
}
4232+
assert(outcnt() > 0 && outcnt() <= 2, "Only one or two out edges allowed");
42364233
if (trailing_store() || trailing_load_store()) {
42374234
MemBarNode* leading = leading_membar();
42384235
if (leading != nullptr) {

test/hotspot/jtreg/compiler/c2/irTests/ConstructorBarriers.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ public VolatileVolatile(long i) {
123123
}
124124

125125
long l = 42;
126+
volatile Object global;
126127

127128
@DontInline
128-
public void consume(Object o) {}
129+
public void consume(Object o) {
130+
global = o;
131+
}
129132

130133
@Test
131134
@IR(counts = {IRNode.MEMBAR_STORESTORE, "1"})

0 commit comments

Comments
 (0)