RFR: 8319773: Avoid inflating monitors when installing hash codes for LM_LIGHTWEIGHT [v2]
David Holmes
dholmes at openjdk.org
Mon Nov 13 12:26:02 UTC 2023
On Mon, 13 Nov 2023 07:29:40 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> src/hotspot/share/runtime/synchronizer.cpp line 582:
>>
>>> 580: // It can only have installed an anonymously locked monitor at this point.
>>> 581: // Fetch that monitor, set owner correctly to this thread, and
>>> 582: // exit it (allowing waiting threads to enter).
>>
>> I don't understand why the anonymous owner case is no longer being checked. ??
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16603#discussion_r1391043625
More information about the hotspot-dev
mailing list