author | iignatyev |
Wed, 13 Nov 2019 10:59:25 -0800 | |
changeset 59063 | 058d299b22b6 |
parent 54119 | 6bf8877eb1b9 |
permissions | -rw-r--r-- |
54119 | 1 |
/* |
2 |
* Copyright (c) 2019, SAP SE. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 8220374 |
|
27 |
* @summary C2: LoopStripMining doesn't strip as expected |
|
28 |
* @requires vm.compiler2.enabled |
|
29 |
* |
|
59063
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
30 |
* @library /test/lib |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
31 |
* @run driver compiler.loopstripmining.CheckLoopStripMining |
54119 | 32 |
*/ |
33 |
||
59063
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
34 |
package compiler.loopstripmining; |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
35 |
|
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
36 |
import jdk.test.lib.Utils; |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
37 |
import jdk.test.lib.process.ProcessTools; |
54119 | 38 |
|
59063
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
39 |
public class CheckLoopStripMining { |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
40 |
public static void main(String args[]) throws Exception { |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
41 |
ProcessTools.executeTestJvm( |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
42 |
"-XX:+UnlockDiagnosticVMOptions", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
43 |
// to prevent biased locking handshakes from changing the timing of this test |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
44 |
"-XX:-UseBiasedLocking", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
45 |
"-XX:+SafepointTimeout", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
46 |
"-XX:+SafepointALot", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
47 |
"-XX:+AbortVMOnSafepointTimeout", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
48 |
"-XX:SafepointTimeoutDelay=" + Utils.adjustTimeout(500), |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
49 |
"-XX:GuaranteedSafepointInterval=" + Utils.adjustTimeout(500), |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
50 |
"-XX:-TieredCompilation", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
51 |
"-XX:+UseCountedLoopSafepoints", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
52 |
"-XX:LoopStripMiningIter=1000", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
53 |
"-XX:LoopUnrollLimit=0", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
54 |
"-XX:CompileCommand=compileonly,compiler.loopstripmining.CheckLoopStripMining$Test::test_loop", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
55 |
"-Xcomp", |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
56 |
Test.class.getName()).shouldHaveExitValue(0) |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
57 |
.stdoutShouldContain("sum: 715827882"); |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
58 |
} |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
59 |
|
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
60 |
public static class Test { |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
61 |
public static int test_loop(int x) { |
54119 | 62 |
int sum = 0; |
63 |
if (x != 0) { |
|
64 |
for (int y = 1; y < Integer.MAX_VALUE; ++y) { |
|
65 |
if (y % x == 0) ++sum; |
|
66 |
} |
|
67 |
} |
|
68 |
return sum; |
|
59063
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
69 |
} |
54119 | 70 |
|
59063
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
71 |
public static void main(String args[]) { |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
72 |
int sum = test_loop(3); |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
73 |
System.out.println("sum: " + sum); |
058d299b22b6
8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay
iignatyev
parents:
54119
diff
changeset
|
74 |
} |
54119 | 75 |
} |
76 |
} |