Mercurial > hg > truffle
comparison test/compiler/stable/TestStableChar.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 |
comparison
equal
deleted
inserted
replaced
18003:dda2ae6f9557 | 18004:ee1c924763d2 |
---|---|
24 */ | 24 */ |
25 | 25 |
26 /* | 26 /* |
27 * @test TestStableChar | 27 * @test TestStableChar |
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 TestStableChar.java | 30 * @build TestStableChar 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/TestStableChar | 34 * java/lang/invoke/TestStableChar |
33 * java/lang/invoke/TestStableChar$CharStable | 35 * java/lang/invoke/TestStableChar$CharStable |
34 * java/lang/invoke/TestStableChar$StaticCharStable | 36 * java/lang/invoke/TestStableChar$StaticCharStable |
35 * java/lang/invoke/TestStableChar$VolatileCharStable | 37 * java/lang/invoke/TestStableChar$VolatileCharStable |
36 * java/lang/invoke/TestStableChar$CharArrayDim1 | 38 * java/lang/invoke/TestStableChar$CharArrayDim1 |
46 * java/lang/invoke/TestStableChar$NestedStableField2 | 48 * java/lang/invoke/TestStableChar$NestedStableField2 |
47 * java/lang/invoke/TestStableChar$NestedStableField2$A | 49 * java/lang/invoke/TestStableChar$NestedStableField2$A |
48 * java/lang/invoke/TestStableChar$NestedStableField3 | 50 * java/lang/invoke/TestStableChar$NestedStableField3 |
49 * java/lang/invoke/TestStableChar$NestedStableField3$A | 51 * java/lang/invoke/TestStableChar$NestedStableField3$A |
50 * java/lang/invoke/TestStableChar$DefaultValue | 52 * java/lang/invoke/TestStableChar$DefaultValue |
53 * java/lang/invoke/TestStableChar$DefaultStaticValue | |
51 * java/lang/invoke/TestStableChar$ObjectArrayLowerDim2 | 54 * java/lang/invoke/TestStableChar$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.TestStableChar | |
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.TestStableChar | 67 * java.lang.invoke.TestStableChar |
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.TestStableChar | |
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.TestStableChar | 80 * java.lang.invoke.TestStableChar |
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.TestStableChar | 87 * java.lang.invoke.TestStableChar |
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.TestStableChar | 93 * java.lang.invoke.TestStableChar |
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 TestStableChar { | 99 public class TestStableChar { |
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(CharStable.class); | 105 run(CharStable.class); |
106 run(DefaultStaticValue.class); | |
91 run(StaticCharStable.class); | 107 run(StaticCharStable.class); |
92 run(VolatileCharStable.class); | 108 run(VolatileCharStable.class); |
93 | 109 |
94 // @Stable arrays: Dim 1-4 | 110 // @Stable arrays: Dim 1-4 |
95 run(CharArrayDim1.class); | 111 run(CharArrayDim1.class); |
143 } | 159 } |
144 } | 160 } |
145 | 161 |
146 /* ==================================================== */ | 162 /* ==================================================== */ |
147 | 163 |
164 static class DefaultStaticValue { | |
165 public static @Stable char v; | |
166 | |
167 public static final DefaultStaticValue c = new DefaultStaticValue(); | |
168 public static char get() { return c.v; } | |
169 public static void test() throws Exception { | |
170 char val1 = get(); | |
171 c.v = 'a'; char val2 = get(); | |
172 assertEquals(val1, 0); | |
173 assertEquals(val2, 'a'); | |
174 } | |
175 } | |
176 | |
177 /* ==================================================== */ | |
178 | |
148 static class StaticCharStable { | 179 static class StaticCharStable { |
149 public @Stable char v; | 180 public @Stable char v; |
150 | 181 |
151 public static final StaticCharStable c = new StaticCharStable(); | 182 public static final StaticCharStable c = new StaticCharStable(); |
152 public static char get() { return c.v; } | 183 public static char get() { return c.v; } |
186 public static void test() throws Exception { | 217 public static void test() throws Exception { |
187 { | 218 { |
188 c.v = new char[1]; c.v[0] = 'a'; char val1 = get(); | 219 c.v = new char[1]; c.v[0] = 'a'; char val1 = get(); |
189 c.v[0] = 'b'; char val2 = get(); | 220 c.v[0] = 'b'; char val2 = get(); |
190 assertEquals(val1, 'a'); | 221 assertEquals(val1, 'a'); |
191 assertEquals(val2, (isStableEnabled ? 'a' : 'b')); | 222 assertEquals(val2, (isServerWithStable ? 'a' : 'b')); |
192 | 223 |
193 c.v = new char[1]; c.v[0] = 'c'; char val3 = get(); | 224 c.v = new char[1]; c.v[0] = 'c'; char val3 = get(); |
194 assertEquals(val3, (isStableEnabled ? 'a' : 'c')); | 225 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
226 : 'c')); | |
195 } | 227 } |
196 | 228 |
197 { | 229 { |
198 c.v = new char[20]; c.v[10] = 'a'; char val1 = get1(); | 230 c.v = new char[20]; c.v[10] = 'a'; char val1 = get1(); |
199 c.v[10] = 'b'; char val2 = get1(); | 231 c.v[10] = 'b'; char val2 = get1(); |
200 assertEquals(val1, 'a'); | 232 assertEquals(val1, 'a'); |
201 assertEquals(val2, (isStableEnabled ? 'a' : 'b')); | 233 assertEquals(val2, (isServerWithStable ? 'a' : 'b')); |
202 | 234 |
203 c.v = new char[20]; c.v[10] = 'c'; char val3 = get1(); | 235 c.v = new char[20]; c.v[10] = 'c'; char val3 = get1(); |
204 assertEquals(val3, (isStableEnabled ? 'a' : 'c')); | 236 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
237 : 'c')); | |
205 } | 238 } |
206 | 239 |
207 { | 240 { |
208 c.v = new char[1]; char[] val1 = get2(); | 241 c.v = new char[1]; char[] val1 = get2(); |
209 c.v = new char[1]; char[] val2 = get2(); | 242 c.v = new char[1]; char[] val2 = get2(); |
224 public static void test() throws Exception { | 257 public static void test() throws Exception { |
225 { | 258 { |
226 c.v = new char[1][1]; c.v[0][0] = 'a'; char val1 = get(); | 259 c.v = new char[1][1]; c.v[0][0] = 'a'; char val1 = get(); |
227 c.v[0][0] = 'b'; char val2 = get(); | 260 c.v[0][0] = 'b'; char val2 = get(); |
228 assertEquals(val1, 'a'); | 261 assertEquals(val1, 'a'); |
229 assertEquals(val2, (isStableEnabled ? 'a' : 'b')); | 262 assertEquals(val2, (isServerWithStable ? 'a' : 'b')); |
230 | 263 |
231 c.v = new char[1][1]; c.v[0][0] = 'c'; char val3 = get(); | 264 c.v = new char[1][1]; c.v[0][0] = 'c'; char val3 = get(); |
232 assertEquals(val3, (isStableEnabled ? 'a' : 'c')); | 265 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
266 : 'c')); | |
233 | 267 |
234 c.v[0] = new char[1]; c.v[0][0] = 'd'; char val4 = get(); | 268 c.v[0] = new char[1]; c.v[0][0] = 'd'; char val4 = get(); |
235 assertEquals(val4, (isStableEnabled ? 'a' : 'd')); | 269 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
270 : 'd')); | |
236 } | 271 } |
237 | 272 |
238 { | 273 { |
239 c.v = new char[1][1]; char[] val1 = get1(); | 274 c.v = new char[1][1]; char[] val1 = get1(); |
240 c.v[0] = new char[1]; char[] val2 = get1(); | 275 c.v[0] = new char[1]; char[] 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 char[1][1]; char[][] val1 = get2(); | 280 c.v = new char[1][1]; char[][] val1 = get2(); |
246 c.v = new char[1][1]; char[][] val2 = get2(); | 281 c.v = new char[1][1]; char[][] val2 = get2(); |
262 public static void test() throws Exception { | 297 public static void test() throws Exception { |
263 { | 298 { |
264 c.v = new char[1][1][1]; c.v[0][0][0] = 'a'; char val1 = get(); | 299 c.v = new char[1][1][1]; c.v[0][0][0] = 'a'; char val1 = get(); |
265 c.v[0][0][0] = 'b'; char val2 = get(); | 300 c.v[0][0][0] = 'b'; char val2 = get(); |
266 assertEquals(val1, 'a'); | 301 assertEquals(val1, 'a'); |
267 assertEquals(val2, (isStableEnabled ? 'a' : 'b')); | 302 assertEquals(val2, (isServerWithStable ? 'a' : 'b')); |
268 | 303 |
269 c.v = new char[1][1][1]; c.v[0][0][0] = 'c'; char val3 = get(); | 304 c.v = new char[1][1][1]; c.v[0][0][0] = 'c'; char val3 = get(); |
270 assertEquals(val3, (isStableEnabled ? 'a' : 'c')); | 305 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
306 : 'c')); | |
271 | 307 |
272 c.v[0] = new char[1][1]; c.v[0][0][0] = 'd'; char val4 = get(); | 308 c.v[0] = new char[1][1]; c.v[0][0][0] = 'd'; char val4 = get(); |
273 assertEquals(val4, (isStableEnabled ? 'a' : 'd')); | 309 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
310 : 'd')); | |
274 | 311 |
275 c.v[0][0] = new char[1]; c.v[0][0][0] = 'e'; char val5 = get(); | 312 c.v[0][0] = new char[1]; c.v[0][0][0] = 'e'; char val5 = get(); |
276 assertEquals(val5, (isStableEnabled ? 'a' : 'e')); | 313 assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
314 : 'e')); | |
277 } | 315 } |
278 | 316 |
279 { | 317 { |
280 c.v = new char[1][1][1]; char[] val1 = get1(); | 318 c.v = new char[1][1][1]; char[] val1 = get1(); |
281 c.v[0][0] = new char[1]; char[] val2 = get1(); | 319 c.v[0][0] = new char[1]; char[] 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 char[1][1][1]; char[][] val1 = get2(); | 324 c.v = new char[1][1][1]; char[][] val1 = get2(); |
287 c.v[0] = new char[1][1]; char[][] val2 = get2(); | 325 c.v[0] = new char[1][1]; char[][] 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 char[1][1][1]; char[][][] val1 = get3(); | 330 c.v = new char[1][1][1]; char[][][] val1 = get3(); |
293 c.v = new char[1][1][1]; char[][][] val2 = get3(); | 331 c.v = new char[1][1][1]; char[][][] val2 = get3(); |
310 public static void test() throws Exception { | 348 public static void test() throws Exception { |
311 { | 349 { |
312 c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'a'; char val1 = get(); | 350 c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'a'; char val1 = get(); |
313 c.v[0][0][0][0] = 'b'; char val2 = get(); | 351 c.v[0][0][0][0] = 'b'; char val2 = get(); |
314 assertEquals(val1, 'a'); | 352 assertEquals(val1, 'a'); |
315 assertEquals(val2, (isStableEnabled ? 'a' : 'b')); | 353 assertEquals(val2, (isServerWithStable ? 'a' : 'b')); |
316 | 354 |
317 c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'c'; char val3 = get(); | 355 c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'c'; char val3 = get(); |
318 assertEquals(val3, (isStableEnabled ? 'a' : 'c')); | 356 assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
357 : 'c')); | |
319 | 358 |
320 c.v[0] = new char[1][1][1]; c.v[0][0][0][0] = 'd'; char val4 = get(); | 359 c.v[0] = new char[1][1][1]; c.v[0][0][0][0] = 'd'; char val4 = get(); |
321 assertEquals(val4, (isStableEnabled ? 'a' : 'd')); | 360 assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
361 : 'd')); | |
322 | 362 |
323 c.v[0][0] = new char[1][1]; c.v[0][0][0][0] = 'e'; char val5 = get(); | 363 c.v[0][0] = new char[1][1]; c.v[0][0][0][0] = 'e'; char val5 = get(); |
324 assertEquals(val5, (isStableEnabled ? 'a' : 'e')); | 364 assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
365 : 'e')); | |
325 | 366 |
326 c.v[0][0][0] = new char[1]; c.v[0][0][0][0] = 'f'; char val6 = get(); | 367 c.v[0][0][0] = new char[1]; c.v[0][0][0][0] = 'f'; char val6 = get(); |
327 assertEquals(val6, (isStableEnabled ? 'a' : 'f')); | 368 assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 'a' : 'b') |
369 : 'f')); | |
328 } | 370 } |
329 | 371 |
330 { | 372 { |
331 c.v = new char[1][1][1][1]; char[] val1 = get1(); | 373 c.v = new char[1][1][1][1]; char[] val1 = get1(); |
332 c.v[0][0][0] = new char[1]; char[] val2 = get1(); | 374 c.v[0][0][0] = new char[1]; char[] 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 char[1][1][1][1]; char[][] val1 = get2(); | 379 c.v = new char[1][1][1][1]; char[][] val1 = get2(); |
338 c.v[0][0] = new char[1][1]; char[][] val2 = get2(); | 380 c.v[0][0] = new char[1][1]; char[][] 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 char[1][1][1][1]; char[][][] val1 = get3(); | 385 c.v = new char[1][1][1][1]; char[][][] val1 = get3(); |
344 c.v[0] = new char[1][1][1]; char[][][] val2 = get3(); | 386 c.v[0] = new char[1][1][1]; char[][][] 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 char[1][1][1][1]; char[][][][] val1 = get4(); | 391 c.v = new char[1][1][1][1]; char[][][][] val1 = get4(); |
350 c.v = new char[1][1][1][1]; char[][][][] val2 = get4(); | 392 c.v = new char[1][1][1][1]; char[][][][] 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 |
401 | 442 |
402 { | 443 { |
403 c.v = new char[1][1]; c.v[0] = new char[0]; char[] val1 = get1(); | 444 c.v = new char[1][1]; c.v[0] = new char[0]; char[] val1 = get1(); |
404 c.v[0] = new char[0]; char[] val2 = get1(); | 445 c.v[0] = new char[0]; char[] val2 = get1(); |
405 | 446 |
406 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 447 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
407 } | 448 } |
408 | 449 |
409 { | 450 { |
410 c.v = new char[0][0]; Object[] val1 = get2(); | 451 c.v = new char[0][0]; Object[] val1 = get2(); |
411 c.v = new char[0][0]; Object[] val2 = get2(); | 452 c.v = new char[0][0]; Object[] val2 = get2(); |
437 | 478 |
438 { | 479 { |
439 c.v = new char[1][1][1]; c.v[0][0] = new char[0]; char[] val1 = get1(); | 480 c.v = new char[1][1][1]; c.v[0][0] = new char[0]; char[] val1 = get1(); |
440 c.v[0][0] = new char[0]; char[] val2 = get1(); | 481 c.v[0][0] = new char[0]; char[] val2 = get1(); |
441 | 482 |
442 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 483 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
443 } | 484 } |
444 | 485 |
445 { | 486 { |
446 c.v = new char[1][1][1]; c.v[0] = new char[0][0]; char[][] val1 = get2(); | 487 c.v = new char[1][1][1]; c.v[0] = new char[0][0]; char[][] val1 = get2(); |
447 c.v[0] = new char[0][0]; char[][] val2 = get2(); | 488 c.v[0] = new char[0][0]; char[][] val2 = get2(); |
448 | 489 |
449 assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2))); | 490 assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2))); |
450 } | 491 } |
451 | 492 |
452 { | 493 { |
453 c.v = new char[0][0][0]; Object[][] val1 = get3(); | 494 c.v = new char[0][0][0]; Object[][] val1 = get3(); |
454 c.v = new char[0][0][0]; Object[][] val2 = get3(); | 495 c.v = new char[0][0][0]; Object[][] val2 = get3(); |
579 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; |
580 elem.a = 'a'; char val1 = get(); char val2 = get1(); | 621 elem.a = 'a'; char val1 = get(); char val2 = get1(); |
581 elem.a = 'b'; char val3 = get(); char val4 = get1(); | 622 elem.a = 'b'; char val3 = get(); char val4 = get1(); |
582 | 623 |
583 assertEquals(val1, 'a'); | 624 assertEquals(val1, 'a'); |
584 assertEquals(val3, (isStableEnabled ? 'a' : 'b')); | 625 assertEquals(val3, (isServerWithStable ? 'a' : 'b')); |
585 | 626 |
586 assertEquals(val2, 'a'); | 627 assertEquals(val2, 'a'); |
587 assertEquals(val4, 'b'); | 628 assertEquals(val4, 'b'); |
588 } | 629 } |
589 } | 630 } |
613 System.out.println("FAILED"); | 654 System.out.println("FAILED"); |
614 ex.printStackTrace(System.out); | 655 ex.printStackTrace(System.out); |
615 } | 656 } |
616 } | 657 } |
617 } | 658 } |
618 | |
619 static final boolean isStableEnabled; | |
620 static { | |
621 HotSpotDiagnosticMXBean diagnostic | |
622 = ManagementFactoryHelper.getDiagnosticMXBean(); | |
623 VMOption tmp; | |
624 try { | |
625 tmp = diagnostic.getVMOption("FoldStableValues"); | |
626 } catch (IllegalArgumentException e) { | |
627 tmp = null; | |
628 } | |
629 isStableEnabled = (tmp == null ? false : Boolean.parseBoolean(tmp.getValue())); | |
630 } | |
631 } | 659 } |