< prev index next >

test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -59,11 +59,10 @@
     }
 
     static {
         try {
             Class<?> clazz = TestNullableValueTypes.class;
-            ClassLoader loader = clazz.getClassLoader();
             MethodHandles.Lookup lookup = MethodHandles.lookup();
 
             MethodType test18_mt = MethodType.methodType(void.class, MyValue1.class.asNullableType());
             test18_mh1 = lookup.findStatic(clazz, "test18_target1", test18_mt);
             test18_mh2 = lookup.findStatic(clazz, "test18_target2", test18_mt);

@@ -879,6 +878,24 @@
             test34Val = null;
             test34(testValue1);
             Asserts.assertEquals(test34Val, testValue1);
         }
     }
+
+    // Same as test17 but with non-allocated value at withfield
+    @Test()
+    public Test17Value test35(boolean b) {
+        Test17Value vt1 = Test17Value.default;
+        if ((Object)vt1.valueField != null) {
+            throw new RuntimeException("Should be null");
+        }
+        MyValue1 vt3 = MyValue1.createWithFieldsInline(rI, rL);
+        Test17Value vt2 = new Test17Value(vt3);
+        return b ? vt1 : vt2;
+    }
+
+    @DontCompile
+    public void test35_verifier(boolean warmup) {
+        test35(true);
+        test35(false);
+    }
 }
< prev index next >