< prev index next >

test/compiler/valhalla/valuetypes/ValueTypeTestBench.java

Print this page

        

@@ -2420,10 +2420,18 @@
             MethodHandle test85_mh2 = lookup.findStatic(ValueTypeTestBench.class, "test85_helper2", test85_mt2);
             test85_mh = MethodHandles.filterReturnValue(test85_mh2, test85_mh1);
 
             MethodType test86_mt = MethodType.fromMethodDescriptorString("(Qcompiler/valhalla/valuetypes/MyValue1;)I", ValueTypeTestBench.class.getClassLoader());
             test86_mh = lookup.findVirtual(ValueTypeTestBench.class, "test86_target", test86_mt);
+
+            MethodType test94_mt = MethodType.fromMethodDescriptorString("()Qcompiler/valhalla/valuetypes/MyValue3;", ValueTypeTestBench.class.getClassLoader());
+            MethodHandle test94_mh1 = lookup.findVirtual(ValueTypeTestBench.class, "test94_target1", test94_mt);
+            MethodHandle test94_mh2 = lookup.findVirtual(ValueTypeTestBench.class, "test94_target2", test94_mt);
+            MethodType test94_mt2 = MethodType.methodType(boolean.class);
+            MethodHandle test94_mh_test = lookup.findVirtual(ValueTypeTestBench.class, "test94_test", test94_mt2);
+            test94_mh = MethodHandles.guardWithTest(test94_mh_test, test94_mh1, test94_mh2);
+            
         } catch (NoSuchMethodException|IllegalAccessException e) {
             throw new RuntimeException("method handle lookup fails");
         }
     }
 

@@ -2603,10 +2611,46 @@
     public void test93_verifier(boolean warmup) throws Throwable {
         long result = test93();
         Asserts.assertEQ(result, 0L);
     }
 
+    // method handle combinators
+    final MyValue3 test94_vt1 = MyValue3.create();
+    @ForceInline
+    MyValue3 test94_target1() {
+        return test94_vt1;
+    }
+
+    final MyValue3 test94_vt2 = MyValue3.create();
+    @ForceInline
+    MyValue3 test94_target2() {
+        return test94_vt2;
+    }
+
+    boolean test94_bool = true;
+    @ForceInline
+    boolean test94_test() {
+        return test94_bool;
+    }
+
+    static final MethodHandle test94_mh;
+
+    // @Test(valid = ValueTypeReturnedAsFieldsOn, failOn = ALLOC + ALLOCA + STORE)
+    // @Test(valid = ValueTypeReturnedAsFieldsOff)
+    @Test()
+    MyValue3 test94() throws Throwable {
+        return (MyValue3)test94_mh.invokeExact(this);
+    }
+
+    @DontCompile
+    public void test94_verifier(boolean warmup) throws Throwable {
+        test94_bool = !test94_bool;
+        MyValue3 vt = test94();
+        //vt.verify(test94_bool ? test94_vt1 : test94_vt2);
+    }
+
+
     // ========== Test infrastructure ==========
 
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     private static final int ValueTypePassFieldsAsArgsOn = 0x1;
     private static final int ValueTypePassFieldsAsArgsOff = 0x2;

@@ -2677,11 +2721,11 @@
             System.out.println("WARNING: IR verification disabled! Running with -Xint, -Xcomp or release build?");
         }
     }
 
     public static void main(String[] args) throws Throwable {
-        //tests.values().removeIf(p -> !p.getName().equals("test85")); // Run single test
+        //tests.values().removeIf(p -> !p.getName().equals("test94")); // Run single test
         if (args.length == 0) {
             execute_vm("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-BackgroundCompilation",
                     "-XX:+PrintCompilation", "-XX:+PrintInlining", "-XX:+PrintIdeal", "-XX:+PrintOptoAssembly",
                     "-XX:CICompilerCount=1",
                     "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly,compiler.valhalla.valuetypes.ValueTypeTestBench::*",
< prev index next >