8232118: Add JVM option to enable JVMCI compilers in product mode
Reviewed-by: kvn, dholmes
This commit is contained in:
parent
f906a432e9
commit
25d6a33eb5
@ -57,6 +57,7 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
|
||||
|
||||
JVMCI_FLAG_CHECKED(UseJVMCICompiler)
|
||||
JVMCI_FLAG_CHECKED(EnableJVMCI)
|
||||
JVMCI_FLAG_CHECKED(EnableJVMCIProduct)
|
||||
|
||||
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
|
||||
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
|
||||
@ -64,6 +65,14 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
|
||||
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
|
||||
|
||||
if (UseJVMCICompiler) {
|
||||
if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
|
||||
char path[JVM_MAXPATHLEN];
|
||||
if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), JVMCI_SHARED_LIBRARY_NAME)) {
|
||||
// If a JVMCI native library is present,
|
||||
// we enable UseJVMCINativeLibrary by default.
|
||||
FLAG_SET_DEFAULT(UseJVMCINativeLibrary, true);
|
||||
}
|
||||
}
|
||||
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
|
||||
@ -122,6 +131,47 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Convert JVMCI flags from experimental to product
|
||||
bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlag::Flags origin) {
|
||||
const char *JVMCIFlags[] = {
|
||||
"EnableJVMCI",
|
||||
"EnableJVMCIProduct",
|
||||
"UseJVMCICompiler",
|
||||
"JVMCIPrintProperties",
|
||||
"EagerJVMCI",
|
||||
"JVMCIThreads",
|
||||
"JVMCICounterSize",
|
||||
"JVMCICountersExcludeCompiler",
|
||||
"JVMCINMethodSizeLimit",
|
||||
"JVMCILibPath",
|
||||
"JVMCILibDumpJNIConfig",
|
||||
"UseJVMCINativeLibrary",
|
||||
NULL
|
||||
};
|
||||
|
||||
for (int i = 0; JVMCIFlags[i] != NULL; i++) {
|
||||
JVMFlag *jvmciFlag = (JVMFlag *)JVMFlag::find_declared_flag(JVMCIFlags[i]);
|
||||
if (jvmciFlag == NULL) {
|
||||
return false;
|
||||
}
|
||||
jvmciFlag->clear_experimental();
|
||||
jvmciFlag->set_product();
|
||||
}
|
||||
|
||||
bool value = true;
|
||||
JVMFlag *jvmciEnableFlag = JVMFlag::find_flag("EnableJVMCIProduct");
|
||||
if (JVMFlag::boolAtPut(jvmciEnableFlag, &value, origin) != JVMFlag::SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
value = true;
|
||||
JVMFlag *jvmciCompilerFlag = JVMFlag::find_flag("UseJVMCICompiler");
|
||||
if (JVMFlag::boolAtPut(jvmciCompilerFlag, &value, origin) != JVMFlag::SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void JVMCIGlobals::check_jvmci_supported_gc() {
|
||||
if (EnableJVMCI) {
|
||||
// Check if selected GC is supported by JVMCI and Java compiler
|
||||
|
@ -25,6 +25,8 @@
|
||||
#ifndef SHARE_JVMCI_JVMCI_GLOBALS_HPP
|
||||
#define SHARE_JVMCI_JVMCI_GLOBALS_HPP
|
||||
|
||||
#include "runtime/flags/jvmFlag.hpp"
|
||||
|
||||
class fileStream;
|
||||
|
||||
//
|
||||
@ -46,6 +48,9 @@ class fileStream;
|
||||
experimental(bool, EnableJVMCI, false, \
|
||||
"Enable JVMCI") \
|
||||
\
|
||||
experimental(bool, EnableJVMCIProduct, false, \
|
||||
"Allow JVMCI to be used in product mode") \
|
||||
\
|
||||
experimental(bool, UseJVMCICompiler, false, \
|
||||
"Use JVMCI as the default compiler") \
|
||||
\
|
||||
@ -142,6 +147,9 @@ class JVMCIGlobals {
|
||||
// returning false.
|
||||
static bool check_jvmci_flags_are_consistent();
|
||||
|
||||
// Convert JVMCI experimental flags to product
|
||||
static bool enable_jvmci_product_mode(JVMFlag::Flags);
|
||||
|
||||
// Check and exit VM with error if selected GC is not supported by JVMCI.
|
||||
static void check_jvmci_supported_gc();
|
||||
|
||||
|
@ -2959,6 +2959,22 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
"ManagementServer is not supported in this VM.\n");
|
||||
return JNI_ERR;
|
||||
#endif // INCLUDE_MANAGEMENT
|
||||
#if INCLUDE_JVMCI
|
||||
} else if (match_option(option, "-XX:+EnableJVMCIProduct")) {
|
||||
JVMFlag *jvmciFlag = JVMFlag::find_flag("EnableJVMCIProduct");
|
||||
// Allow this flag if it has been unlocked.
|
||||
if (jvmciFlag != NULL && jvmciFlag->is_unlocked()) {
|
||||
if (!JVMCIGlobals::enable_jvmci_product_mode(origin)) {
|
||||
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)) {
|
||||
return JNI_EINVAL;
|
||||
}
|
||||
#endif // INCLUDE_JVMCI
|
||||
#if INCLUDE_JFR
|
||||
} else if (match_jfr_option(&option)) {
|
||||
return JNI_EINVAL;
|
||||
|
@ -359,6 +359,18 @@ void JVMFlag::clear_diagnostic() {
|
||||
assert(!is_diagnostic(), "sanity");
|
||||
}
|
||||
|
||||
void JVMFlag::clear_experimental() {
|
||||
assert(is_experimental(), "sanity");
|
||||
_flags = Flags(_flags & ~KIND_EXPERIMENTAL);
|
||||
assert(!is_experimental(), "sanity");
|
||||
}
|
||||
|
||||
void JVMFlag::set_product() {
|
||||
assert(!is_product(), "sanity");
|
||||
_flags = Flags(_flags | KIND_PRODUCT);
|
||||
assert(is_product(), "sanity");
|
||||
}
|
||||
|
||||
// Get custom message for this locked flag, or NULL if
|
||||
// none is available. Returns message type produced.
|
||||
JVMFlag::MsgType JVMFlag::get_locked_message(char* buf, int buflen) const {
|
||||
|
@ -207,6 +207,8 @@ public:
|
||||
bool is_external() const;
|
||||
|
||||
void clear_diagnostic();
|
||||
void clear_experimental();
|
||||
void set_product();
|
||||
|
||||
JVMFlag::MsgType get_locked_message(char*, int) const;
|
||||
JVMFlag::MsgType get_locked_message_ext(char*, int) const;
|
||||
|
Loading…
Reference in New Issue
Block a user