Skip to content

Commit b010fdc

Browse files
toddjonkerVictor Rudometov
authored andcommitted
8340398: [JVMCI] Unintuitive behavior of UseJVMCICompiler option
Backport-of: 4cd8c75a55163be33917b1fba9f360ea816f3aa9
1 parent c62b0a5 commit b010fdc

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
@@ -79,6 +79,15 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
7979
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
8080

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

src/hotspot/share/jvmci/jvmci_globals.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class fileStream;
144144
product(bool, UseJVMCINativeLibrary, false, EXPERIMENTAL, \
145145
"Execute JVMCI Java code from a shared library (\"libjvmci\") " \
146146
"instead of loading it from class files and executing it " \
147-
"on the HotSpot heap. Defaults to true if EnableJVMCIProduct is " \
147+
"on the HotSpot heap. Defaults to true if EnableJVMCI is " \
148148
"true and a JVMCI native library is available.") \
149149
\
150150
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)