author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2574 | 1 |
/* |
43467 | 2 |
* Copyright (c) 2009, 2017, 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. |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
29 |
* @library /test/lib / |
36851 | 30 |
* @modules java.base/jdk.internal.misc |
29678
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 |
43467 | 33 |
* jdk.internal.jvmstat/sun.jvmstat.monitor |
40059 | 34 |
* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
35 |
* @build sun.hotspot.WhiteBox |
40059 | 36 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
37 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
38 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
40059 | 39 |
* -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack |
40 |
* -XX:CompileCommand=compileonly,compiler.c2.cr6589834.InlinedArrayCloneTestCase::* |
|
41 |
* -XX:CompileCommand=dontinline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::invokeArrayClone |
|
42 |
* -XX:CompileCommand=inline,compiler.c2.cr6589834.InlinedArrayCloneTestCase::verifyArguments |
|
43 |
* compiler.c2.cr6589834.Test_ia32 |
|
2574 | 44 |
*/ |
45 |
||
40059 | 46 |
package compiler.c2.cr6589834; |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
47 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
48 |
import jdk.test.lib.Asserts; |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
49 |
import sun.hotspot.WhiteBox; |
2574 | 50 |
|
40059 | 51 |
import java.lang.reflect.Method; |
52 |
||
2574 | 53 |
public class Test_ia32 { |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
54 |
private static final int NUM_THREADS |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
55 |
= Math.min(100, 2 * Runtime.getRuntime().availableProcessors()); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
56 |
private static final int CLONE_LENGTH = 1000; |
2574 | 57 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
58 |
private static WhiteBox wb = WhiteBox.getWhiteBox(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
59 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
60 |
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
|
61 |
private volatile boolean doSpin = true; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
62 |
private volatile boolean testFailed = false; |
2574 | 63 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
64 |
public boolean continueExecution() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
65 |
return doSpin; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
66 |
} |
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 |
public void stopExecution() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
69 |
doSpin = false; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
70 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
71 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
72 |
public boolean isTestFailed() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
73 |
return testFailed; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
74 |
} |
2574 | 75 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
76 |
public void setTestFailed() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
77 |
this.testFailed = true; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
78 |
stopExecution(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
79 |
} |
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 |
public LoadedClass[] getArray() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
82 |
return ARRAY; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
83 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
84 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
85 |
public void runTest() { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
86 |
Thread[] threads = new Thread[Test_ia32.NUM_THREADS]; |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
87 |
Method method; |
2574 | 88 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
89 |
try { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
90 |
method = InlinedArrayCloneTestCase.class.getDeclaredMethod( |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
91 |
"invokeArrayClone", LoadedClass[].class); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
92 |
} catch (NoSuchMethodException e) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
93 |
throw new Error("Tested method not found", e); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
94 |
} |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
95 |
|
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
96 |
Asserts.assertTrue(wb.isMethodCompilable(method), |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
97 |
"Method " + method.getName() + " should be compilable."); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
98 |
|
2574 | 99 |
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
|
100 |
threads[i] = new Thread(new InlinedArrayCloneTestCase(this)); |
2574 | 101 |
threads[i].start(); |
102 |
} |
|
103 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
104 |
/* |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
105 |
* Wait until InlinedArrayCloneTestCase::invokeArrayClone is compiled. |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
106 |
*/ |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
107 |
while (!wb.isMethodCompiled(method)) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
108 |
Thread.yield(); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
109 |
} |
2574 | 110 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
111 |
/* |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
112 |
* Load NotLoadedClass to cause deoptimization of |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
113 |
* InlinedArrayCloneTestCase::invokeArrayClone due to invalidated |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
114 |
* dependency. |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
115 |
*/ |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
116 |
try { |
40059 | 117 |
Class.forName(Test_ia32.class.getPackage().getName() + ".NotLoadedClass"); |
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
118 |
} catch (ClassNotFoundException e) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
119 |
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
|
120 |
+ "CHA-dependency for method " + method.getName(), e); |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
121 |
} |
2574 | 122 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
123 |
stopExecution(); |
2574 | 124 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
125 |
for (Thread thread : threads) { |
2574 | 126 |
try { |
127 |
thread.join(); |
|
128 |
} catch (InterruptedException e) { |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
129 |
throw new Error("Fail to join thread " + thread, e); |
2574 | 130 |
} |
131 |
} |
|
132 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
133 |
Asserts.assertFalse(isTestFailed(), "Test failed."); |
2574 | 134 |
} |
135 |
||
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
136 |
public static void main(String[] args) { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
137 |
new Test_ia32().runTest(); |
2574 | 138 |
} |
25734
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 |
class LoadedClass { |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
142 |
} |
2574 | 143 |
|
25734
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
144 |
@SuppressWarnings("unused") |
3f3faa33a4fa
6848902: [TESTBUG] The compiler/6589834/Test_ia32.java timed out
fzhinkin
parents:
22234
diff
changeset
|
145 |
class NotLoadedClass extends LoadedClass { |
2574 | 146 |
} |