Skip to content

Commit 5cf594f

Browse files
committed
use FLAG_SET_ERGO
1 parent 3c5ff54 commit 5cf594f

File tree

7 files changed

+29
-15
lines changed

7 files changed

+29
-15
lines changed

src/hotspot/share/runtime/arguments.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,12 +2255,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin
22552255
char after = *(jvmci_module + strlen("jdk.internal.vm.ci"));
22562256
if ((before == '=' || before == ',') && (after == '\0' || after == ',')) {
22572257
if (!_jvmci_module_added) {
2258-
bool valid = process_argument("+EnableJVMCI", args->ignoreUnrecognized, origin);
2259-
if (!valid) {
2260-
jio_fprintf(defaultStream::error_stream(),
2261-
"'EnableJVMCI' implied by jdk.internal.vm.ci module in '%s'\n", option->optionString);
2262-
return JNI_EINVAL;
2263-
}
2258+
FLAG_SET_ERGO(EnableJVMCI, true);
22642259
PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true",
22652260
AddProperty, UnwriteableProperty, InternalProperty);
22662261
_jvmci_module_added = true;

test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,54 @@ public static void main(String[] args) throws Exception {
6464
.collect(Collectors.joining(",")));
6565
return;
6666
}
67+
68+
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
69+
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseJVMCICompiler",
70+
"-XX:+PrintFlagsFinal", "--version");
71+
OutputAnalyzer output = new OutputAnalyzer(pb.start());
72+
useJVMCINativeLibrary = output.firstMatch("bool +UseJVMCINativeLibrary += true") != null;
73+
String originOfEnableJVMCI = useJVMCINativeLibrary ? "default" : "command line";
74+
6775
// Test EnableJVMCIProduct without any other explicit JVMCI option
6876
test("-XX:-PrintWarnings",
69-
new Expectation("EnableJVMCI", "true", "default"),
77+
new Expectation("EnableJVMCI", "true", originOfEnableJVMCI),
7078
new Expectation("UseJVMCICompiler", "true", "default"));
7179
test("-XX:+UseJVMCICompiler",
72-
new Expectation("EnableJVMCI", "true", "default"),
80+
new Expectation("EnableJVMCI", "true", originOfEnableJVMCI),
7381
new Expectation("UseJVMCICompiler", "true", "command line"));
7482
test("-XX:-UseJVMCICompiler",
75-
new Expectation("EnableJVMCI", "true", "default"),
83+
new Expectation("EnableJVMCI", "true", originOfEnableJVMCI),
7684
new Expectation("UseJVMCICompiler", "false", "command line"));
7785
test("-XX:+EnableJVMCI",
78-
new Expectation("EnableJVMCI", "true", "command line"),
86+
new Expectation("EnableJVMCI", "true", originOfEnableJVMCI),
7987
new Expectation("UseJVMCICompiler", "true", "default"));
8088
test("-XX:-EnableJVMCI",
8189
new Expectation("EnableJVMCI", "false", "command line"),
8290
new Expectation("UseJVMCICompiler", "false", "default"));
8391
test("-XX:+EnableJVMCIProduct",
8492
new Expectation("EnableJVMCIProduct", "true", "(?:command line|jimage)"),
85-
new Expectation("EnableJVMCI", "true", "default"),
93+
new Expectation("EnableJVMCI", "true", originOfEnableJVMCI),
8694
new Expectation("UseJVMCICompiler", "true", "default"));
8795
}
8896

8997
static int id;
9098

99+
private static boolean useJVMCINativeLibrary = false;
100+
91101
static void test(String explicitFlag, Expectation... expectations) throws Exception {
92102
String[] flags = {"-XX:+EnableJVMCIProduct", "-XX:+UseGraalJIT"};
93103
String cwd = System.getProperty("user.dir");
104+
105+
// If libjvmci is not in use, then the JVMCI module must be explicitly
106+
// added with --add-modules=jdk.internal.vm.ci
107+
String addJVMCIModule = useJVMCINativeLibrary ?
108+
"--add-modules=java.base" : // effectively a nop
109+
"--add-modules=jdk.internal.vm.ci";
110+
94111
for (String flag : flags) {
95112
Path propsPath = Path.of("props." + id++);
96113
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
97-
"-XX:+UnlockExperimentalVMOptions", flag, "-XX:-UnlockExperimentalVMOptions",
114+
"-XX:+UnlockExperimentalVMOptions", addJVMCIModule, flag, "-XX:-UnlockExperimentalVMOptions",
98115
explicitFlag,
99116
"-XX:+PrintFlagsFinal",
100117
"--class-path=" + System.getProperty("java.class.path"),

test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static void main(String[] args) throws Exception {
4141
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
4242
"-XX:+UnlockExperimentalVMOptions",
4343
"-XX:+EagerJVMCI",
44+
"--add-modules=jdk.internal.vm.ci",
4445
"-XX:+UseJVMCICompiler",
4546
"-Djvmci.XXXXXXXXX=true");
4647
OutputAnalyzer output = new OutputAnalyzer(pb.start());

test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static void main(String[] args) throws Exception {
4444
static void test(String enableFlag) throws Exception {
4545
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
4646
"-XX:+UnlockExperimentalVMOptions",
47+
"--add-modules=jdk.internal.vm.ci",
4748
enableFlag, "-Djvmci.Compiler=null",
4849
"-XX:+JVMCIPrintProperties");
4950
OutputAnalyzer output = new OutputAnalyzer(pb.start());

test/hotspot/jtreg/compiler/jvmci/TestJVMCISavedProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void main(String[] args) throws Exception {
4848
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
4949
"-XX:+UnlockExperimentalVMOptions",
5050
"-XX:+EagerJVMCI",
51-
"-XX:+EnableJVMCI",
51+
"--add-modules=jdk.internal.vm.ci",
5252
"-Ddebug.jvmci.PrintSavedProperties=true",
5353
"-Dapp1.propX=true",
5454
"-Dapp2.propY=SomeStringValue",

test/hotspot/jtreg/compiler/jvmci/TestValidateModules.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class TestValidateModules {
3737
public static void main(String... args) throws Exception {
3838
ProcessTools.executeTestJava("-XX:+UnlockExperimentalVMOptions",
39-
"-XX:+EnableJVMCI",
39+
"--add-modules=jdk.internal.vm.ci",
4040
"--validate-modules",
4141
"--list-modules")
4242
.outputTo(System.out)

test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetFlagValueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static void main(String[] args) throws Exception {
6565

6666
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
6767
"-XX:+UnlockExperimentalVMOptions",
68-
"-XX:+EnableJVMCI",
68+
"--add-modules=jdk.internal.vm.ci",
6969
"-XX:+PrintFlagsFinal",
7070
"-version");
7171
out = new OutputAnalyzer(pb.start());

0 commit comments

Comments
 (0)