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

Daniel D. Daugherty dcubed at openjdk.org
Thu Nov 16 18:27:55 UTC 2023


On Thu, 16 Nov 2023 18:17:34 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move is_lock_owned closer to its only use
>
> src/hotspot/share/runtime/synchronizer.cpp line 521:
> 
>> 519:           const markWord new_mark = mark.set_fast_locked();
>> 520:           const markWord old_mark = mark;
>> 521:           mark = obj()->cas_set_mark(new_mark, old_mark);
> 
> I'm having trouble seeing how this change is related to hash codes.
> The previous code did not loop and if the calling thread's attempt to
> lightweight lock the object lost a race, then we simply fell thru down
> to the inflate-enter loop...
> 
> I don't see any explanation for this change in the bug report or in the
> PR anywhere. Perhaps I'll figure it out as I reason thru the changes...

The change from `mark.is_neutral()` to `mark.is_unlocked()` is equivalent
since both functions have the exact same meaning. Is there some reason to
make that change? Are we trying to migrate away from `mark.is_neutral()`  to
`mark.is_unlocked()`? I think the original "neutral" concept was from when we
had biased locking...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16603#discussion_r1396162159


More information about the hotspot-dev mailing list