Skip to content

Commit c326ff1

Browse files
toddjonkerPaul Hohensee
authored andcommitted
8340398: [JVMCI] Unintuitive behavior of UseJVMCICompiler option
Backport-of: 4cd8c75
1 parent dd1741c commit c326ff1

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/hotspot/share/jvmci/jvmci_globals.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
8080
CHECK_NOT_SET(LibJVMCICompilerThreadHidden, UseJVMCICompiler)
8181

8282
if (UseJVMCICompiler) {
83+
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
84+
jio_fprintf(defaultStream::error_stream(),
85+
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
86+
return false;
87+
}
88+
FLAG_SET_DEFAULT(EnableJVMCI, true);
89+
}
90+
91+
if (EnableJVMCI) {
8392
if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
8493
char path[JVM_MAXPATHLEN];
8594
if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), JVMCI_SHARED_LIBRARY_NAME)) {
@@ -88,12 +97,9 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
8897
FLAG_SET_DEFAULT(UseJVMCINativeLibrary, true);
8998
}
9099
}
91-
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
92-
jio_fprintf(defaultStream::error_stream(),
93-
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
94-
return false;
95-
}
96-
FLAG_SET_DEFAULT(EnableJVMCI, true);
100+
}
101+
102+
if (UseJVMCICompiler) {
97103
if (BootstrapJVMCI && UseJVMCINativeLibrary) {
98104
jio_fprintf(defaultStream::error_stream(), "-XX:+BootstrapJVMCI is not compatible with -XX:+UseJVMCINativeLibrary\n");
99105
return false;

src/hotspot/share/jvmci/jvmci_globals.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class fileStream;
140140
product(bool, UseJVMCINativeLibrary, false, EXPERIMENTAL, \
141141
"Execute JVMCI Java code from a shared library (\"libjvmci\") " \
142142
"instead of loading it from class files and executing it " \
143-
"on the HotSpot heap. Defaults to true if EnableJVMCIProduct is " \
143+
"on the HotSpot heap. Defaults to true if EnableJVMCI is " \
144144
"true and a JVMCI native library is available.") \
145145
\
146146
product(double, JVMCINativeLibraryThreadFraction, 0.33, EXPERIMENTAL, \

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ static JVMCICompilerFactory getCompilerFactory(HotSpotJVMCIRuntime runtime) {
104104
}
105105
}
106106
if (factory == null) {
107+
String reason;
107108
if (Services.IS_IN_NATIVE_IMAGE) {
108-
throw runtime.exitHotSpotWithMessage(1, "JVMCI compiler '%s' not found in JVMCI native library.%n" +
109+
reason = String.format("JVMCI compiler '%s' not found in JVMCI native library.%n" +
109110
"Use -XX:-UseJVMCINativeLibrary when specifying a JVMCI compiler available on a class path with %s.%n",
110111
compilerName, compPropertyName);
112+
} else {
113+
reason = String.format("JVMCI compiler '%s' specified by %s not found%n", compilerName, compPropertyName);
111114
}
112-
throw runtime.exitHotSpotWithMessage(1, "JVMCI compiler '%s' specified by %s not found%n", compilerName, compPropertyName);
115+
factory = new DummyCompilerFactory(reason, runtime);
113116
}
114117
}
115118
} else {

0 commit comments

Comments
 (0)