author | roland |
Mon, 11 Jun 2018 14:16:43 +0200 | |
changeset 50503 | f07979db6cb2 |
parent 48527 | 0769bb301c7a |
permissions | -rw-r--r-- |
48527
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
1 |
/* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Red Hat, Inc. All rights reserved. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
4 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
8 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
14 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
18 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
21 |
* questions. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
22 |
*/ |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
23 |
|
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
24 |
/** |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
25 |
* @test |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
26 |
* @bug 8193597 |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
27 |
* @summary limit test is shared with out of loop if |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
28 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:LoopUnrollLimit=0 -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 LimitSharedwithOutOfLoopTest |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
30 |
* |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
31 |
*/ |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
32 |
|
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
33 |
public class LimitSharedwithOutOfLoopTest { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
34 |
public static void main(String[] args) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
35 |
boolean[] array1 = new boolean[2001]; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
36 |
boolean[] array2 = new boolean[2001]; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
37 |
boolean[] array3 = new boolean[2001]; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
38 |
array2[1000] = true; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
39 |
array3[2000] = true; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
40 |
for (int i = 0; i < 20_000; i++) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
41 |
if (test(2000, array1)) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
42 |
throw new RuntimeException("bad return"); |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
43 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
44 |
if (!test(2000, array2)) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
45 |
throw new RuntimeException("bad return"); |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
46 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
47 |
if (test(2000, array3)) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
48 |
throw new RuntimeException("bad return"); |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
49 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
50 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
51 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
52 |
|
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
53 |
static volatile boolean barrier; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
54 |
|
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
55 |
private static boolean test(int limit, boolean[] array) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
56 |
for (int i = 0; i < limit;) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
57 |
i++; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
58 |
if (array[i]) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
59 |
// Same test as end of loop test. When loop is strip |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
60 |
// mined, this must not become the end of inner loop |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
61 |
// test. |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
62 |
if (i < limit) { |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
63 |
return true; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
64 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
65 |
return false; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
66 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
67 |
barrier = true; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
68 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
69 |
return false; |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
70 |
} |
0769bb301c7a
8193597: sun/nio/cs/TestStringCoding.java fails intermittently with getBytes(csn) failed -> GBK
roland
parents:
diff
changeset
|
71 |
} |