Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8334496

Deprecate LockingMode option, along with LM_LEGACY and LM_MONITOR

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 24
    • hotspot
    • None
    • source, behavioral
    • minimal
    • This is a new option for an internal feature that users are unaware of.
    • add/remove/modify command line option
    • Implementation

      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)                                                       \

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            David Holmes, Stefan Karlsson, Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: