diff test/compiler/types/TypeSpeculation.java @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 45b0159f30f2
children
line wrap: on
line diff
--- a/test/compiler/types/TypeSpeculation.java	Thu Oct 16 10:21:29 2014 +0200
+++ b/test/compiler/types/TypeSpeculation.java	Wed Oct 15 16:02:50 2014 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 8024070
  * @summary Test that type speculation doesn't cause incorrect execution
- * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 TypeSpeculation
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation TypeSpeculation
  *
  */
 
@@ -398,6 +398,133 @@
         return true;
     }
 
+    // java/lang/Object:AnyNull:exact *,iid=top
+    // meets
+    // stable:bottom[int:max..0]:NotNull *
+    static void test10_4(Object o) {
+    }
+
+    static void test10_3(Object o, boolean b) {
+        if (b) {
+            test10_4(o);
+        }
+    }
+
+    static void test10_2(Object o, boolean b1, boolean b2) {
+        if (b1) {
+            test10_3(o, b2);
+        }
+    }
+
+    static void test10_1(B[] b, boolean b1, boolean b2) {
+        test10_2(b, b1, b2);
+    }
+
+    static boolean test10() {
+        Object o = new Object();
+        A[] a = new A[10];
+        B[] b = new B[10];
+        B[] c = new C[10];
+        for (int i = 0; i < 20000; i++) {
+            test10_1(b, false, false);
+            test10_1(c, false, false);
+            test10_2(a, true, false);
+            test10_3(o, true);
+        }
+        return true;
+    }
+
+    // stable:TypeSpeculation$B:TopPTR *,iid=top[int:max..0]:TopPTR *,iid=top
+    // meets
+    // java/lang/Object:AnyNull:exact *,iid=top
+    static void test11_3(Object o) {
+    }
+
+    static void test11_2(Object o, boolean b) {
+        if (b) {
+            test11_3(o);
+        }
+    }
+
+    static void test11_1(B[] b, boolean bb) {
+        test11_2(b, bb);
+    }
+
+    static boolean test11() {
+        Object o = new Object();
+        B[] b = new B[10];
+        B[] c = new C[10];
+        for (int i = 0; i < 20000; i++) {
+            test11_1(b, false);
+            test11_1(c, false);
+            test11_2(o, true);
+        }
+        return true;
+    }
+
+    // TypeSpeculation$I *
+    // meets
+    // java/lang/Object:AnyNull *,iid=top
+    static void test12_3(Object o) {
+    }
+
+    static void test12_2(Object o, boolean b) {
+        if (b) {
+            test12_3(o);
+        }
+    }
+
+    static void test12_1(I i, boolean b) {
+        test12_2(i, b);
+    }
+
+    static boolean test12() {
+        Object o = new Object();
+        B b = new B();
+        C c = new C();
+        for (int i = 0; i < 20000; i++) {
+            test12_1(b, false);
+            test12_1(c, false);
+            test12_2(o, true);
+        }
+        return true;
+    }
+
+    // stable:bottom[int:max..0]:NotNull *
+    // meets
+    // stable:TypeSpeculation$A:TopPTR *,iid=top[int:max..0]:AnyNull:exact *,iid=top
+    static Object test13_3(Object o, boolean b) {
+        Object oo;
+        if (b) {
+            oo = o;
+        } else {
+            oo = new A[10];
+        }
+        return oo;
+    }
+
+    static void test13_2(Object o, boolean b1, boolean b2) {
+        if (b1) {
+            test13_3(o, b2);
+        }
+    }
+
+    static void test13_1(B[] b, boolean b1, boolean b2) {
+        test13_2(b, b1, b2);
+    }
+
+    static boolean test13() {
+        A[] a = new A[10];
+        B[] b = new B[10];
+        B[] c = new C[10];
+        for (int i = 0; i < 20000; i++) {
+            test13_1(b, false, false);
+            test13_1(c, false, false);
+            test13_2(a, true, (i%2) == 0);
+        }
+        return true;
+    }
+
     static public void main(String[] args) {
         boolean success = true;
 
@@ -419,6 +546,14 @@
 
         success = test9() && success;
 
+        success = test10() && success;
+
+        success = test11() && success;
+
+        success = test12() && success;
+
+        success = test13() && success;
+
         if (success) {
             System.out.println("TEST PASSED");
         } else {