Skip to content

Commit ad40a92

Browse files
committed
Updates from review
Signed-off-by: Theresa Mammarella <[email protected]>
1 parent 2320723 commit ad40a92

File tree

1 file changed

+79
-37
lines changed

1 file changed

+79
-37
lines changed

test/functional/Valhalla/src_lw5/org/openj9/test/lworld/ValueTypeTests.java

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ static value class FlatUnAlignedObjectBackfill2 {
12531253
}
12541254

12551255
@Test(priority=3, invocationCount=2)
1256-
static public void testLayoutsWithPrimitives() throws Throwable {
1256+
static public void testLayoutsWithNullRestrictedFields() throws Throwable {
12571257
SingleBackfill! singleBackfillInstance = new SingleBackfill(defaultLong, defaultObject, defaultInt);
12581258
assertEquals(singleBackfillInstance.i, defaultInt);
12591259
assertEquals(singleBackfillInstance.o, defaultObject);
@@ -1784,6 +1784,42 @@ static public void testIdentityObjectOnRef() throws Throwable {
17841784
assertTrue(IdentityObject.class.isIdentity());
17851785
}
17861786

1787+
@Test(priority=1)
1788+
static public void testIsValueClassOnValueType() throws Throwable {
1789+
assertTrue(ValueLong.class.isValue());
1790+
assertFalse(ValueLong.class.isIdentity());
1791+
}
1792+
1793+
private interface TestInterface {}
1794+
1795+
@Test(priority=1)
1796+
static public void testIsValueClassOnInterface() throws Throwable {
1797+
assertFalse(TestInterface.class.isValue());
1798+
assertFalse(TestInterface.class.isIdentity());
1799+
}
1800+
1801+
@Test(priority=1)
1802+
static public void testIsValueClassOnAbstractClass() throws Throwable {
1803+
assertFalse(HeavyAbstractClass.class.isValue());
1804+
assertTrue(HeavyAbstractClass.class.isIdentity());
1805+
}
1806+
1807+
@Test(priority=1)
1808+
static public void testIsValueOnValueArrayClass() throws Throwable {
1809+
assertFalse(ValueLong.class.arrayType().isValue());
1810+
assertTrue(ValueLong.class.arrayType().isIdentity());
1811+
}
1812+
1813+
static class TestIsValueOnRefArrayClass {
1814+
long longField;
1815+
}
1816+
1817+
@Test(priority=1)
1818+
static public void testIsValueOnRefArrayClass() throws Throwable {
1819+
assertFalse(TestIsValueOnRefArrayClass.class.arrayType().isValue());
1820+
assertTrue(TestIsValueOnRefArrayClass.class.arrayType().isIdentity());
1821+
}
1822+
17871823
static value class ValueIntPoint2D {
17881824
final ValueInt x, y;
17891825

@@ -1826,6 +1862,17 @@ static value class ClassWithOnlyStaticFieldsWithSingleAlignment {
18261862
static Triangle2D! tri2;
18271863
}
18281864

1865+
/* Prioritize before static fields are set by testStaticFieldsWithSingleAlignment */
1866+
@Test(priority=3, invocationCount=2)
1867+
static public void testStaticFieldsWithSingleAlignmenDefaultValues() throws Throwable {
1868+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.tri);
1869+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.point);
1870+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.line);
1871+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.i);
1872+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.f);
1873+
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.tri2);
1874+
}
1875+
18291876
@Test(priority=4)
18301877
static public void testStaticFieldsWithSingleAlignment() throws Throwable {
18311878
ClassWithOnlyStaticFieldsWithSingleAlignment.tri = new Triangle2D(defaultTrianglePositions);
@@ -1843,16 +1890,6 @@ static public void testStaticFieldsWithSingleAlignment() throws Throwable {
18431890
ClassWithOnlyStaticFieldsWithSingleAlignment.tri2.checkEqualTriangle2D(defaultTrianglePositions);
18441891
}
18451892

1846-
@Test(priority=5, invocationCount=2)
1847-
static public void testStaticFieldsWithSingleAlignmenDefaultValues() throws Throwable {
1848-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.tri);
1849-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.point);
1850-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.line);
1851-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.i);
1852-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.f);
1853-
assertNotNull(ClassWithOnlyStaticFieldsWithSingleAlignment.tri2);
1854-
}
1855-
18561893
static value class ClassWithOnlyStaticFieldsWithLongAlignment {
18571894
static Point2D! point;
18581895
static FlattenedLine2D! line;
@@ -1863,6 +1900,18 @@ static value class ClassWithOnlyStaticFieldsWithLongAlignment {
18631900
static Triangle2D! tri;
18641901
}
18651902

1903+
/* Prioritize before static fields are set by testStaticFieldsWithLongAlignment */
1904+
@Test(priority=3, invocationCount=2)
1905+
static public void testStaticFieldsWithLongAlignmenDefaultValues() throws Throwable {
1906+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.point);
1907+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.line);
1908+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.o);
1909+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.l);
1910+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.d);
1911+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.i);
1912+
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.tri);
1913+
}
1914+
18661915
@Test(priority=4)
18671916
static public void testStaticFieldsWithLongAlignment() throws Throwable {
18681917
ClassWithOnlyStaticFieldsWithLongAlignment.point = new Point2D(defaultPointPositions1);
@@ -1882,17 +1931,6 @@ static public void testStaticFieldsWithLongAlignment() throws Throwable {
18821931
ClassWithOnlyStaticFieldsWithLongAlignment.tri.checkEqualTriangle2D(defaultTrianglePositions);
18831932
}
18841933

1885-
@Test(priority=5, invocationCount=2)
1886-
static public void testStaticFieldsWithLongAlignmenDefaultValues() throws Throwable {
1887-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.point);
1888-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.line);
1889-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.o);
1890-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.l);
1891-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.d);
1892-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.i);
1893-
assertNotNull(ClassWithOnlyStaticFieldsWithLongAlignment.tri);
1894-
}
1895-
18961934
static value class ClassWithOnlyStaticFieldsWithObjectAlignment {
18971935
static Triangle2D! tri;
18981936
static Point2D! point;
@@ -1903,6 +1941,18 @@ static value class ClassWithOnlyStaticFieldsWithObjectAlignment {
19031941
static Triangle2D! tri2;
19041942
}
19051943

1944+
/* Prioritize before static fields are set by testStaticFieldsWithObjectAlignment */
1945+
@Test(priority=3, invocationCount=2)
1946+
static public void testStaticFieldsWithObjectAlignmentDefaultValues() throws Throwable {
1947+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.tri);
1948+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.point);
1949+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.line);
1950+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.o);
1951+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.i);
1952+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.f);
1953+
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.tri2);
1954+
}
1955+
19061956
@Test(priority=4)
19071957
static public void testStaticFieldsWithObjectAlignment() throws Throwable {
19081958
ClassWithOnlyStaticFieldsWithObjectAlignment.tri = new Triangle2D(defaultTrianglePositions);
@@ -1922,17 +1972,6 @@ static public void testStaticFieldsWithObjectAlignment() throws Throwable {
19221972
ClassWithOnlyStaticFieldsWithObjectAlignment.tri2.checkEqualTriangle2D(defaultTrianglePositions);
19231973
}
19241974

1925-
@Test(priority=5, invocationCount=2)
1926-
static public void testStaticFieldsWithObjectAlignmentDefaultValues() throws Throwable {
1927-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.tri);
1928-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.point);
1929-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.line);
1930-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.o);
1931-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.i);
1932-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.f);
1933-
assertNotNull(ClassWithOnlyStaticFieldsWithObjectAlignment.tri2);
1934-
}
1935-
19361975
//*******************************************************************************
19371976
// GC tests
19381977
//*******************************************************************************
@@ -2034,7 +2073,7 @@ static public void testGCFlattenedMegaObjectArray() throws Throwable {
20342073
/*
20352074
* Create large number of value types and instantiate them
20362075
*
2037-
* value Point2D# {
2076+
* value Point2D {
20382077
* int x;
20392078
* int y;
20402079
* }
@@ -2551,7 +2590,7 @@ static public void testValueTypeHasSynchMethods() throws Throwable {
25512590
* Create a value type and read the fields before
25522591
* they are set. The test should Verify that the
25532592
* flattenable fields are set to the default values.
2554-
* NULL should never be observed for Qtypes.
2593+
* NULL should never be observed for nullrestricted fields.
25552594
*/
25562595
@Test(priority=4)
25572596
static public void testDefaultValues() throws Throwable {
@@ -2589,6 +2628,9 @@ static public void testDefaultValues() throws Throwable {
25892628
/*
25902629
* Create Array Objects with Point Class without initialization
25912630
* The array should be set to a Default Value.
2631+
*
2632+
* TODO not sure if this array needs to be nullrestricted, currently the ri
2633+
* is not up to date on this. Revisit this later.
25922634
*/
25932635
@Test(priority=4, invocationCount=2)
25942636
static public void testDefaultValueInPointArray() throws Throwable {
@@ -2812,8 +2854,8 @@ static public void testCyclicalStaticFieldDefaultValues3() throws Throwable {
28122854
static public void testCheckCastValueTypeOnInvalidClass() throws Throwable {
28132855
String fields[] = {"longField:J"};
28142856
Class valueClass = ValueTypeGenerator.generateValueClass("TestCheckCastOnInvalidClass", fields);
2815-
MethodHandle checkCastOnInvalidLtype = lookup.findStatic(valueClass, "testCheckCastOnInvalidClass", MethodType.methodType(Object.class));
2816-
checkCastOnInvalidLtype.invoke();
2857+
MethodHandle checkCastOnInvalidClass = lookup.findStatic(valueClass, "testCheckCastOnInvalidClass", MethodType.methodType(Object.class));
2858+
checkCastOnInvalidClass.invoke();
28172859
}
28182860

28192861
/*

0 commit comments

Comments
 (0)