author | iignatyev |
Wed, 13 Nov 2019 10:59:25 -0800 | |
changeset 59063 | 058d299b22b6 |
parent 58471 | bada0782842a |
permissions | -rw-r--r-- |
58471
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
1 |
/* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Red Hat, Inc. All rights reserved. |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
4 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
8 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
13 |
* accompanied this code). |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
14 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
18 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
21 |
* questions. |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
22 |
*/ |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
23 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
24 |
/** |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
25 |
* @test |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
26 |
* @bug 8231550 |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
27 |
* @summary C2: ShouldNotReachHere() in verify_strip_mined_scheduling |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
28 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
29 |
* @run main/othervm -XX:-BackgroundCompilation -XX:LoopMaxUnroll=0 TestConservativeAntiDep |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
30 |
* |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
31 |
*/ |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
32 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
33 |
import java.lang.reflect.Array; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
34 |
import java.util.Arrays; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
35 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
36 |
public class TestConservativeAntiDep { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
37 |
private static long longField; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
38 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws InstantiationException, IllegalAccessException { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
40 |
for (int i = 0; i < 20_000; i++) { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
41 |
test1(A.class); |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
42 |
test2(B.class); |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
43 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
44 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
45 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
46 |
private static int test1(Class klass) { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
47 |
Object[] in = (Object[])Array.newInstance(klass, 100); |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
48 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
49 |
Object[] o = in; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
50 |
int v = 1; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
51 |
// CountedLoop has control dependent CastPP |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
52 |
for (int i = 0; i < 100 ; i++) { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
53 |
longField = i; // sunk in outer strip mined loop |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
54 |
o = (A[]) o; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
55 |
v *= 2; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
56 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
57 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
58 |
// LoadRange cannot float higher than CountedLoop (because of |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
59 |
// CastPP) and is found anti-dependent with long store so |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
60 |
// scheduled in outer strip mined loop |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
61 |
return v + o.length; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
62 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
63 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
64 |
private static int test2(Class klass) throws IllegalAccessException, InstantiationException { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
65 |
A in = (A)klass.newInstance(); |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
66 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
67 |
A o = in; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
68 |
int v = 1; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
69 |
// CountedLoop has control dependent CastPP |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
70 |
for (int i = 0; i < 100 ; i++) { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
71 |
longField = i; // sunk in outer strip mined loop |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
72 |
o = (B) o; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
73 |
v *= 2; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
74 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
75 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
76 |
// Load cannot float higher than CountedLoop (because of |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
77 |
// CastPP) and is found anti-dependent with long store so |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
78 |
// scheduled in outer strip mined loop |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
79 |
return v + o.intField; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
80 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
81 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
82 |
private static class A { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
83 |
int intField; |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
84 |
public A() {} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
85 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
86 |
|
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
87 |
private static class B extends A { |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
88 |
public B() {} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
89 |
} |
bada0782842a
8231550: C2: ShouldNotReachHere() in verify_strip_mined_scheduling
roland
parents:
diff
changeset
|
90 |
} |