RFR: 8323724: Remove potential re-inflation from FastHashCode under LM_LIGHTWEIGHT

Axel Boldt-Christmas aboldtch at openjdk.org
Wed Apr 24 12:26:30 UTC 2024


On Sat, 20 Apr 2024 13:38:01 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

> 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.

lgtm.

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

Marked as reviewed by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18876#pullrequestreview-2019709158


More information about the hotspot-runtime-dev mailing list