< prev index next >
src/hotspot/share/runtime/arguments.cpp
Print this page
rev 47591 : Add Thread Local handshakes and thread local polling
rev 47600 : [mq]: Option-Cleanup-12
*** 48,57 ****
--- 48,58 ----
#include "runtime/commandLineFlagRangeList.hpp"
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
+ #include "runtime/safepointMechanism.hpp"
#include "runtime/vm_version.hpp"
#include "services/management.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/defaultStream.hpp"
*** 4611,4620 ****
--- 4612,4653 ----
if (!UseBiasedLocking || EmitSync != 0) {
UseOptoBiasInlining = false;
}
#endif
+ bool aot_enabled = UseAOT && ((AOTLibrary != NULL) || !FLAG_IS_DEFAULT(UseAOT));
+ bool jvmci_enabled = NOT_JVMCI(false) JVMCI_ONLY(EnableJVMCI || UseJVMCICompiler);
+ bool handshakes_supported = SafepointMechanism::supports_thread_local_poll() && !aot_enabled && !jvmci_enabled && ThreadLocalHandshakes;
+ // ThreadLocalHandshakesConstraintFunc handles the constraints.
+ // Here we try to figure out if a mutual exclusive option have been set.
+ if (handshakes_supported) {
+ if (FLAG_IS_DEFAULT(UseAOT)) {
+ FLAG_SET_DEFAULT(UseAOT, false); // Clear the AOT flag to make sure it doesn't try to initialize.
+ }
+ } else {
+ if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) && ThreadLocalHandshakes) {
+ if (!SafepointMechanism::supports_thread_local_poll()) {
+ // Unsupported platform should have ThreadLocalHandshakes default set to false.
+ log_debug(ergo)("Disabling ThreadLocalHandshakes unsupported plaform.");
+ FLAG_SET_ERGO(bool, ThreadLocalHandshakes, false);
+ } else if (!FLAG_IS_DEFAULT(UseAOT) && UseAOT) {
+ // If user enabled AOT but ThreadLocalHandshakes is at default set it to false.
+ log_debug(ergo)("Disabling ThreadLocalHandshakes for UseAOT.");
+ FLAG_SET_ERGO(bool, ThreadLocalHandshakes, false);
+ } else if (jvmci_enabled){
+ // If user enabled JVMCI but ThreadLocalHandshakes is at default set it to false.
+ log_debug(ergo)("Disabling ThreadLocalHandshakes for EnableJVMCI/UseJVMCICompiler.");
+ FLAG_SET_ERGO(bool, ThreadLocalHandshakes, false);
+ }
+ }
+ }
+ if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) || !SafepointMechanism::supports_thread_local_poll()) {
+ log_debug(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
+ } else {
+ log_info(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
+ }
+
return JNI_OK;
}
jint Arguments::adjust_after_os() {
if (UseNUMA) {
< prev index next >