1.1 --- a/test/compiler/types/TypeSpeculation.java Tue Dec 31 19:26:57 2013 +0400 1.2 +++ b/test/compiler/types/TypeSpeculation.java Tue Jan 07 12:38:22 2014 +0100 1.3 @@ -25,7 +25,7 @@ 1.4 * @test 1.5 * @bug 8024070 1.6 * @summary Test that type speculation doesn't cause incorrect execution 1.7 - * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 TypeSpeculation 1.8 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 -XX:+UnlockExperimentalVMOptions -XX:+UseTypeSpeculation TypeSpeculation 1.9 * 1.10 */ 1.11 1.12 @@ -398,6 +398,133 @@ 1.13 return true; 1.14 } 1.15 1.16 + // java/lang/Object:AnyNull:exact *,iid=top 1.17 + // meets 1.18 + // stable:bottom[int:max..0]:NotNull * 1.19 + static void test10_4(Object o) { 1.20 + } 1.21 + 1.22 + static void test10_3(Object o, boolean b) { 1.23 + if (b) { 1.24 + test10_4(o); 1.25 + } 1.26 + } 1.27 + 1.28 + static void test10_2(Object o, boolean b1, boolean b2) { 1.29 + if (b1) { 1.30 + test10_3(o, b2); 1.31 + } 1.32 + } 1.33 + 1.34 + static void test10_1(B[] b, boolean b1, boolean b2) { 1.35 + test10_2(b, b1, b2); 1.36 + } 1.37 + 1.38 + static boolean test10() { 1.39 + Object o = new Object(); 1.40 + A[] a = new A[10]; 1.41 + B[] b = new B[10]; 1.42 + B[] c = new C[10]; 1.43 + for (int i = 0; i < 20000; i++) { 1.44 + test10_1(b, false, false); 1.45 + test10_1(c, false, false); 1.46 + test10_2(a, true, false); 1.47 + test10_3(o, true); 1.48 + } 1.49 + return true; 1.50 + } 1.51 + 1.52 + // stable:TypeSpeculation$B:TopPTR *,iid=top[int:max..0]:TopPTR *,iid=top 1.53 + // meets 1.54 + // java/lang/Object:AnyNull:exact *,iid=top 1.55 + static void test11_3(Object o) { 1.56 + } 1.57 + 1.58 + static void test11_2(Object o, boolean b) { 1.59 + if (b) { 1.60 + test11_3(o); 1.61 + } 1.62 + } 1.63 + 1.64 + static void test11_1(B[] b, boolean bb) { 1.65 + test11_2(b, bb); 1.66 + } 1.67 + 1.68 + static boolean test11() { 1.69 + Object o = new Object(); 1.70 + B[] b = new B[10]; 1.71 + B[] c = new C[10]; 1.72 + for (int i = 0; i < 20000; i++) { 1.73 + test11_1(b, false); 1.74 + test11_1(c, false); 1.75 + test11_2(o, true); 1.76 + } 1.77 + return true; 1.78 + } 1.79 + 1.80 + // TypeSpeculation$I * 1.81 + // meets 1.82 + // java/lang/Object:AnyNull *,iid=top 1.83 + static void test12_3(Object o) { 1.84 + } 1.85 + 1.86 + static void test12_2(Object o, boolean b) { 1.87 + if (b) { 1.88 + test12_3(o); 1.89 + } 1.90 + } 1.91 + 1.92 + static void test12_1(I i, boolean b) { 1.93 + test12_2(i, b); 1.94 + } 1.95 + 1.96 + static boolean test12() { 1.97 + Object o = new Object(); 1.98 + B b = new B(); 1.99 + C c = new C(); 1.100 + for (int i = 0; i < 20000; i++) { 1.101 + test12_1(b, false); 1.102 + test12_1(c, false); 1.103 + test12_2(o, true); 1.104 + } 1.105 + return true; 1.106 + } 1.107 + 1.108 + // stable:bottom[int:max..0]:NotNull * 1.109 + // meets 1.110 + // stable:TypeSpeculation$A:TopPTR *,iid=top[int:max..0]:AnyNull:exact *,iid=top 1.111 + static Object test13_3(Object o, boolean b) { 1.112 + Object oo; 1.113 + if (b) { 1.114 + oo = o; 1.115 + } else { 1.116 + oo = new A[10]; 1.117 + } 1.118 + return oo; 1.119 + } 1.120 + 1.121 + static void test13_2(Object o, boolean b1, boolean b2) { 1.122 + if (b1) { 1.123 + test13_3(o, b2); 1.124 + } 1.125 + } 1.126 + 1.127 + static void test13_1(B[] b, boolean b1, boolean b2) { 1.128 + test13_2(b, b1, b2); 1.129 + } 1.130 + 1.131 + static boolean test13() { 1.132 + A[] a = new A[10]; 1.133 + B[] b = new B[10]; 1.134 + B[] c = new C[10]; 1.135 + for (int i = 0; i < 20000; i++) { 1.136 + test13_1(b, false, false); 1.137 + test13_1(c, false, false); 1.138 + test13_2(a, true, (i%2) == 0); 1.139 + } 1.140 + return true; 1.141 + } 1.142 + 1.143 static public void main(String[] args) { 1.144 boolean success = true; 1.145 1.146 @@ -419,6 +546,14 @@ 1.147 1.148 success = test9() && success; 1.149 1.150 + success = test10() && success; 1.151 + 1.152 + success = test11() && success; 1.153 + 1.154 + success = test12() && success; 1.155 + 1.156 + success = test13() && success; 1.157 + 1.158 if (success) { 1.159 System.out.println("TEST PASSED"); 1.160 } else {