< prev index next >

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

Print this page

        

@@ -414,6 +414,57 @@
    @DontCompile
    public void test21_verifier(boolean warmup) {
        MyValue3 vt = test21();
        test21_vt.verify(vt);
    }
+    
+    // Test returning a non-flattened value type as fields
+    MyValue3.box test22_vt = MyValue3.create();
+    
+    @Test
+    public MyValue3 test22() {
+        return test22_vt;
+    }
+    
+    @DontCompile
+    public void test22_verifier(boolean warmup) {
+        MyValue3 vt = test22();
+        test22_vt.verify(vt);
+    }
+    
+    // Test calling a method that has circular register/stack dependencies when unpacking value type arguments
+    value class TestValue23 {
+        final double f1;
+        TestValue23(double val) {
+            f1 = val;
+        }
+    }
+
+    static double test23Callee(int i1, int i2, int i3, int i4, int i5, int i6,
+                               TestValue23 v1, TestValue23 v2, TestValue23 v3, TestValue23 v4, TestValue23 v5, TestValue23 v6, TestValue23 v7, TestValue23 v8,
+                               double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8) {
+        return i1 + i2 + i3 + i4 + i5 + i6 + v1.f1 + v2.f1 + v3.f1 + v4.f1 + v5.f1 + v6.f1 + v7.f1 + v8.f1 + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8;
+    }
+
+    @Test
+    public double test23(int i1, int i2, int i3, int i4, int i5, int i6,
+                         TestValue23 v1, TestValue23 v2, TestValue23 v3, TestValue23 v4, TestValue23 v5, TestValue23 v6, TestValue23 v7, TestValue23 v8,
+                         double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8) {
+        return test23Callee(i1, i2, i3, i4, i5, i6,
+                            v1, v2, v3, v4, v5, v6, v7, v8,
+                            d1, d2, d3, d4, d5, d6, d7, d8);
+    }
+    
+    @DontCompile
+    public void test23_verifier(boolean warmup) {
+        TestValue23 vt = new TestValue23(rI);
+        double res1 = test23(rI, rI, rI, rI, rI, rI,
+                            vt, vt, vt, vt, vt, vt, vt, vt,
+                            rI, rI, rI, rI, rI, rI, rI, rI);
+        double res2 = test23Callee(rI, rI, rI, rI, rI, rI,
+                                   vt, vt, vt, vt, vt, vt, vt, vt,
+                                   rI, rI, rI, rI, rI, rI, rI, rI);
+        double res3 = 6*rI + 8*rI + 8*rI;
+        Asserts.assertEQ(res1, res2);
+        Asserts.assertEQ(res2, res3);
+    }
 }
< prev index next >