8260637: Shenandoah: assert(_base == Tuple) failure during C2 compilation

Reviewed-by: chagedorn, kvn
This commit is contained in:
Roland Westrelin 2021-02-23 16:35:15 +00:00
parent 67762de627
commit 8a2f58907c
2 changed files with 33 additions and 6 deletions

View File

@ -5301,7 +5301,7 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
case Op_HasNegatives:
pinned = false;
}
if (n->is_CMove()) {
if (n->is_CMove() || n->is_ConstraintCast()) {
pinned = false;
}
if( pinned ) {

View File

@ -23,7 +23,7 @@
/**
* @test
* @bug 8237007
* @bug 8237007 8260637
* @summary Shenandoah: assert(_base == Tuple) failure during C2 compilation
* @requires vm.flavor == "server"
* @requires vm.gc.Shenandoah
@ -33,18 +33,19 @@
*/
public class LRBRightAfterMemBar {
private static Object field1;
private static A field1;
private static Object field2;
static volatile int barrier;
public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) {
test(true, true, new Object());
test(false, false, new Object());
test1(true, true, new Object());
test1(false, false, new Object());
test2(new Object(), 0, 10);
}
}
private static Object test(boolean flag, boolean flag2, Object o2) {
private static Object test1(boolean flag, boolean flag2, Object o2) {
for (int i = 0; i < 10; i++) {
barrier = 0x42; // Membar
if (o2 == null) { // hoisted out of loop
@ -61,4 +62,30 @@ public class LRBRightAfterMemBar {
return null;
}
private static int test2(Object o2, int start, int stop) {
A a1 = null;
A a2 = null;
int v = 0;
for (int i = start; i < stop; i++) {
a2 = new A();
a1 = new A();
a1.a = a2;
barrier = 0x42; // Membar
if (o2 == null) { // hoisted out of loop
}
A a3 = a1.a;
v = a3.f; // null check optimized out by EA but CastPP left in
}
a1.f = 0x42;
a2.f = 0x42;
return v;
}
static class A {
A a;
int f;
}
}