Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/debug/TestStressIGVNAndCCP.java
41149 views
1
/*
2
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. 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
package compiler.debug;
25
26
import jdk.test.lib.process.OutputAnalyzer;
27
import jdk.test.lib.process.ProcessTools;
28
import jdk.test.lib.Asserts;
29
30
/*
31
* @test
32
* @bug 8252219 8256535
33
* @requires vm.debug == true & vm.compiler2.enabled
34
* @summary Tests that stress compilations with the same seed yield the same
35
* IGVN and CCP traces.
36
* @library /test/lib /
37
* @run driver compiler.debug.TestStressIGVNAndCCP
38
*/
39
40
public class TestStressIGVNAndCCP {
41
42
static String phaseTrace(String stressOption, String traceOption,
43
int stressSeed) throws Exception {
44
String className = TestStressIGVNAndCCP.class.getName();
45
String[] procArgs = {
46
"-Xcomp", "-XX:-TieredCompilation", "-XX:-Inline",
47
"-XX:CompileOnly=" + className + "::sum", "-XX:+" + traceOption,
48
"-XX:+" + stressOption, "-XX:StressSeed=" + stressSeed,
49
className, "10"};
50
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
51
OutputAnalyzer out = new OutputAnalyzer(pb.start());
52
out.shouldHaveExitValue(0);
53
return out.getStdout();
54
}
55
56
static String igvnTrace(int stressSeed) throws Exception {
57
return phaseTrace("StressIGVN", "TraceIterativeGVN", stressSeed);
58
}
59
60
static String ccpTrace(int stressSeed) throws Exception {
61
return phaseTrace("StressCCP", "TracePhaseCCP", stressSeed);
62
}
63
64
static void sum(int n) {
65
int acc = 0;
66
for (int i = 0; i < n; i++) acc += i;
67
System.out.println(acc);
68
}
69
70
public static void main(String[] args) throws Exception {
71
if (args.length == 0) {
72
for (int s = 0; s < 10; s++) {
73
Asserts.assertEQ(igvnTrace(s), igvnTrace(s),
74
"got different IGVN traces for the same seed");
75
Asserts.assertEQ(ccpTrace(s), ccpTrace(s),
76
"got different CCP traces for the same seed");
77
}
78
} else if (args.length > 0) {
79
sum(Integer.parseInt(args[0]));
80
}
81
}
82
}
83
84