--- old/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java 2018-03-06 15:23:50.000000000 -0800 +++ new/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java 2018-03-06 15:23:49.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,10 @@ /* * @test - * @run testng/othervm -Diters=10 -Xint VarHandleTestAccessLong + * @compile -XDenableValueTypes Value.java + * @run testng/othervm -Xverify:none -Diters=10 -Xint VarHandleTestAccessLong + */ +/* Disabled temporarily for lworld * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong * @run testng/othervm -Diters=20000 VarHandleTestAccessLong * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessLong @@ -60,6 +63,8 @@ VarHandle vhArray; + VarHandle vhValueTypeField; + @BeforeClass public void setup() throws Exception { vhFinalField = MethodHandles.lookup().findVarHandle( @@ -75,6 +80,9 @@ VarHandleTestAccessLong.class, "static_v", long.class); vhArray = MethodHandles.arrayElementVarHandle(long[].class); + + vhValueTypeField = MethodHandles.lookup().findVarHandle( + Value.class, "long_v", long.class); } @@ -210,6 +218,11 @@ cases.add(new VarHandleAccessTestCase("Array index out of bounds", vhArray, VarHandleTestAccessLong::testArrayIndexOutOfBounds, false)); + cases.add(new VarHandleAccessTestCase("Value type field", + vhValueTypeField, vh -> testValueTypeField(Value.VT, vh))); + cases.add(new VarHandleAccessTestCase("Value type field unsupported", + vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh), + false)); // Work around issue with jtreg summary reporting which truncates // the String result of Object.toString to 30 characters, hence @@ -277,6 +290,19 @@ } + static void testValueTypeField(Value recv, VarHandle vh) { + // Plain + { + long x = (long) vh.get(recv); + assertEquals(x, 0x0123456789ABCDEFL, "get long value"); + } + } + + static void testValueTypeFieldUnsupported(Value recv, VarHandle vh) { + checkUOE(() -> { + vh.set(recv, 0xCAFEBABECAFEBABEL); + }); + } static void testStaticFinalField(VarHandle vh) { // Plain