RFR: 8323724: Remove potential re-inflation from FastHashCode under LM_LIGHTWEIGHT
Fredrik Bredberg
fbredberg at openjdk.org
Sat Apr 20 17:36:36 UTC 2024
There is a race when a thread that tries to install the hash code finds an inflated `ObjectMonitor`, which the deflation thread is concurrently deflating, thus causing the `FastHashCode` logic to re-inflate the `ObjectMonitor`.
This PR solves that by simply taking the ObjectMonitor pointer from the markWord and retrying without inflating, if it was deflated.
This enhancement will remove the last code path which can inflate an `ObjectMonitor` from a non java thread, which in turn will simplify the `is_lock_owned` logic and allow for stronger assertions.
Tested and passes tier1-tier5 ok.
-------------
Commit messages:
- Merge branch 'master' into 8323724_dont_reinflate_in_fasthashcode
- 8323724: Remove potential re-inflation from FastHashCode
Changes: https://git.openjdk.org/jdk/pull/18876/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18876&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8323724
Stats: 5 lines in 1 file changed: 2 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/18876.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18876/head:pull/18876
PR: https://git.openjdk.org/jdk/pull/18876
More information about the hotspot-runtime-dev
mailing list