diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 75ba2eb3516..f6a7a345dd1 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1969,11 +1969,11 @@ const int ObjectAlignmentInBytes = 8; "Mark all threads after a safepoint, and clear on a modify " \ "fence. Add cleanliness checks.") \ \ - product(int, LockingMode, LM_LEGACY, \ + product(int, LockingMode, LM_LIGHTWEIGHT, \ "Select locking mode: " \ "0: monitors only (LM_MONITOR), " \ - "1: monitors & legacy stack-locking (LM_LEGACY, default), " \ - "2: monitors & new lightweight locking (LM_LIGHTWEIGHT)") \ + "1: monitors & legacy stack-locking (LM_LEGACY), " \ + "2: monitors & new lightweight locking (LM_LIGHTWEIGHT, default)") \ range(0, 2) \ \ product(uint, TrimNativeHeapInterval, 0, \ diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 12792181b61..b55063f04f2 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -419,13 +419,15 @@ public class VMProps implements Callable> { } /** - * @return true if compiler in use supports RTM and false otherwise. + * @return "true" if compiler in use supports RTM and "false" otherwise. + * Note: Lightweight locking does not support RTM (for now). */ protected String vmRTMCompiler() { boolean isRTMCompiler = false; if (Compiler.isC2Enabled() && - (Platform.isX86() || Platform.isX64() || Platform.isPPC())) { + (Platform.isX86() || Platform.isX64() || Platform.isPPC()) && + is_LM_LIGHTWEIGHT().equals("false")) { isRTMCompiler = true; } return "" + isRTMCompiler; @@ -481,6 +483,34 @@ public class VMProps implements Callable> { return "" + WB.getVMPageSize(); } + /** + * @return LockingMode. + */ + protected String vmLockingMode() { + return "" + WB.getIntVMFlag("LockingMode"); + } + + /** + * @return "true" if LockingMode == 0 (LM_MONITOR) + */ + protected String is_LM_MONITOR() { + return "" + vmLockingMode().equals("0"); + } + + /** + * @return "true" if LockingMode == 1 (LM_LEGACY) + */ + protected String is_LM_LEGACY() { + return "" + vmLockingMode().equals("1"); + } + + /** + * @return "true" if LockingMode == 2 (LM_LIGHTWEIGHT) + */ + protected String is_LM_LIGHTWEIGHT() { + return "" + vmLockingMode().equals("2"); + } + /** * Check if Graal is used as JIT compiler. *