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

Daniel D. Daugherty dcubed at openjdk.org
Thu Nov 16 18:51:49 UTC 2023


On Mon, 13 Nov 2023 12:21:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> The condition does now check for a successful CAS, not the unsuccessful one. If it was successful then there is no monitor, thus no anonymous owner.
>> 
>> If the CAS failed and the mark word is no longer fast locked. It must be inflated. So we fallthrough down to the inflated case.
>> 
>> `ObjectSynchronizer::inflate` correctly handles fixing the owner.
>
> I see - thanks. It is hard to see where the code goes to when the CAS fails.

In the old code, I think if there was a hash code installation racing with this
monitor exit by the thread owner, the hash code installer thread would have
inflated the monitor which would have resulted in the anonymous owner value
also being set. So we could have had two different inflating thread racers...

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

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


More information about the hotspot-dev mailing list