This commit is contained in:
Doug Simon 2016-07-22 17:52:03 +00:00
commit 242936fe9a
6 changed files with 62 additions and 217 deletions

View File

@ -782,7 +782,7 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer,
}
last_pc_offset = pc_offset;
if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) {
if (SafepointSynchronize::do_call_back()) {
// this is a hacky way to force a safepoint check but nothing else was jumping out at me.
ThreadToNativeFromVM ttnfv(JavaThread::current());
}

View File

@ -39,212 +39,65 @@ JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
#define JVMCI_IGNORE_FLAG_FOUR_PARAM(type, name, value, doc)
#define JVMCI_IGNORE_FLAG_THREE_PARAM(type, name, doc)
// Return true if jvmci flags are consistent.
bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
if (EnableJVMCI) {
return true;
}
// "FLAG_IS_DEFAULT" fail count.
int fail_count = 0;
// Number of "FLAG_IS_DEFAULT" fails that should be skipped before code
// detect real consistency failure.
int skip_fail_count;
// EnableJVMCI flag is false here.
// If any other flag is changed, consistency check should fail.
// JVMCI_FLAGS macros added below can handle all JVMCI flags automatically.
// But it contains check for EnableJVMCI flag too, which is required to be
// skipped. This can't be handled easily!
// So the code looks for at-least two flag changes to detect consistency
// failure when EnableJVMCI flag is changed.
// Otherwise one flag change is sufficient to detect consistency failure.
// Set skip_fail_count to 0 if EnableJVMCI flag is default.
// Set skip_fail_count to 1 if EnableJVMCI flag is changed.
// This value will be used to skip fails in macro expanded code later.
if (!FLAG_IS_DEFAULT(EnableJVMCI)) {
skip_fail_count = 1;
} else {
skip_fail_count = 0;
}
#define EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(FLAG) \
if (!FLAG_IS_DEFAULT(FLAG)) { \
fail_count++; \
if (fail_count > skip_fail_count) { \
return false; \
} \
}
#define JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
#define JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
// Check consistency of diagnostic flags if UnlockDiagnosticVMOptions is true
// or not default. UnlockDiagnosticVMOptions is default true in debug builds.
if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) {
JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
}
// Check consistency of experimental flags if UnlockExperimentalVMOptions is
// true or not default.
if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) {
JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
}
#ifndef PRODUCT
#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
#define APPLY_JVMCI_FLAGS(params3, params4) \
JVMCI_FLAGS(params4, params3, params4, params3, params4, params3, params4, params4, IGNORE_RANGE, IGNORE_CONSTRAINT, IGNORE_WRITEABLE)
#define JVMCI_DECLARE_CHECK4(type, name, value, doc) bool name##checked = false;
#define JVMCI_DECLARE_CHECK3(type, name, doc) bool name##checked = false;
#define JVMCI_FLAG_CHECKED(name) name##checked = true;
APPLY_JVMCI_FLAGS(JVMCI_DECLARE_CHECK3, JVMCI_DECLARE_CHECK4)
#else
#define JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)
#define JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc)
#define JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc)
#define JVMCI_FLAG_CHECKED(name)
#endif
#define JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
#define JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE(type, name, value, doc) EMIT_FLAG_VALUE_CHANGED_CHECK_CODE(name)
JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
#undef EMIT_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_PD_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
#undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE
#ifndef TIERED
// JVMCI is only usable as a jit compiler if the VM supports tiered compilation.
#define JVMCI_CHECK_TIERED_ONLY_FLAG(FLAG) \
if (!FLAG_IS_DEFAULT(FLAG)) { \
jio_fprintf(defaultStream::error_stream(), "VM option '%s' cannot be set in non-tiered VM\n", #FLAG); \
return false; \
// Checks that a given flag is not set if a given guard flag is false.
#define CHECK_NOT_SET(FLAG, GUARD) \
JVMCI_FLAG_CHECKED(FLAG) \
if (!GUARD && !FLAG_IS_DEFAULT(FLAG)) { \
jio_fprintf(defaultStream::error_stream(), \
"Improperly specified VM option '%s': '%s' must be enabled\n", #FLAG, #GUARD); \
return false; \
}
JVMCI_CHECK_TIERED_ONLY_FLAG(UseJVMCICompiler)
JVMCI_CHECK_TIERED_ONLY_FLAG(BootstrapJVMCI)
JVMCI_CHECK_TIERED_ONLY_FLAG(PrintBootstrap)
JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIThreads)
JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIHostThreads)
JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCICountersExcludeCompiler)
#undef JVMCI_CHECK_TIERED_ONLY_FLAG
#endif
JVMCI_FLAG_CHECKED(UseJVMCICompiler)
JVMCI_FLAG_CHECKED(EnableJVMCI)
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
if (UseJVMCICompiler) {
if (!FLAG_IS_DEFAULT(EnableJVMCI) && !EnableJVMCI) {
jio_fprintf(defaultStream::error_stream(),
"Improperly specified VM option UseJVMCICompiler: EnableJVMCI cannot be disabled\n");
return false;
}
FLAG_SET_DEFAULT(EnableJVMCI, true);
}
CHECK_NOT_SET(JVMCITraceLevel, EnableJVMCI)
CHECK_NOT_SET(JVMCICounterSize, EnableJVMCI)
CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI)
CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI)
CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI)
CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI)
#ifndef PRODUCT
#define JVMCI_CHECK4(type, name, value, doc) assert(name##checked, #name " flag not checked");
#define JVMCI_CHECK3(type, name, doc) assert(name##checked, #name " flag not checked");
// Ensures that all JVMCI flags are checked by this method.
APPLY_JVMCI_FLAGS(JVMCI_CHECK3, JVMCI_CHECK4)
#undef APPLY_JVMCI_FLAGS
#undef JVMCI_DECLARE_CHECK3
#undef JVMCI_DECLARE_CHECK4
#undef JVMCI_CHECK3
#undef JVMCI_CHECK4
#undef JVMCI_FLAG_CHECKED
#endif
#undef CHECK_NOT_SET
return true;
}
// Print jvmci arguments inconsistency error message.
void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() {
const char* error_msg = "Improperly specified VM option '%s'\n";
jio_fprintf(defaultStream::error_stream(), "EnableJVMCI must be enabled\n");
#define EMIT_CHECK_PRINT_ERR_MSG_CODE(FLAG) \
if (!FLAG_IS_DEFAULT(FLAG)) { \
if (strcmp(#FLAG, "EnableJVMCI")) { \
jio_fprintf(defaultStream::error_stream(), error_msg, #FLAG); \
} \
}
#define JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
#define JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
if (UnlockDiagnosticVMOptions || !FLAG_IS_DEFAULT(UnlockDiagnosticVMOptions)) {
JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
}
if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) {
JVMCI_FLAGS(JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
}
#ifndef PRODUCT
#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
#else
#define JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)
#define JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc)
#define JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc)
#endif
#define JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
#define JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE(type, name, value, doc) EMIT_CHECK_PRINT_ERR_MSG_CODE(name)
JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
IGNORE_WRITEABLE)
#undef EMIT_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_PD_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE
#undef JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE
}
#undef JVMCI_IGNORE_FLAG_FOUR_PARAM
#undef JVMCI_IGNORE_FLAG_THREE_PARAM

View File

@ -29,8 +29,7 @@
//
// Defines all global flags used by the JVMCI compiler. Only flags that need
// to be accessible to the JVMCI C++ code should be defined here. All other
// JVMCI flags should be defined in JVMCIOptions.java.
// to be accessible to the JVMCI C++ code should be defined here.
//
#define JVMCI_FLAGS(develop, \
develop_pd, \
@ -64,9 +63,6 @@
"Force number of compiler threads for JVMCI host compiler") \
range(1, max_jint) \
\
experimental(bool, CodeInstallSafepointChecks, true, \
"Perform explicit safepoint checks while installing code") \
\
NOT_COMPILER2(product(intx, MaxVectorSize, 64, \
"Max vector size in bytes, " \
"actual size could be less depending on elements type")) \
@ -112,9 +108,9 @@ JVMCI_FLAGS(DECLARE_DEVELOPER_FLAG, \
class JVMCIGlobals {
public:
// Return true if jvmci flags are consistent.
// Return true if jvmci flags are consistent. If not consistent,
// an error message describing the inconsistency is printed before
// returning false.
static bool check_jvmci_flags_are_consistent();
// Print jvmci arguments inconsistency error message.
static void print_jvmci_args_inconsistency_error_message();
};
#endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP

View File

@ -2276,11 +2276,7 @@ bool Arguments::sun_java_launcher_is_altjvm() {
#if INCLUDE_JVMCI
// Check consistency of jvmci vm argument settings.
bool Arguments::check_jvmci_args_consistency() {
if (!EnableJVMCI && !JVMCIGlobals::check_jvmci_flags_are_consistent()) {
JVMCIGlobals::print_jvmci_args_inconsistency_error_message();
return false;
}
return true;
return JVMCIGlobals::check_jvmci_flags_are_consistent();
}
#endif //INCLUDE_JVMCI

View File

@ -49,12 +49,12 @@
* compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
* jdk.test.lib.Asserts
* jdk.test.lib.Utils
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
* -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
* -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false
* compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
* -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI
* -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true

View File

@ -52,17 +52,17 @@
* compiler.jvmci.common.testcases.SimpleClass
* jdk.test.lib.Asserts
* jdk.test.lib.Utils
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -Xbootclasspath/a:. -Xmixed
* -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
* -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
* compiler.jvmci.events.JvmciNotifyInstallEventTest
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
* -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
* -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
* compiler.jvmci.events.JvmciNotifyInstallEventTest
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
* -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0
* -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false