Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
set UseGraalJIT value in enable_jvmci_product_mode
  • Loading branch information
dougxc committed May 31, 2023
commit 430b7a58975f49f02de0f0eeb6de5267ee461558
8 changes: 7 additions & 1 deletion src/hotspot/share/jvmci/jvmci_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
}

// Convert JVMCI flags from experimental to product
bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin) {
bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin, bool use_graal_jit) {
const char *JVMCIFlags[] = {
"EnableJVMCI",
"EnableJVMCIProduct",
Expand Down Expand Up @@ -202,6 +202,12 @@ bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin) {
if (JVMFlagAccess::set_bool(jvmciEnableFlag, &value, origin) != JVMFlag::SUCCESS) {
return false;
}
if (use_graal_jit) {
JVMFlag *useGraalJITFlag = JVMFlag::find_flag("UseGraalJIT");
if (JVMFlagAccess::set_bool(useGraalJITFlag, &value, origin) != JVMFlag::SUCCESS) {
return false;
}
}

// Effect of EnableJVMCIProduct on changing defaults of EnableJVMCI
// and UseJVMCICompiler is deferred to check_jvmci_flags_are_consistent
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/jvmci_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class JVMCIGlobals {
static bool check_jvmci_flags_are_consistent();

// Convert JVMCI experimental flags to product
static bool enable_jvmci_product_mode(JVMFlagOrigin);
static bool enable_jvmci_product_mode(JVMFlagOrigin origin, bool use_graal_jit);

// Returns true iff the GC fully supports JVMCI.
static bool gc_supports_jvmci();
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
return JNI_EINVAL;
}
} else if (match_option(option, "-XX:+EnableJVMCIProduct") || match_option(option, "-XX:+UseGraalJIT")) {
if (match_option(option, "-XX:+UseGraalJIT")) {
bool use_graal_jit = match_option(option, "-XX:+UseGraalJIT");
if (use_graal_jit) {
const char* jvmci_compiler = get_property("jvmci.Compiler");
if (jvmci_compiler != nullptr) {
if (strcmp(jvmci_compiler, "graal") != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not use strcmp - use strncmp.

Expand All @@ -2854,7 +2855,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
JVMFlag *jvmciFlag = JVMFlag::find_flag("EnableJVMCIProduct");
// Allow this flag if it has been unlocked.
if (jvmciFlag != nullptr && jvmciFlag->is_unlocked()) {
if (!JVMCIGlobals::enable_jvmci_product_mode(origin)) {
if (!JVMCIGlobals::enable_jvmci_product_mode(origin, use_graal_jit)) {
jio_fprintf(defaultStream::error_stream(),
"Unable to enable JVMCI in product mode");
return JNI_ERR;
Expand Down