Skip to content

Commit 0ec1175

Browse files
committed
8381830: [lworld] Merge TestScalarReplaceFlatFields into TestLWorld
Reviewed-by: thartmann, chagedorn
1 parent ccf09ed commit 0ec1175

2 files changed

Lines changed: 70 additions & 104 deletions

File tree

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestLWorld.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public static void main(String[] args) {
198198
}
199199

200200
// Helper methods
201+
@DontInline
202+
private static void call() {}
201203

202204
@NullRestricted
203205
private static final MyValue1 testValue1 = MyValue1.createWithFieldsInline(rI, rL);
@@ -5265,5 +5267,73 @@ static void testMismatchedStoresNotOnInlinesSlice() {
52655267
public void testMismatchedStoresNotOnInlinesSlice_verifier() {
52665268
testMismatchedStoresNotOnInlinesSlice();
52675269
}
5270+
5271+
static value class AtomicTwoBytes {
5272+
byte v1;
5273+
byte v2;
5274+
5275+
AtomicTwoBytes(int v1, int v2) {
5276+
this.v1 = (byte) v1;
5277+
this.v2 = (byte) v2;
5278+
}
5279+
}
5280+
5281+
// TODO 8376254: C1 bails out if the type of the nullable flat field is uninitialized
5282+
static final AtomicTwoBytes LOAD_ATOMIC_TWO_BYTES = new AtomicTwoBytes(0, 0);
5283+
5284+
static value class AtomicTwoBytesOneShort {
5285+
AtomicTwoBytes v;
5286+
short s;
5287+
5288+
AtomicTwoBytesOneShort(AtomicTwoBytes v, int s) {
5289+
this.v = v;
5290+
this.s = (short) s;
5291+
}
5292+
}
5293+
5294+
static class AtomicTwoBytesOneShortHolder {
5295+
@NullRestricted
5296+
AtomicTwoBytesOneShort v1;
5297+
AtomicTwoBytesOneShort v2;
5298+
5299+
AtomicTwoBytesOneShortHolder(AtomicTwoBytesOneShort v1, AtomicTwoBytesOneShort v2) {
5300+
this.v1 = v1;
5301+
this.v2 = v2;
5302+
super();
5303+
}
5304+
}
5305+
5306+
@Test
5307+
@IR(failOn = IRNode.ALLOC)
5308+
private static int testScalarReplaceObject(int v) {
5309+
AtomicTwoBytesOneShort v1 = new AtomicTwoBytesOneShort(null, v);
5310+
AtomicTwoBytesOneShort v2 = new AtomicTwoBytesOneShort(new AtomicTwoBytes(v, v), v);
5311+
AtomicTwoBytesOneShortHolder h = new AtomicTwoBytesOneShortHolder(v1, v2);
5312+
call();
5313+
return h.v1.s;
5314+
}
5315+
5316+
@Run(test = "testScalarReplaceObject")
5317+
public void runScalarReplaceObject() {
5318+
int v = (short) rI;
5319+
Asserts.assertEQ(v, testScalarReplaceObject(v));
5320+
}
5321+
5322+
@Test
5323+
@IR(failOn = IRNode.ALLOC)
5324+
private static int testScalarReplaceArray(int v1, int v2) {
5325+
AtomicTwoBytesOneShort[] array = new AtomicTwoBytesOneShort[2];
5326+
array[0] = new AtomicTwoBytesOneShort(null, v1);
5327+
array[1] = new AtomicTwoBytesOneShort(new AtomicTwoBytes(v1, v2), v2);
5328+
call();
5329+
return array[1].v.v1;
5330+
}
5331+
5332+
@Run(test = "testScalarReplaceArray")
5333+
public void runScalarReplaceArray() {
5334+
int v1 = (byte) rI;
5335+
int v2 = (int) rL;
5336+
Asserts.assertEQ(v1, testScalarReplaceArray(v1, v2));
5337+
}
52685338
}
52695339

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestScalarReplaceFlatFields.java

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)