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

Coleen Phillimore coleenp at openjdk.org
Thu May 2 13:12:53 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.

Not necessary to create an RFE before integrating.

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

PR Comment: https://git.openjdk.org/jdk/pull/18876#issuecomment-2090465076


More information about the hotspot-runtime-dev mailing list