Mercurial > hg > graal-jvmci-8
comparison test/compiler/stable/TestStableLong.java @ 18004:ee1c924763d2
8043546: C1 optimizes @Stable instance fields with default values
Reviewed-by: kvn, jrose
author | vlivanov |
---|---|
date | Thu, 10 Jul 2014 12:04:43 -0700 |
parents | 248ff38d2950 |
children | 1ec24746bb40 |
comparison
equal
deleted
inserted
replaced
18003:dda2ae6f9557 | 18004:ee1c924763d2 |
---|---|
24 */ | 24 */ |
25 | 25 |
26 /* | 26 /* |
27 * @test TestStableLong | 27 * @test TestStableLong |
28 * @summary tests on stable fields and arrays | 28 * @summary tests on stable fields and arrays |
29 * @library /testlibrary | 29 * @library /testlibrary /testlibrary/whitebox |
30 * @compile -XDignore.symbol.file TestStableLong.java | 30 * @build TestStableLong StableConfiguration sun.hotspot.WhiteBox |
31 * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission | |
31 * @run main ClassFileInstaller | 32 * @run main ClassFileInstaller |
33 * java/lang/invoke/StableConfiguration | |
32 * java/lang/invoke/TestStableLong | 34 * java/lang/invoke/TestStableLong |
33 * java/lang/invoke/TestStableLong$LongStable | 35 * java/lang/invoke/TestStableLong$LongStable |
34 * java/lang/invoke/TestStableLong$StaticLongStable | 36 * java/lang/invoke/TestStableLong$StaticLongStable |
35 * java/lang/invoke/TestStableLong$VolatileLongStable | 37 * java/lang/invoke/TestStableLong$VolatileLongStable |
36 * java/lang/invoke/TestStableLong$LongArrayDim1 | 38 * java/lang/invoke/TestStableLong$LongArrayDim1 |
46 * java/lang/invoke/TestStableLong$NestedStableField2 | 48 * java/lang/invoke/TestStableLong$NestedStableField2 |
47 * java/lang/invoke/TestStableLong$NestedStableField2$A | 49 * java/lang/invoke/TestStableLong$NestedStableField2$A |
48 * java/lang/invoke/TestStableLong$NestedStableField3 | 50 * java/lang/invoke/TestStableLong$NestedStableField3 |
49 * java/lang/invoke/TestStableLong$NestedStableField3$A | 51 * java/lang/invoke/TestStableLong$NestedStableField3$A |
50 * java/lang/invoke/TestStableLong$DefaultValue | 52 * java/lang/invoke/TestStableLong$DefaultValue |
53 * java/lang/invoke/TestStableLong$DefaultStaticValue | |
51 * java/lang/invoke/TestStableLong$ObjectArrayLowerDim2 | 54 * java/lang/invoke/TestStableLong$ObjectArrayLowerDim2 |
52 * | 55 * |
53 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | 56 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions |
54 * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:+UseCompressedOop | 57 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp |
55 * -server -XX:-TieredCompilation -Xcomp | 58 * -server -XX:-TieredCompilation |
59 * -XX:+FoldStableValues | |
60 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | |
61 * java.lang.invoke.TestStableLong | |
62 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | |
63 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp | |
64 * -server -XX:-TieredCompilation | |
65 * -XX:-FoldStableValues | |
56 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | 66 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 |
57 * java.lang.invoke.TestStableLong | 67 * java.lang.invoke.TestStableLong |
58 * | 68 * |
59 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | 69 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions |
60 * -XX:+UnlockDiagnosticVMOptions -XX:+FoldStableValues -XX:-UseCompressedOop | 70 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp |
61 * -server -XX:-TieredCompilation -Xcomp | 71 * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 |
72 * -XX:+FoldStableValues | |
73 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | |
74 * java.lang.invoke.TestStableLong | |
75 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | |
76 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp | |
77 * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1 | |
78 * -XX:-FoldStableValues | |
62 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | 79 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 |
63 * java.lang.invoke.TestStableLong | 80 * java.lang.invoke.TestStableLong |
64 * | 81 * |
65 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | 82 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions |
66 * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:+UseCompressedOop | 83 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp |
67 * -server -XX:-TieredCompilation -Xcomp | 84 * -client -XX:-TieredCompilation |
85 * -XX:+FoldStableValues | |
68 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | 86 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 |
69 * java.lang.invoke.TestStableLong | 87 * java.lang.invoke.TestStableLong |
70 * | |
71 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions | 88 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions |
72 * -XX:+UnlockDiagnosticVMOptions -XX:-FoldStableValues -XX:-UseCompressedOop | 89 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp |
73 * -server -XX:-TieredCompilation -Xcomp | 90 * -client -XX:-TieredCompilation |
91 * -XX:-FoldStableValues | |
74 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 | 92 * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 |
75 * java.lang.invoke.TestStableLong | 93 * java.lang.invoke.TestStableLong |
76 */ | 94 */ |
77 package java.lang.invoke; | 95 package java.lang.invoke; |
78 | 96 |
79 import com.sun.management.HotSpotDiagnosticMXBean; | |
80 import com.sun.management.VMOption; | |
81 import sun.management.ManagementFactoryHelper; | |
82 import java.lang.reflect.InvocationTargetException; | 97 import java.lang.reflect.InvocationTargetException; |
83 | 98 |
84 public class TestStableLong { | 99 public class TestStableLong { |
100 static final boolean isStableEnabled = StableConfiguration.isStableEnabled; | |
101 static final boolean isServerWithStable = StableConfiguration.isServerWithStable; | |
102 | |
85 public static void main(String[] args) throws Exception { | 103 public static void main(String[] args) throws Exception { |
86 System.out.println("@Stable enabled: "+isStableEnabled); | |
87 System.out.println(); | |
88 | |
89 run(DefaultValue.class); | 104 run(DefaultValue.class); |
90 run(LongStable.class); | 105 run(LongStable.class); |
106 run(DefaultStaticValue.class); | |
91 run(StaticLongStable.class); | 107 run(StaticLongStable.class); |
92 run(VolatileLongStable.class); | 108 run(VolatileLongStable.class); |
93 | 109 |
94 // @Stable arrays: Dim 1-4 | 110 // @Stable arrays: Dim 1-4 |
95 run(LongArrayDim1.class); | 111 run(LongArrayDim1.class); |
143 } | 159 } |
144 } | 160 } |
145 | 161 |
146 /* ==================================================== */ | 162 /* ==================================================== */ |
147 | 163 |
164 static class DefaultStaticValue { | |
165 public static @Stable long v; | |
166 | |
167 public static final DefaultStaticValue c = new DefaultStaticValue(); | |
168 public static long get() { return c.v; } | |
169 public static void test() throws Exception { | |
170 long val1 = get(); | |
171 c.v = 1L; long val2 = get(); | |
172 assertEquals(val1, 0); | |
173 assertEquals(val2, 1L); | |
174 } | |
175 } | |
176 | |
177 /* ==================================================== */ | |
178 | |
148 static class StaticLongStable { | 179 static class StaticLongStable { |
149 public static @Stable long v; | 180 public static @Stable long v; |
150 | 181 |
151 public static final StaticLongStable c = new StaticLongStable(); | 182 public static final StaticLongStable c = new StaticLongStable(); |
152 public static long get() { return c.v; } | 183 public static long get() { return c.v; } |
186 public static void test() throws Exception { | 217 public static void test() throws Exception { |
187 { | 218 { |
188 c.v = new long[1]; c.v[0] = 1; long val1 = get(); | 219 c.v = new long[1]; c.v[0] = 1; long val1 = get(); |
189 c.v[0] = 2; long val2 = get(); | 220 c.v[0] = 2; long val2 = get(); |
190 assertEquals(val1, 1); | 221 assertEquals(val1, 1); |
191 assertEquals(val2, (isStableEnabled ? 1 : 2)); | 222 assertEquals(val2, (isServerWithStable ? 1 : 2)); |
192 | 223 |
193 c.v = new long[1]; c.v[0] = 3; long val3 = get(); | 224 c.v = new long[1]; c.v[0] = 3; long val3 = get(); |
194 assertEquals(val3, (isStableEnabled ? 1 : 3)); | 225 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
226 : 3)); | |
195 } | 227 } |
196 | 228 |
197 { | 229 { |
198 c.v = new long[20]; c.v[10] = 1; long val1 = get1(); | 230 c.v = new long[20]; c.v[10] = 1; long val1 = get1(); |
199 c.v[10] = 2; long val2 = get1(); | 231 c.v[10] = 2; long val2 = get1(); |
200 assertEquals(val1, 1); | 232 assertEquals(val1, 1); |
201 assertEquals(val2, (isStableEnabled ? 1 : 2)); | 233 assertEquals(val2, (isServerWithStable ? 1 : 2)); |
202 | 234 |
203 c.v = new long[20]; c.v[10] = 3; long val3 = get1(); | 235 c.v = new long[20]; c.v[10] = 3; long val3 = get1(); |
204 assertEquals(val3, (isStableEnabled ? 1 : 3)); | 236 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
237 : 3)); | |
205 } | 238 } |
206 | 239 |
207 { | 240 { |
208 c.v = new long[1]; long[] val1 = get2(); | 241 c.v = new long[1]; long[] val1 = get2(); |
209 c.v = new long[1]; long[] val2 = get2(); | 242 c.v = new long[1]; long[] val2 = get2(); |
224 public static void test() throws Exception { | 257 public static void test() throws Exception { |
225 { | 258 { |
226 c.v = new long[1][1]; c.v[0][0] = 1; long val1 = get(); | 259 c.v = new long[1][1]; c.v[0][0] = 1; long val1 = get(); |
227 c.v[0][0] = 2; long val2 = get(); | 260 c.v[0][0] = 2; long val2 = get(); |
228 assertEquals(val1, 1); | 261 assertEquals(val1, 1); |
229 assertEquals(val2, (isStableEnabled ? 1 : 2)); | 262 assertEquals(val2, (isServerWithStable ? 1 : 2)); |
230 | 263 |
231 c.v = new long[1][1]; c.v[0][0] = 3; long val3 = get(); | 264 c.v = new long[1][1]; c.v[0][0] = 3; long val3 = get(); |
232 assertEquals(val3, (isStableEnabled ? 1 : 3)); | 265 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
266 : 3)); | |
233 | 267 |
234 c.v[0] = new long[1]; c.v[0][0] = 4; long val4 = get(); | 268 c.v[0] = new long[1]; c.v[0][0] = 4; long val4 = get(); |
235 assertEquals(val4, (isStableEnabled ? 1 : 4)); | 269 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
270 : 4)); | |
236 } | 271 } |
237 | 272 |
238 { | 273 { |
239 c.v = new long[1][1]; long[] val1 = get1(); | 274 c.v = new long[1][1]; long[] val1 = get1(); |
240 c.v[0] = new long[1]; long[] val2 = get1(); | 275 c.v[0] = new long[1]; long[] val2 = get1(); |
241 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 276 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
242 } | 277 } |
243 | 278 |
244 { | 279 { |
245 c.v = new long[1][1]; long[][] val1 = get2(); | 280 c.v = new long[1][1]; long[][] val1 = get2(); |
246 c.v = new long[1][1]; long[][] val2 = get2(); | 281 c.v = new long[1][1]; long[][] val2 = get2(); |
262 public static void test() throws Exception { | 297 public static void test() throws Exception { |
263 { | 298 { |
264 c.v = new long[1][1][1]; c.v[0][0][0] = 1; long val1 = get(); | 299 c.v = new long[1][1][1]; c.v[0][0][0] = 1; long val1 = get(); |
265 c.v[0][0][0] = 2; long val2 = get(); | 300 c.v[0][0][0] = 2; long val2 = get(); |
266 assertEquals(val1, 1); | 301 assertEquals(val1, 1); |
267 assertEquals(val2, (isStableEnabled ? 1 : 2)); | 302 assertEquals(val2, (isServerWithStable ? 1 : 2)); |
268 | 303 |
269 c.v = new long[1][1][1]; c.v[0][0][0] = 3; long val3 = get(); | 304 c.v = new long[1][1][1]; c.v[0][0][0] = 3; long val3 = get(); |
270 assertEquals(val3, (isStableEnabled ? 1 : 3)); | 305 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
306 : 3)); | |
271 | 307 |
272 c.v[0] = new long[1][1]; c.v[0][0][0] = 4; long val4 = get(); | 308 c.v[0] = new long[1][1]; c.v[0][0][0] = 4; long val4 = get(); |
273 assertEquals(val4, (isStableEnabled ? 1 : 4)); | 309 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
310 : 4)); | |
274 | 311 |
275 c.v[0][0] = new long[1]; c.v[0][0][0] = 5; long val5 = get(); | 312 c.v[0][0] = new long[1]; c.v[0][0][0] = 5; long val5 = get(); |
276 assertEquals(val5, (isStableEnabled ? 1 : 5)); | 313 assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
314 : 5)); | |
277 } | 315 } |
278 | 316 |
279 { | 317 { |
280 c.v = new long[1][1][1]; long[] val1 = get1(); | 318 c.v = new long[1][1][1]; long[] val1 = get1(); |
281 c.v[0][0] = new long[1]; long[] val2 = get1(); | 319 c.v[0][0] = new long[1]; long[] val2 = get1(); |
282 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 320 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
283 } | 321 } |
284 | 322 |
285 { | 323 { |
286 c.v = new long[1][1][1]; long[][] val1 = get2(); | 324 c.v = new long[1][1][1]; long[][] val1 = get2(); |
287 c.v[0] = new long[1][1]; long[][] val2 = get2(); | 325 c.v[0] = new long[1][1]; long[][] val2 = get2(); |
288 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 326 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
289 } | 327 } |
290 | 328 |
291 { | 329 { |
292 c.v = new long[1][1][1]; long[][][] val1 = get3(); | 330 c.v = new long[1][1][1]; long[][][] val1 = get3(); |
293 c.v = new long[1][1][1]; long[][][] val2 = get3(); | 331 c.v = new long[1][1][1]; long[][][] val2 = get3(); |
310 public static void test() throws Exception { | 348 public static void test() throws Exception { |
311 { | 349 { |
312 c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 1; long val1 = get(); | 350 c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 1; long val1 = get(); |
313 c.v[0][0][0][0] = 2; long val2 = get(); | 351 c.v[0][0][0][0] = 2; long val2 = get(); |
314 assertEquals(val1, 1); | 352 assertEquals(val1, 1); |
315 assertEquals(val2, (isStableEnabled ? 1 : 2)); | 353 assertEquals(val2, (isServerWithStable ? 1 : 2)); |
316 | 354 |
317 c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 3; long val3 = get(); | 355 c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 3; long val3 = get(); |
318 assertEquals(val3, (isStableEnabled ? 1 : 3)); | 356 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
357 : 3)); | |
319 | 358 |
320 c.v[0] = new long[1][1][1]; c.v[0][0][0][0] = 4; long val4 = get(); | 359 c.v[0] = new long[1][1][1]; c.v[0][0][0][0] = 4; long val4 = get(); |
321 assertEquals(val4, (isStableEnabled ? 1 : 4)); | 360 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
361 : 4)); | |
322 | 362 |
323 c.v[0][0] = new long[1][1]; c.v[0][0][0][0] = 5; long val5 = get(); | 363 c.v[0][0] = new long[1][1]; c.v[0][0][0][0] = 5; long val5 = get(); |
324 assertEquals(val5, (isStableEnabled ? 1 : 5)); | 364 assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
365 : 5)); | |
325 | 366 |
326 c.v[0][0][0] = new long[1]; c.v[0][0][0][0] = 6; long val6 = get(); | 367 c.v[0][0][0] = new long[1]; c.v[0][0][0][0] = 6; long val6 = get(); |
327 assertEquals(val6, (isStableEnabled ? 1 : 6)); | 368 assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2) |
369 : 6)); | |
328 } | 370 } |
329 | 371 |
330 { | 372 { |
331 c.v = new long[1][1][1][1]; long[] val1 = get1(); | 373 c.v = new long[1][1][1][1]; long[] val1 = get1(); |
332 c.v[0][0][0] = new long[1]; long[] val2 = get1(); | 374 c.v[0][0][0] = new long[1]; long[] val2 = get1(); |
333 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 375 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
334 } | 376 } |
335 | 377 |
336 { | 378 { |
337 c.v = new long[1][1][1][1]; long[][] val1 = get2(); | 379 c.v = new long[1][1][1][1]; long[][] val1 = get2(); |
338 c.v[0][0] = new long[1][1]; long[][] val2 = get2(); | 380 c.v[0][0] = new long[1][1]; long[][] val2 = get2(); |
339 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 381 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
340 } | 382 } |
341 | 383 |
342 { | 384 { |
343 c.v = new long[1][1][1][1]; long[][][] val1 = get3(); | 385 c.v = new long[1][1][1][1]; long[][][] val1 = get3(); |
344 c.v[0] = new long[1][1][1]; long[][][] val2 = get3(); | 386 c.v[0] = new long[1][1][1]; long[][][] val2 = get3(); |
345 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 387 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
346 } | 388 } |
347 | 389 |
348 { | 390 { |
349 c.v = new long[1][1][1][1]; long[][][][] val1 = get4(); | 391 c.v = new long[1][1][1][1]; long[][][][] val1 = get4(); |
350 c.v = new long[1][1][1][1]; long[][][][] val2 = get4(); | 392 c.v = new long[1][1][1][1]; long[][][][] val2 = get4(); |
351 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 393 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); |
352 } | 394 } |
353 | |
354 } | 395 } |
355 } | 396 } |
356 | 397 |
357 /* ==================================================== */ | 398 /* ==================================================== */ |
358 // Dynamic Dim is higher than static | 399 // Dynamic Dim is higher than static |
359 | |
360 static class ObjectArrayLowerDim0 { | 400 static class ObjectArrayLowerDim0 { |
361 public @Stable Object v; | 401 public @Stable Object v; |
362 | 402 |
363 public static final ObjectArrayLowerDim0 c = new ObjectArrayLowerDim0(); | 403 public static final ObjectArrayLowerDim0 c = new ObjectArrayLowerDim0(); |
364 public static long get() { return ((long[])c.v)[0]; } | 404 public static long get() { return ((long[])c.v)[0]; } |
402 | 442 |
403 { | 443 { |
404 c.v = new long[1][1]; c.v[0] = new long[0]; long[] val1 = get1(); | 444 c.v = new long[1][1]; c.v[0] = new long[0]; long[] val1 = get1(); |
405 c.v[0] = new long[0]; long[] val2 = get1(); | 445 c.v[0] = new long[0]; long[] val2 = get1(); |
406 | 446 |
407 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 447 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
408 } | 448 } |
409 | 449 |
410 { | 450 { |
411 c.v = new long[0][0]; Object[] val1 = get2(); | 451 c.v = new long[0][0]; Object[] val1 = get2(); |
412 c.v = new long[0][0]; Object[] val2 = get2(); | 452 c.v = new long[0][0]; Object[] val2 = get2(); |
438 | 478 |
439 { | 479 { |
440 c.v = new long[1][1][1]; c.v[0][0] = new long[0]; long[] val1 = get1(); | 480 c.v = new long[1][1][1]; c.v[0][0] = new long[0]; long[] val1 = get1(); |
441 c.v[0][0] = new long[0]; long[] val2 = get1(); | 481 c.v[0][0] = new long[0]; long[] val2 = get1(); |
442 | 482 |
443 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 483 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
444 } | 484 } |
445 | 485 |
446 { | 486 { |
447 c.v = new long[1][1][1]; c.v[0] = new long[0][0]; long[][] val1 = get2(); | 487 c.v = new long[1][1][1]; c.v[0] = new long[0][0]; long[][] val1 = get2(); |
448 c.v[0] = new long[0][0]; long[][] val2 = get2(); | 488 c.v[0] = new long[0][0]; long[][] val2 = get2(); |
449 | 489 |
450 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 490 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
451 } | 491 } |
452 | 492 |
453 { | 493 { |
454 c.v = new long[0][0][0]; Object[][] val1 = get3(); | 494 c.v = new long[0][0][0]; Object[][] val1 = get3(); |
455 c.v = new long[0][0][0]; Object[][] val2 = get3(); | 495 c.v = new long[0][0][0]; Object[][] val2 = get3(); |
580 c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v; | 620 c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v; |
581 elem.a = 1; long val1 = get(); long val2 = get1(); | 621 elem.a = 1; long val1 = get(); long val2 = get1(); |
582 elem.a = 2; long val3 = get(); long val4 = get1(); | 622 elem.a = 2; long val3 = get(); long val4 = get1(); |
583 | 623 |
584 assertEquals(val1, 1); | 624 assertEquals(val1, 1); |
585 assertEquals(val3, (isStableEnabled ? 1 : 2)); | 625 assertEquals(val3, (isServerWithStable ? 1 : 2)); |
586 | 626 |
587 assertEquals(val2, 1); | 627 assertEquals(val2, 1); |
588 assertEquals(val4, 2); | 628 assertEquals(val4, 2); |
589 } | 629 } |
590 } | 630 } |
614 System.out.println("FAILED"); | 654 System.out.println("FAILED"); |
615 ex.printStackTrace(System.out); | 655 ex.printStackTrace(System.out); |
616 } | 656 } |
617 } | 657 } |
618 } | 658 } |
619 | |
620 static final boolean isStableEnabled; | |
621 static { | |
622 HotSpotDiagnosticMXBean diagnostic | |
623 = ManagementFactoryHelper.getDiagnosticMXBean(); | |
624 VMOption tmp; | |
625 try { | |
626 tmp = diagnostic.getVMOption("FoldStableValues"); | |
627 } catch (IllegalArgumentException e) { | |
628 tmp = null; | |
629 } | |
630 isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); | |
631 } | |
632 } | 659 } |