Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java
41152 views
1
/*
2
* Copyright (c) 2019, 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
/*
25
* @test
26
* @bug 8235539 8245717
27
* @summary Tests effect of -XX:+EnableJVMCIProduct on EnableJVMCI and UseJVMCICompiler
28
* @requires vm.flagless
29
* @requires vm.jvmci
30
* @library /test/lib
31
* @run driver TestEnableJVMCIProduct
32
*/
33
34
import jdk.test.lib.process.ProcessTools;
35
import jdk.test.lib.process.OutputAnalyzer;
36
37
public class TestEnableJVMCIProduct {
38
39
static class Expectation {
40
final String name;
41
final String value;
42
final String origin;
43
final String pattern;
44
Expectation(final String name, String value, String origin) {
45
this.name = name;
46
this.value = value;
47
this.origin = origin;
48
this.pattern = "bool +" + name + " += " + value + " +\\{JVMCI product\\} \\{" + origin + "\\}";
49
}
50
}
51
52
public static void main(String[] args) throws Exception {
53
// Test EnableJVMCIProduct without any other explicit JVMCI option
54
test("-XX:-PrintWarnings",
55
new Expectation("EnableJVMCI", "true", "default"),
56
new Expectation("UseJVMCICompiler", "true", "default"));
57
test("-XX:+UseJVMCICompiler",
58
new Expectation("EnableJVMCI", "true", "default"),
59
new Expectation("UseJVMCICompiler", "true", "command line"));
60
test("-XX:-UseJVMCICompiler",
61
new Expectation("EnableJVMCI", "true", "default"),
62
new Expectation("UseJVMCICompiler", "false", "command line"));
63
test("-XX:+EnableJVMCI",
64
new Expectation("EnableJVMCI", "true", "command line"),
65
new Expectation("UseJVMCICompiler", "true", "default"));
66
test("-XX:-EnableJVMCI",
67
new Expectation("EnableJVMCI", "false", "command line"),
68
new Expectation("UseJVMCICompiler", "false", "default"));
69
test("-XX:+EnableJVMCIProduct",
70
new Expectation("EnableJVMCIProduct", "true", "command line"),
71
new Expectation("EnableJVMCI", "true", "default"),
72
new Expectation("UseJVMCICompiler", "true", "default"));
73
}
74
75
static void test(String explicitFlag, Expectation... expectations) throws Exception {
76
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
77
"-XX:+UnlockExperimentalVMOptions", "-XX:+EnableJVMCIProduct", "-XX:-UnlockExperimentalVMOptions",
78
explicitFlag,
79
"-XX:+PrintFlagsFinal", "-version");
80
OutputAnalyzer output = new OutputAnalyzer(pb.start());
81
for (Expectation expectation : expectations) {
82
output.stdoutShouldMatch(expectation.pattern);
83
}
84
if (output.getExitValue() != 0) {
85
// This should only happen when JVMCI compilation is requested and the VM has no
86
// JVMCI compiler (e.g. Graal is not included in the build)
87
output.stdoutShouldMatch("No JVMCI compiler found");
88
}
89
}
90
}
91
92