diff --git a/src/hotspot/cpu/x86/globals_x86.hpp b/src/hotspot/cpu/x86/globals_x86.hpp index cacbce676d0..691e8264674 100644 --- a/src/hotspot/cpu/x86/globals_x86.hpp +++ b/src/hotspot/cpu/x86/globals_x86.hpp @@ -154,16 +154,18 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); \ /* Use Restricted Transactional Memory for lock eliding */ \ product(bool, UseRTMLocking, false, \ - "Enable RTM lock eliding for inflated locks in compiled code") \ + "(Deprecated) Enable RTM lock eliding for inflated locks " \ + "in compiled code") \ \ product(bool, UseRTMForStackLocks, false, EXPERIMENTAL, \ "Enable RTM lock eliding for stack locks in compiled code") \ \ product(bool, UseRTMDeopt, false, \ - "Perform deopt and recompilation based on RTM abort ratio") \ + "(Deprecated) Perform deopt and recompilation based on " \ + "RTM abort ratio") \ \ product(int, RTMRetryCount, 5, \ - "Number of RTM retries on lock abort or busy") \ + "(Deprecated) Number of RTM retries on lock abort or busy") \ range(0, max_jint) \ \ product(int, RTMSpinLoopCount, 100, EXPERIMENTAL, \ diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 6885cde4ee3..81b73a015fb 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -501,7 +501,11 @@ 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) }, + { "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) }, +#endif // X86 // --- 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() }, diff --git a/src/java.base/share/man/java.1 b/src/java.base/share/man/java.1 index 6499d70f989..9d5bd5fba98 100644 --- a/src/java.base/share/man/java.1 +++ b/src/java.base/share/man/java.1 @@ -2477,24 +2477,6 @@ This option has a limit of 2 GB; otherwise, an error is generated. The maximum code cache size shouldn\[aq]t be less than the initial code cache size; see the option \f[V]-XX:InitialCodeCacheSize\f[R]. .TP -\f[V]-XX:RTMAbortRatio=\f[R]\f[I]abort_ratio\f[R] -Specifies the RTM abort ratio is specified as a percentage (%) of all -executed RTM transactions. -If a number of aborted transactions becomes greater than this ratio, -then the compiled code is deoptimized. -This ratio is used when the \f[V]-XX:+UseRTMDeopt\f[R] option is -enabled. -The default value of this option is 50. -This means that the compiled code is deoptimized if 50% of all -transactions are aborted. -.TP -\f[V]-XX:RTMRetryCount=\f[R]\f[I]number_of_retries\f[R] -Specifies the number of times that the RTM locking code is retried, when -it is aborted or busy, before falling back to the normal locking -mechanism. -The default value for this option is 5. -The \f[V]-XX:UseRTMLocking\f[R] option must be enabled. -.TP \f[V]-XX:+SegmentedCodeCache\f[R] Enables segmentation of the code cache, without which the code cache consists of one large segment. @@ -2728,65 +2710,6 @@ FMA intrinsics are generated for the value of \f[V](\f[R] \f[I]a\f[R] \f[V]*\f[R] \f[I]b\f[R] \f[V]+\f[R] \f[I]c\f[R] \f[V])\f[R] expressions. .TP -\f[V]-XX:+UseRTMDeopt\f[R] -Autotunes RTM locking depending on the abort ratio. -This ratio is specified by the \f[V]-XX:RTMAbortRatio\f[R] option. -If the number of aborted transactions exceeds the abort ratio, then the -method containing the lock is deoptimized and recompiled with all locks -as normal locks. -This option is disabled by default. -The \f[V]-XX:+UseRTMLocking\f[R] option must be enabled. -.TP -\f[V]-XX:+UseRTMLocking\f[R] -Generates Restricted Transactional Memory (RTM) locking code for all -inflated locks, with the normal locking mechanism as the fallback -handler. -This option is disabled by default. -Options related to RTM are available only on x86 CPUs that support -Transactional Synchronization Extensions (TSX). -.RS -.PP -RTM is part of Intel\[aq]s TSX, which is an x86 instruction set -extension and facilitates the creation of multithreaded applications. -RTM introduces the new instructions \f[V]XBEGIN\f[R], \f[V]XABORT\f[R], -\f[V]XEND\f[R], and \f[V]XTEST\f[R]. -The \f[V]XBEGIN\f[R] and \f[V]XEND\f[R] instructions enclose a set of -instructions to run as a transaction. -If no conflict is found when running the transaction, then the memory -and register modifications are committed together at the \f[V]XEND\f[R] -instruction. -The \f[V]XABORT\f[R] instruction can be used to explicitly abort a -transaction and the \f[V]XTEST\f[R] instruction checks if a set of -instructions is being run in a transaction. -.PP -A lock on a transaction is inflated when another thread tries to access -the same transaction, thereby blocking the thread that didn\[aq]t -originally request access to the transaction. -RTM requires that a fallback set of operations be specified in case a -transaction aborts or fails. -An RTM lock is a lock that has been delegated to the TSX\[aq]s system. -.PP -RTM improves performance for highly contended locks with low conflict in -a critical region (which is code that must not be accessed by more than -one thread concurrently). -RTM also improves the performance of coarse-grain locking, which -typically doesn\[aq]t perform well in multithreaded applications. -(Coarse-grain locking is the strategy of holding locks for long periods -to minimize the overhead of taking and releasing locks, while -fine-grained locking is the strategy of trying to achieve maximum -parallelism by locking only when necessary and unlocking as soon as -possible.) -Also, for lightly contended locks that are used by different threads, -RTM can reduce false cache line sharing, also known as cache line -ping-pong. -This occurs when multiple threads from different processors are -accessing different resources, but the resources share the same cache -line. -As a result, the processors repeatedly invalidate the cache lines of -other processors, which forces them to read from main memory instead of -their cache. -.RE -.TP \f[V]-XX:+UseSuperWord\f[R] Enables the transformation of scalar operations into superword operations. @@ -3825,6 +3748,83 @@ The default value is 2. .PP Use the option \f[V]-XX:MinRAMPercentage\f[R] instead. .RE +.TP +\f[V]-XX:RTMAbortRatio=\f[R]\f[I]abort_ratio\f[R] +Specifies the RTM abort ratio is specified as a percentage (%) of all +executed RTM transactions. +If a number of aborted transactions becomes greater than this ratio, +then the compiled code is deoptimized. +This ratio is used when the \f[V]-XX:+UseRTMDeopt\f[R] option is +enabled. +The default value of this option is 50. +This means that the compiled code is deoptimized if 50% of all +transactions are aborted. +.TP +\f[V]-XX:RTMRetryCount=\f[R]\f[I]number_of_retries\f[R] +Specifies the number of times that the RTM locking code is retried, when +it is aborted or busy, before falling back to the normal locking +mechanism. +The default value for this option is 5. +The \f[V]-XX:UseRTMLocking\f[R] option must be enabled. +.TP +\f[V]-XX:+UseRTMDeopt\f[R] +Autotunes RTM locking depending on the abort ratio. +This ratio is specified by the \f[V]-XX:RTMAbortRatio\f[R] option. +If the number of aborted transactions exceeds the abort ratio, then the +method containing the lock is deoptimized and recompiled with all locks +as normal locks. +This option is disabled by default. +The \f[V]-XX:+UseRTMLocking\f[R] option must be enabled. +.TP +\f[V]-XX:+UseRTMLocking\f[R] +Generates Restricted Transactional Memory (RTM) locking code for all +inflated locks, with the normal locking mechanism as the fallback +handler. +This option is disabled by default. +Options related to RTM are available only on x86 CPUs that support +Transactional Synchronization Extensions (TSX). +.RS +.PP +RTM is part of Intel\[aq]s TSX, which is an x86 instruction set +extension and facilitates the creation of multithreaded applications. +RTM introduces the new instructions \f[V]XBEGIN\f[R], \f[V]XABORT\f[R], +\f[V]XEND\f[R], and \f[V]XTEST\f[R]. +The \f[V]XBEGIN\f[R] and \f[V]XEND\f[R] instructions enclose a set of +instructions to run as a transaction. +If no conflict is found when running the transaction, then the memory +and register modifications are committed together at the \f[V]XEND\f[R] +instruction. +The \f[V]XABORT\f[R] instruction can be used to explicitly abort a +transaction and the \f[V]XTEST\f[R] instruction checks if a set of +instructions is being run in a transaction. +.PP +A lock on a transaction is inflated when another thread tries to access +the same transaction, thereby blocking the thread that didn\[aq]t +originally request access to the transaction. +RTM requires that a fallback set of operations be specified in case a +transaction aborts or fails. +An RTM lock is a lock that has been delegated to the TSX\[aq]s system. +.PP +RTM improves performance for highly contended locks with low conflict in +a critical region (which is code that must not be accessed by more than +one thread concurrently). +RTM also improves the performance of coarse-grain locking, which +typically doesn\[aq]t perform well in multithreaded applications. +(Coarse-grain locking is the strategy of holding locks for long periods +to minimize the overhead of taking and releasing locks, while +fine-grained locking is the strategy of trying to achieve maximum +parallelism by locking only when necessary and unlocking as soon as +possible.) +Also, for lightly contended locks that are used by different threads, +RTM can reduce false cache line sharing, also known as cache line +ping-pong. +This occurs when multiple threads from different processors are +accessing different resources, but the resources share the same cache +line. +As a result, the processors repeatedly invalidate the cache lines of +other processors, which forces them to read from main memory instead of +their cache. +.RE .SH OBSOLETE JAVA OPTIONS .PP These \f[V]java\f[R] options are still accepted but ignored, and a diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index 3bb6a4b9d6b..62c5ef411da 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -62,6 +62,15 @@ public class VMDeprecatedOptions { {"CreateMinidumpOnCrash", "false"} } )); + if (Platform.isX86() || Platform.isX64()) { + deprecated.addAll( + Arrays.asList(new String[][] { + {"UseRTMLocking", "false"}, + {"UseRTMDeopt", "false"}, + {"RTMRetryCount", "5"} + }) + ); + } if (wb.isJFRIncluded()) { deprecated.add(new String[] {"FlightRecorder", "false"}); }