RFR: 8215473: [lworld] Support for substitutability checks in C2

Roland Westrelin rwestrel at redhat.com
Fri Jan 25 13:23:27 UTC 2019


Thanks for running more tests.

> I've run the valhalla tiers and found some failures with TestNewAcmp.java:

Right, I overlooked the tests at that are executed at the end. Patch
below fixes it.

Roland.

diff --git a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNewAcmp.java
@@ -1538,7 +1538,12 @@
             }
         }
 
-        for (int i = 0; i < 10_000; ++i) {
+        Method cmpAlwaysUnEqual3_m = getClass().getMethod("cmpAlwaysUnEqual3", Object.class);
+        Method cmpAlwaysUnEqual4_m = getClass().getMethod("cmpAlwaysUnEqual4", Object.class);
+        Method cmpSometimesEqual1_m = getClass().getMethod("cmpSometimesEqual1", Object.class);
+        Method cmpSometimesEqual2_m = getClass().getMethod("cmpSometimesEqual2", Object.class);
+        
+        for (int i = 0; i < 20_000; ++i) {
             Asserts.assertTrue(cmpAlwaysEqual1(args[1], args[1]));
             Asserts.assertFalse(cmpAlwaysEqual2(args[1], args[1]));
             Asserts.assertTrue(cmpAlwaysEqual3(args[1]));
@@ -1546,12 +1551,36 @@
 
             Asserts.assertFalse(cmpAlwaysUnEqual1(args[1], args[2]));
             Asserts.assertTrue(cmpAlwaysUnEqual2(args[1], args[2]));
-            Asserts.assertFalse(cmpAlwaysUnEqual3(args[3]));
-            Asserts.assertTrue(cmpAlwaysUnEqual4(args[3]));
+            boolean compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual3_m, false);
+            boolean res = cmpAlwaysUnEqual3(args[3]);
+            if (ACmpOnValues != 3) {
+                Asserts.assertFalse(res);
+            } else if (compiled) {
+                Asserts.assertTrue(res);
+            }
+            compiled = WHITE_BOX.isMethodCompiled(cmpAlwaysUnEqual4_m, false);
+            res = cmpAlwaysUnEqual4(args[3]);
+            if (ACmpOnValues != 3) {
+                Asserts.assertTrue(res);
+            } else if (compiled) {
+                Asserts.assertFalse(res);
+            }
 
             int idx = i % args.length;
-            Asserts.assertEQ(cmpSometimesEqual1(args[idx]), args[idx] == null || !args[idx].getClass().isValue());
-            Asserts.assertNE(cmpSometimesEqual2(args[idx]), args[idx] == null || !args[idx].getClass().isValue());
+            compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual1_m, false);
+            res = cmpSometimesEqual1(args[idx]);
+            if (ACmpOnValues != 3) {
+                Asserts.assertEQ(res, args[idx] == null || !args[idx].getClass().isValue());
+            } else if (compiled) {
+                Asserts.assertTrue(res);
+            }
+            compiled = WHITE_BOX.isMethodCompiled(cmpSometimesEqual2_m, false);
+            res = cmpSometimesEqual2(args[idx]);
+            if (ACmpOnValues != 3) {
+                Asserts.assertNE(res, args[idx] == null || !args[idx].getClass().isValue());
+            } else if (compiled) {
+                Asserts.assertFalse(res);
+            }
         }
     }
 



More information about the valhalla-dev mailing list