RFR: 8319773: Avoid inflating monitors when installing hash codes for LM_LIGHTWEIGHT [v3]

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Nov 14 13:34:49 UTC 2023


> LM_LIGHTWEIGHT only uses the lock bits for its locking. This leaves the hashCode bits free when a monitor is not inflated. So instead of inflating when installing the hashCode on a fast locked object it can simply use the hashCode bits in the markWord.
> 
> The mark word transitions Unlocked (0b01) <=> Locked (0b00) are done by retrying the CAS if it fails due to non-lock bit changes. 
> The mark word transitions Monitor (0b10) <=> Locked/Unlocked (0b0X) are the same as before, inflation already handles hash codes. This change does not interact with the mark word if it is in a Monitor (0b10) state, so the strong CAS which is used for deflation are still valid, and will not fail to any other reason than the cooperative race to help transition the mark word during deflation.
> 
> This is dependent on JDK-8319778 simply because JDK-8319797 is dependent on both this and JDK-8319778.

Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge remote-tracking branch 'upstream_jdk/pr/16602' into JDK-8319773
 - Simplify test.
 - 8319773: Avoid inflating monitors when installing hash codes for LM_LIGHTWEIGHT

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/16603/files
  - new: https://git.openjdk.org/jdk/pull/16603/files/f10571e8..e6055689

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16603&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16603&range=01-02

  Stats: 599626 lines in 656 files changed: 76230 ins; 464489 del; 58907 mod
  Patch: https://git.openjdk.org/jdk/pull/16603.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16603/head:pull/16603

PR: https://git.openjdk.org/jdk/pull/16603


More information about the hotspot-dev mailing list