JDK-8328991 : Deprecate UseRTM* flags for removal
  • Type: CSR
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Draft
  • Resolution: Unresolved
  • Fix Versions: 23
  • Submitted: 2024-03-25
  • Updated: 2024-03-25
Related Reports
CSR :  
Description
Summary
-------

Deprecate the following x86 HotSpot product and experimental RTM flags for removal:

 UseRTMLocking, UseRTMForStackLocks, UseRTMDeopt, RTMRetryCount, RTMSpinLoopCount, RTMAbortThreshold, RTMLockingThreshold, RTMAbortRatio, RTMTotalCountIncrRate, RTMLockingCalculationDelay, UseRTMXendForLockBusy

Problem
-------

HotSpot supports RTM (restricted transactional memory) to be used for locking since JDK 8 on Intel's CPU (JDK-8031320). It was added to other platforms but has since been disabled and removed on all but Intel processors. There was attempt to deprecate it (JDK-8292082) during JDK 20 development but at that time it was decided to keep it. Recently we discussed this with Intel and they agreed with RTM deprecation and removal from HotSpot.

RTM adds complexity and maintenance burden to HotSpot locking code. It was never enabled by default because it only helped some cases of heavy lock contention. We don't test it since JDK 14 after we problem-list related tests.

New LIGHTWEIGHT locking implementation will not support it (JDK-8320321).

Solution
--------

I propose to deprecate the related flags and remove the flags and all related code in a later release.

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

    diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
    index 6885cde4ee3..99845332780 100644
    --- a/src/hotspot/share/runtime/arguments.cpp
    +++ b/src/hotspot/share/runtime/arguments.cpp
    @@ -501,7 +501,19 @@ static SpecialFlag const special_jvm_flags[] = {
       { "RequireSharedSpaces",          JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
       { "UseSharedSpaces",              JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
       { "RegisterFinalizersAtInit",     JDK_Version::jdk(22), JDK_Version::jdk(23), JDK_Version::jdk(24) },
    -
    +#if defined(X86)
    +  { "UseRTMLocking",                JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "UseRTMForStackLocks",          JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "UseRTMDeopt",                  JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMRetryCount",                JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMSpinLoopCount",             JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMAbortThreshold",            JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMLockingThreshold",          JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMAbortRatio",                JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMTotalCountIncrRate",        JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "RTMLockingCalculationDelay",   JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +  { "UseRTMXendForLockBusy",        JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
    +#endif
       // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
       { "CreateMinidumpOnCrash",        JDK_Version::jdk(9),  JDK_Version::undefined(), JDK_Version::undefined() },