6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package runtime.valhalla.valuetypes.verifier;
24
25 import java.lang.invoke.*;
26 import jdk.experimental.value.*;
27
28 import static jdk.test.lib.Asserts.*;
29
30 /*
31 * @test VunboxErrorIndex
32 * @summary Exercise the verifier for vunbox bytecode with a non-value type CP index.
33 * @library /test/lib
34 * @build runtime.valhalla.valuetypes.verifier.ValueCapableClass
35 * @run main/othervm -Xint -verify -XX:+EnableMVT runtime.valhalla.valuetypes.verifier.VunboxErrorIndex
36 */
37 public class VunboxErrorIndex {
38
39 public static void main(String[] args) {
40 testCorrectBoxing();
41 testIncorrectBoxing();
42 }
43
44 public static void testCorrectBoxing() {
45 Class<?> vcc = ValueCapableClass.class;
46 Class<?> dvt = ValueType.forClass(vcc).valueClass();
47
48 MethodHandle newDvt = newDvtMh(dvt);
49 MethodHandle box = boxMh(dvt, vcc);
50 MethodHandle unbox = unboxMh(vcc, dvt);
51
52 ValueCapableClass newObject = ValueCapableClass.create(3, (short)7, (short)11);
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package runtime.valhalla.valuetypes.verifier;
24
25 import java.lang.invoke.*;
26 import jdk.incubator.mvt.ValueType;
27 import jdk.experimental.value.MethodHandleBuilder;
28
29 import static jdk.test.lib.Asserts.*;
30
31 /*
32 * @test VunboxErrorIndex
33 * @summary Exercise the verifier for vunbox bytecode with a non-value type CP index.
34 * @modules java.base/jdk.experimental.value
35 * jdk.incubator.mvt
36 * @library /test/lib
37 * @build runtime.valhalla.valuetypes.verifier.ValueCapableClass
38 * @run main/othervm -Xint -verify -XX:+EnableMVT runtime.valhalla.valuetypes.verifier.VunboxErrorIndex
39 */
40 public class VunboxErrorIndex {
41
42 public static void main(String[] args) {
43 testCorrectBoxing();
44 testIncorrectBoxing();
45 }
46
47 public static void testCorrectBoxing() {
48 Class<?> vcc = ValueCapableClass.class;
49 Class<?> dvt = ValueType.forClass(vcc).valueClass();
50
51 MethodHandle newDvt = newDvtMh(dvt);
52 MethodHandle box = boxMh(dvt, vcc);
53 MethodHandle unbox = unboxMh(vcc, dvt);
54
55 ValueCapableClass newObject = ValueCapableClass.create(3, (short)7, (short)11);
|