author | jiangli |
Fri, 02 Nov 2018 19:30:31 -0400 | |
changeset 52397 | 1322829d1501 |
parent 48791 | 6e079ff6c83c |
permissions | -rw-r--r-- |
47551
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
1 |
/* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
4 |
* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
8 |
* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
13 |
* accompanied this code). |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
14 |
* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
18 |
* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
21 |
* questions. |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
22 |
*/ |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
23 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
24 |
/* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
25 |
* @test |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
26 |
* @library /test/lib |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
27 |
* @modules java.base/jdk.internal.misc:+open |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
28 |
* @build sun.hotspot.WhiteBox |
48791
6e079ff6c83c
8186635: ClassFileInstaller should be run as a driver
iignatyev
parents:
48386
diff
changeset
|
29 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
48386
ed1bb7743b3e
8193363: TestDumpReplay.java fails with product builds
thartmann
parents:
47551
diff
changeset
|
30 |
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions |
ed1bb7743b3e
8193363: TestDumpReplay.java fails with product builds
thartmann
parents:
47551
diff
changeset
|
31 |
* -Xbootclasspath/a:. -XX:+WhiteBoxAPI |
47551
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
32 |
* -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
33 |
* -XX:CompileCommand=compileonly,compiler.ciReplay.TestDumpReplay::* |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
34 |
* compiler.ciReplay.TestDumpReplay |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
35 |
*/ |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
36 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
37 |
package compiler.ciReplay; |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
38 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
39 |
import sun.hotspot.WhiteBox; |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
40 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
41 |
public class TestDumpReplay { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
42 |
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
43 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
44 |
private static final String emptyString; |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
45 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
46 |
static { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
47 |
emptyString = ""; |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
48 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
49 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
50 |
public static void m1() { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
51 |
m2(); |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
52 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
53 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
54 |
public static void m2() { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
55 |
m3(); |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
56 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
57 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
58 |
public static void m3() { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
59 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
60 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
61 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
62 |
public static void main(String[] args) { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
63 |
// Add compiler control directive to force generation of replay file |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
64 |
String directive = "[{ match: \"*.*\", DumpReplay: true }]"; |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
65 |
if (WHITE_BOX.addCompilerDirective(directive) != 1) { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
66 |
throw new RuntimeException("Failed to add compiler directive"); |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
67 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
68 |
|
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
69 |
// Trigger compilation of m1 |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
70 |
for (int i = 0; i < 10_000; ++i) { |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
71 |
m1(); |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
72 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
73 |
} |
4d034d861e13
8187780: VM crashes while generating replay compilation file
thartmann
parents:
diff
changeset
|
74 |
} |