< prev index next >

test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template

Print this page
rev 55900 : 8207257: Add VarHandle access test for value type declared in ref type
Reviewed-by: tbd

*** 19,28 **** --- 19,30 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ + #warn + #if[Value] /* * @test * @run testng/othervm -Diters=10 -XX:+EnableValhalla -Xint VarHandleTestAccess$Type$ * @run testng/othervm -Diters=20000 -XX:+EnableValhalla -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$
*** 76,88 **** VarHandle vhStaticFinalField; VarHandle vhArray; ! #if[String] VarHandle vhArrayObject; ! #end[String] #if[Value] VarHandle vhValueTypeField; #end[Value] VarHandle[] allocate(boolean same) { --- 78,90 ---- VarHandle vhStaticFinalField; VarHandle vhArray; ! #if[Class]] VarHandle vhArrayObject; ! #end[Class]] #if[Value] VarHandle vhValueTypeField; #end[Value] VarHandle[] allocate(boolean same) {
*** 137,149 **** vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestAccess$Type$.class, "static_v", $type$.class); vhArray = MethodHandles.arrayElementVarHandle($type$[].class); ! #if[String] vhArrayObject = MethodHandles.arrayElementVarHandle(Object[].class); ! #end[String] #if[Value] vhValueTypeField = MethodHandles.lookup().findVarHandle( Value.class, "$type$_v", $type$.class); #end[Value] --- 139,151 ---- vhStaticField = MethodHandles.lookup().findStaticVarHandle( VarHandleTestAccess$Type$.class, "static_v", $type$.class); vhArray = MethodHandles.arrayElementVarHandle($type$[].class); ! #if[Class]] vhArrayObject = MethodHandles.arrayElementVarHandle(Object[].class); ! #end[Class]] #if[Value] vhValueTypeField = MethodHandles.lookup().findVarHandle( Value.class, "$type$_v", $type$.class); #end[Value]
*** 326,350 **** vhStaticField, VarHandleTestAccess$Type$::testStaticFieldUnsupported, false)); cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestAccess$Type$::testArray)); ! #if[String] cases.add(new VarHandleAccessTestCase("Array Object[]", vhArrayObject, VarHandleTestAccess$Type$::testArray)); ! #end[String] cases.add(new VarHandleAccessTestCase("Array unsupported", vhArray, VarHandleTestAccess$Type$::testArrayUnsupported, false)); cases.add(new VarHandleAccessTestCase("Array index out of bounds", vhArray, VarHandleTestAccess$Type$::testArrayIndexOutOfBounds, false)); ! #if[String] cases.add(new VarHandleAccessTestCase("Array store exception", vhArrayObject, VarHandleTestAccess$Type$::testArrayStoreException, false)); ! #end[String] #if[Value] cases.add(new VarHandleAccessTestCase("Value type field", vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh))); cases.add(new VarHandleAccessTestCase("Value type field unsupported", vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh), --- 328,352 ---- vhStaticField, VarHandleTestAccess$Type$::testStaticFieldUnsupported, false)); cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestAccess$Type$::testArray)); ! #if[Class]] cases.add(new VarHandleAccessTestCase("Array Object[]", vhArrayObject, VarHandleTestAccess$Type$::testArray)); ! #end[Class]] cases.add(new VarHandleAccessTestCase("Array unsupported", vhArray, VarHandleTestAccess$Type$::testArrayUnsupported, false)); cases.add(new VarHandleAccessTestCase("Array index out of bounds", vhArray, VarHandleTestAccess$Type$::testArrayIndexOutOfBounds, false)); ! #if[Class]] cases.add(new VarHandleAccessTestCase("Array store exception", vhArrayObject, VarHandleTestAccess$Type$::testArrayStoreException, false)); ! #end[Class]] #if[Value] cases.add(new VarHandleAccessTestCase("Value type field", vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh))); cases.add(new VarHandleAccessTestCase("Value type field unsupported", vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
*** 1944,1954 **** }); #end[Bitwise] } } ! #if[String] static void testArrayStoreException(VarHandle vh) throws Throwable { Object[] array = new $type$[10]; Arrays.fill(array, $value1$); Object value = new Object(); --- 1946,1956 ---- }); #end[Bitwise] } } ! #if[Class]] static void testArrayStoreException(VarHandle vh) throws Throwable { Object[] array = new $type$[10]; Arrays.fill(array, $value1$); Object value = new Object();
*** 2025,2032 **** // GetAndSetRelease checkASE(() -> { // receiver reference class $type$ x = ($type$) vh.getAndSetRelease(array, 0, value); }); } ! #end[String] } --- 2027,2034 ---- // GetAndSetRelease checkASE(() -> { // receiver reference class $type$ x = ($type$) vh.getAndSetRelease(array, 0, value); }); } ! #end[Class]] }
< prev index next >