JDK-8038939 : Some options related to RTM locking optimization works inconsistently
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u20,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86
  • Submitted: 2014-04-01
  • Updated: 2014-07-29
  • Resolved: 2014-04-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b10Fixed
Related Reports
Relates :  
Description
(description was updated)

Several issues with abort handling on lock busy for stack locks:

If we use xabort on lock busy for stack locks, then we jump to inflated locking
before any xbegin call.
However, when +RTMXendForLockBusy is used, we're starting transaction
in stack locking code, detects that lock is inflated, interrupt transaction with
xend call and then jumps to inflated locking.

We should jump to inflated locking without starting a new transaction
regardless to RTMXendForLockBusy value.

Also, in case of xend for lock busy, when we jump to inflated locking on
lock busy, we start counting retries from RTMRetryCount, but IMO we should
start from (RTMRetryCount-1): first attempt was done in stack locking code.

If we jump to inflated locking immediately, then this issue will be resolved.

ILW (M = we do one extra transaction when it is not needed, M = issue could be reproduced with non-default values of options, H = there is no workaround if we want to use RTM locking for stack locks and xend for lock busy) => P3.

See comments for example.
Comments
Here is simple example to illustrate issues with abort handling: a) -UseRTMXendForLockBusy case: java -Xcomp -server -XX:-TieredCompilation -XX:CompileCommand=compileonly,BusyLock::lock -XX:+PrintCompilation -XX:+PrintPreciseRTMLockingStatistics -XX:+UseRTMLocking -XX:RTMRetryCount=5 -XX:+UnlockExperimentalVMOptions -XX:+UseRTMForStackLocks -XX:RTMTotalCountIncrRate=1 BusyLock CompilerOracle: compileonly BusyLock.lock 190 1 !b BusyLock::lock (53 bytes) BusyLock.lock@33 # rtm locks total (estimated): 6 # rtm lock aborts : 6 # rtm lock aborts 0: 6 # rtm lock aborts 1: 0 # rtm lock aborts 2: 0 # rtm lock aborts 3: 0 # rtm lock aborts 4: 0 # rtm lock aborts 5: 0 b) +UseRTMXendForLockBusy case: java -Xcomp -server -XX:-TieredCompilation -XX:CompileCommand=compileonly,BusyLock::lock -XX:+PrintCompilation -XX:+PrintPreciseRTMLockingStatistics -XX:+UseRTMLocking -XX:RTMRetryCount=5 -XX:+UnlockExperimentalVMOptions -XX:+UseRTMForStackLocks -XX:RTMTotalCountIncrRate=1 -XX:+UseRTMXendForLockBusy BusyLock CompilerOracle: compileonly BusyLock.lock 183 1 !b BusyLock::lock (53 bytes) BusyLock.lock@33 # rtm locks total (estimated): 1 # rtm lock aborts : 0 # rtm lock aborts 0: 0 # rtm lock aborts 1: 0 # rtm lock aborts 2: 0 # rtm lock aborts 3: 0 # rtm lock aborts 4: 0 # rtm lock aborts 5: 0 BusyLock.lock@33 # rtm locks total (estimated): 6 # rtm lock aborts : 0 # rtm lock aborts 0: 0 # rtm lock aborts 1: 0 # rtm lock aborts 2: 0 # rtm lock aborts 3: 0 # rtm lock aborts 4: 0 # rtm lock aborts 5: 0
01-04-2014