author | cjplummer |
Thu, 29 Oct 2015 12:04:04 -0700 | |
changeset 33730 | 30e064828045 |
parent 30604 | b8d532cb6420 |
child 36851 | 03e2f4d0a421 |
permissions | -rw-r--r-- |
2574 | 1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28190
diff
changeset
|
2 |
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
2574 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
21 |
* questions. |
2574 | 22 |
*/ |
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 6589834 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
27 |
* @summary Safepoint placed between stack pointer increment and decrement leads |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
28 |
* to interpreter's stack corruption after deoptimization. |
33730
30e064828045
8140189: [TESTBUG] Get rid of "@library /../../test/lib" in jtreg tests
cjplummer
parents:
30604
diff
changeset
|
29 |
* @library /testlibrary /test/lib |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28190
diff
changeset
|
30 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28190
diff
changeset
|
31 |
* java.compiler |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28190
diff
changeset
|
32 |
* java.management |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28190
diff
changeset
|
33 |
* jdk.jvmstat/sun.jvmstat.monitor |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
34 |
* @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.* |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
35 |
* Test_ia32 InlinedArrayCloneTestCase |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
36 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
37 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
38 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
39 |
* -XX:+WhiteBoxAPI -XX:CompileOnly=InlinedArrayCloneTestCase |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
40 |
* -XX:CompileCommand=dontinline,InlinedArrayCloneTestCase.invokeArrayClone |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
41 |
* -XX:CompileCommand=inline,InlinedArrayCloneTestCase.verifyArguments |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
42 |
* -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack Test_ia32 |
2574 | 43 |
*/ |
44 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
45 |
import java.lang.reflect.Method; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
46 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
47 |
import jdk.test.lib.Asserts; |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
48 |
import sun.hotspot.WhiteBox; |
2574 | 49 |
|
50 |
public class Test_ia32 { |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
51 |
private static final int NUM_THREADS |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
52 |
= Math.min(100, 2 * Runtime.getRuntime().availableProcessors()); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
53 |
private static final int CLONE_LENGTH = 1000; |
2574 | 54 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
55 |
private static WhiteBox wb = WhiteBox.getWhiteBox(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
56 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
57 |
private final LoadedClass[] ARRAY = new LoadedClass[Test_ia32.CLONE_LENGTH]; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
58 |
private volatile boolean doSpin = true; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
59 |
private volatile boolean testFailed = false; |
2574 | 60 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
61 |
public boolean continueExecution() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
62 |
return doSpin; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
63 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
64 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
65 |
public void stopExecution() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
66 |
doSpin = false; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
67 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
68 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
69 |
public boolean isTestFailed() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
70 |
return testFailed; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
71 |
} |
2574 | 72 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
73 |
public void setTestFailed() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
74 |
this.testFailed = true; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
75 |
stopExecution(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
76 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
77 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
78 |
public LoadedClass[] getArray() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
79 |
return ARRAY; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
80 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
81 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
82 |
public void runTest() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
83 |
Thread[] threads = new Thread[Test_ia32.NUM_THREADS]; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
84 |
Method method; |
2574 | 85 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
86 |
try { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
87 |
method = InlinedArrayCloneTestCase.class.getDeclaredMethod( |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
88 |
"invokeArrayClone", LoadedClass[].class); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
89 |
} catch (NoSuchMethodException e) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
90 |
throw new Error("Tested method not found", e); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
91 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
92 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
93 |
Asserts.assertTrue(wb.isMethodCompilable(method), |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
94 |
"Method " + method.getName() + " should be compilable."); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
95 |
|
2574 | 96 |
for (int i = 0; i < threads.length; i++) { |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
97 |
threads[i] = new Thread(new InlinedArrayCloneTestCase(this)); |
2574 | 98 |
threads[i].start(); |
99 |
} |
|
100 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
101 |
/* |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
102 |
* Wait until InlinedArrayCloneTestCase::invokeArrayClone is compiled. |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
103 |
*/ |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
104 |
while (!wb.isMethodCompiled(method)) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
105 |
Thread.yield(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
106 |
} |
2574 | 107 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
108 |
/* |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
109 |
* Load NotLoadedClass to cause deoptimization of |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
110 |
* InlinedArrayCloneTestCase::invokeArrayClone due to invalidated |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
111 |
* dependency. |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
112 |
*/ |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
113 |
try { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
114 |
Class.forName("NotLoadedClass"); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
115 |
} catch (ClassNotFoundException e) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
116 |
throw new Error("Unable to load class that invalidates " |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
117 |
+ "CHA-dependency for method " + method.getName(), e); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
118 |
} |
2574 | 119 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
120 |
stopExecution(); |
2574 | 121 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
122 |
for (Thread thread : threads) { |
2574 | 123 |
try { |
124 |
thread.join(); |
|
125 |
} catch (InterruptedException e) { |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
126 |
throw new Error("Fail to join thread " + thread, e); |
2574 | 127 |
} |
128 |
} |
|
129 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
130 |
Asserts.assertFalse(isTestFailed(), "Test failed."); |
2574 | 131 |
} |
132 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
133 |
public static void main(String[] args) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
134 |
new Test_ia32().runTest(); |
2574 | 135 |
} |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
136 |
} |
2574 | 137 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
138 |
class LoadedClass { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
139 |
} |
2574 | 140 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
141 |
@SuppressWarnings("unused") |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
142 |
class NotLoadedClass extends LoadedClass { |
2574 | 143 |
} |