author | jiangli |
Fri, 02 Nov 2018 19:30:31 -0400 | |
changeset 52397 | 1322829d1501 |
parent 50923 | c98bf5aa35c5 |
permissions | -rw-r--r-- |
50923
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
1 |
/* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Red Hat, Inc. All rights reserved. |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
4 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
8 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
14 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
18 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
21 |
* questions. |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
22 |
*/ |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
23 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
24 |
/** |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
25 |
* @test |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
26 |
* @bug 8205515 |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
27 |
* @summary CountedLoopEndNode from peeled loop body is not candidate for profile loop predication |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
28 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement CountedLoopPeelingProfilePredicates |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
30 |
* |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
31 |
*/ |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
32 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
33 |
import java.util.Arrays; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
34 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
35 |
public class CountedLoopPeelingProfilePredicates { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
36 |
public static void main(String[] args) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
37 |
int stop = 2; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
38 |
boolean[] flags1 = new boolean[stop]; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
39 |
flags1[stop-1] = true; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
40 |
boolean[] flags2 = new boolean[stop]; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
41 |
flags2[0] = true; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
42 |
boolean[] flags3 = new boolean[100]; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
43 |
Arrays.fill(flags3, true); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
44 |
flags3[0] = false; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
45 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
46 |
for (int i = 0; i < 20_000; i++) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
47 |
test_helper(stop, flags1, false); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
48 |
test_helper(stop, flags2, false); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
49 |
test_helper(stop, flags2, false); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
50 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
51 |
for (int i = 0; i < 20_000; i++) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
52 |
test(stop, flags1, false, flags3, 1); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
53 |
test(stop, flags2, false, flags3, 1); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
54 |
test(stop, flags2, false, flags3, 1); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
55 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
56 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
57 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
58 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
59 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
60 |
private static void test(int stop, boolean[] flags1, boolean flag2, boolean[] flags3, int inc) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
61 |
for (int j = 0; j < 100; j+=inc) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
62 |
if (flags3[j]) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
63 |
test_helper(stop, flags1, flag2); |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
64 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
65 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
66 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
67 |
|
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
68 |
private static void test_helper(int stop, boolean[] flags1, boolean flag2) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
69 |
for (int i = 0; i < stop; i++) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
70 |
if (flags1[i]) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
71 |
return; |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
72 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
73 |
if (flag2) { |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
74 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
75 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
76 |
} |
c98bf5aa35c5
8205515: assert(opcode == Op_RangeCheck) failed: no other if variant here
roland
parents:
diff
changeset
|
77 |
} |