mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 09:04:41 +02:00
8309136: [JVMCI] add -XX:+UseGraalJIT flag
Reviewed-by: dholmes, kvn
This commit is contained in:
parent
98b53c06cf
commit
b3c9d6785e
5 changed files with 66 additions and 23 deletions
|
@ -2827,28 +2827,42 @@ 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:-EnableJVMCIProduct")) {
|
||||
} else if (match_option(option, "-XX:-EnableJVMCIProduct") || match_option(option, "-XX:-UseGraalJIT")) {
|
||||
if (EnableJVMCIProduct) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"-XX:-EnableJVMCIProduct cannot come after -XX:+EnableJVMCIProduct\n");
|
||||
"-XX:-EnableJVMCIProduct or -XX:-UseGraalJIT cannot come after -XX:+EnableJVMCIProduct or -XX:+UseGraalJIT\n");
|
||||
return JNI_EINVAL;
|
||||
}
|
||||
} else if (match_option(option, "-XX:+EnableJVMCIProduct")) {
|
||||
// Just continue, since "-XX:+EnableJVMCIProduct" has been specified before
|
||||
} else if (match_option(option, "-XX:+EnableJVMCIProduct") || 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 (strncmp(jvmci_compiler, "graal", strlen("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;
|
||||
}
|
||||
}
|
||||
|
||||
// Just continue, since "-XX:+EnableJVMCIProduct" or "-XX:+UseGraalJIT" has been specified before
|
||||
if (EnableJVMCIProduct) {
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
// The flag was locked so process normally to report that error
|
||||
else if (!process_argument("EnableJVMCIProduct", args->ignoreUnrecognized, origin)) {
|
||||
else if (!process_argument(use_graal_jit ? "UseGraalJIT" : "EnableJVMCIProduct", args->ignoreUnrecognized, origin)) {
|
||||
return JNI_EINVAL;
|
||||
}
|
||||
#endif // INCLUDE_JVMCI
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue