Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a -XX:+UseGraalJIT VM flag #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/hotspot/share/jvmci/jvmci_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class fileStream;
product(bool, EnableJVMCI, false, EXPERIMENTAL, \
"Enable JVMCI") \
\
product(bool, UseGraalJIT, false, \
"Select the Graal JVMCI compiler. This is a macro for: " \
" -XX:+UnlockExperimentalVMOptions " \
" -XX:+EnableJVMCIProduct " \
" -XX:+UseJVMCICompiler " \
" -Djvmci.Compiler=graal " \
" -XX:-UnlockExperimentalVMOptions") \
\
product(bool, EnableJVMCIProduct, false, EXPERIMENTAL, \
"Allow JVMCI to be used in product mode. This alters a subset of "\
"JVMCI flags to be non-experimental, defaults UseJVMCICompiler " \
Expand Down
27 changes: 26 additions & 1 deletion src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2827,10 +2827,35 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
return JNI_ERR;
#endif // INCLUDE_MANAGEMENT
#if INCLUDE_JVMCI
} else if (match_option(option, "-XX:-UseGraalJIT")) {
FLAG_SET_CMDLINE(UseJVMCICompiler, false);
} else if (match_option(option, "-XX:+UseGraalJIT")) {
if (!EnableJVMCIProduct) {
bool save = UnlockExperimentalVMOptions;
bool ok = JVMCIGlobals::enable_jvmci_product_mode(origin);
UnlockExperimentalVMOptions = save;
if (!ok) {
jio_fprintf(defaultStream::error_stream(),
"Unable to enable JVMCI in product mode");
return JNI_ERR;
}
}

const char* jvmci_compiler = get_property("jvmci.Compiler");
if (jvmci_compiler != nullptr) {
if (strcmp(jvmci_compiler, "graal") != 0) {
jio_fprintf(defaultStream::error_stream(),
"Value of jvmci.Compiler incompatible with +UseGraalJIT: %s", jvmci_compiler);
return JNI_ERR;
}
} else if (!add_property("jvmci.Compiler=graal")) {
return JNI_ENOMEM;
}
FLAG_SET_CMDLINE(UseJVMCICompiler, true);
} else if (match_option(option, "-XX:-EnableJVMCIProduct")) {
if (EnableJVMCIProduct) {
jio_fprintf(defaultStream::error_stream(),
"-XX:-EnableJVMCIProduct cannot come after -XX:+EnableJVMCIProduct\n");
"-XX:-EnableJVMCIProduct cannot come after -XX:+EnableJVMCIProduct or -XX:+UseGraalJIT\n");
return JNI_EINVAL;
}
} else if (match_option(option, "-XX:+EnableJVMCIProduct")) {
Expand Down