JDK-8334496 : Deprecate LockingMode option, along with LM_LEGACY and LM_MONITOR
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P3
  • Status: Draft
  • Resolution: Unresolved
  • Fix Versions: 24
  • Submitted: 2024-06-18
  • Updated: 2024-06-19
Related Reports
CSR :  
Relates :  
Relates :  
Description
Summary
-------

Deprecate the `LockingMode` JVM option, which selects an internal implementation for how the JVM implements object synchronization, with a view to obsolete it in JDK 26.

Problem
-------

The `LockingMode` option selects one of three internal implementations of how Hotspot JVM implements the object synchronization.  These internal implementations should not be visible to the Java user.  The option was originally added so that users can go back to the older implementation (`LM_LEGACY`) in case of bugs and performance problems in the newer implementation (`LM_LIGHTWEIGHT`).  We are now fully supporting and default to the new implementation, and have further enhancements.  Supporting the old implementation will result in hard-to-diagnose bugs in both the old and new implementations.  The mode `LM_MONITOR` has never been fully supported and is not well tested.

This option was added as an experimental option in JDK 21, made a product option in JDK 22 and the default was changed from `LM_LEGACY` to `LM_LIGHTWEIGHT` in JDK 23.  It's a new option that users will not have been using for a long time.   We would like to make it obsolete in JDK 26 so that it can be used in case a user experiences an unexpected performance impact.

Solution
--------

Deprecate `LockingMode` in JDK 24, make obsolete in 26 and remove in 27.


Specification
-------------

Added to the arguments table:
```
+  { "LockingMode",        JDK_Version::jdk(24),  JDK_Version::jdk(26), JDK_Version::jdk(27) },
```
Updated flag description:
```
           product(int, LockingMode, LM_LIGHTWEIGHT,                                 \
    -          "Select locking mode: "                                           \
    -          "0: monitors only (LM_MONITOR), "                                 \
    -          "1: monitors & legacy stack-locking (LM_LEGACY), "                \
    +          "(Deprecated) Select locking mode: "                              \
    +          "0: (Deprecated) monitors only (LM_MONITOR), "                    \
    +          "1: (Deprecated) monitors & legacy stack-locking (LM_LEGACY), "    \
               "2: monitors & new lightweight locking (LM_LIGHTWEIGHT, default)") \
               range(0, 2)                                                       \
```
Comments
I made some minor tweaks to ensure this covers the complete deprecation through expiration process, and formatted the specification in a way consistent with other deprecation requests. Added myself as reviewer.
19-06-2024