-
Enhancement
-
Resolution: Unresolved
-
P4
-
repo-valhalla
static primitive class MyPrimitive41_2 {
int x;
@ForceInline
public MyPrimitive41_2() {
this.x = 42;
}
}
static primitive class MyPrimitive41_1 {
MyPrimitive41_2.ref val;
@ForceInline
public MyPrimitive41_1() {
this.val = new MyPrimitive41_2();
}
}
static MyPrimitive41_1 f1;
static MyPrimitive41_1 f2;
// Verify that redundant allocations are removed even when loop opts are not triggered
@Test
@IR(counts = {ALLOC_G, "= 2"})
public void test41() {
f1 = new MyPrimitive41_1();
f2 = new MyPrimitive41_1();
}
@Run(test = "test41")
public void test41_verifier() {
test41();
Asserts.assertEQ(f1, new MyPrimitive41_1());
Asserts.assertEQ(f1, f2);
}
int x;
@ForceInline
public MyPrimitive41_2() {
this.x = 42;
}
}
static primitive class MyPrimitive41_1 {
MyPrimitive41_2.ref val;
@ForceInline
public MyPrimitive41_1() {
this.val = new MyPrimitive41_2();
}
}
static MyPrimitive41_1 f1;
static MyPrimitive41_1 f2;
// Verify that redundant allocations are removed even when loop opts are not triggered
@Test
@IR(counts = {ALLOC_G, "= 2"})
public void test41() {
f1 = new MyPrimitive41_1();
f2 = new MyPrimitive41_1();
}
@Run(test = "test41")
public void test41_verifier() {
test41();
Asserts.assertEQ(f1, new MyPrimitive41_1());
Asserts.assertEQ(f1, f2);
}
- relates to
-
JDK-8332886 [lworld] Removal of redundant allocations in C2 does not always work
- Open