RFR: 8319801: Recursive lightweight locking: aarch64 implementation [v9]
Coleen Phillimore
coleenp at openjdk.org
Thu Jan 25 15:30:36 UTC 2024
On Thu, 25 Jan 2024 08:01:13 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp line 455:
>>
>>> 453: // The owner may be anonymous and we removed the last obj entry in
>>> 454: // the lock-stack. This loses the information about the owner.
>>> 455: // Write the thread to the owner field so the runtime knows the owner.
>>
>> Is this necessary here also? Previous checks and slow path code in the runtime has already set the owner, if I understand correctly.
>
> After popping the last oop of the lock stack we do the `tbnz(mark, exact_log2(markWord::monitor_value), inflated);` check. If this happen the owner will be anonymous.
>
> Other solutions would be either:
> 1. Push the oop back and jump to the runtime. (Would make C2 anonymous owner agnostic).
> 2. Fix the owner only in this control flow, not in every inflated slow path exit.
>
> The first seems alright as well. It is more like what x86 evolved into doing (where it elides this specific check).
> Both solutions make the inflated unlock cleaner removes a branch (can branch directly to the slow path).
> The second does seems does create a more complex entry to the inflated unlock, does not seem worth it.
I didn't see that this isn't like the x86 code that pushes the object back on the lock stack. This seems fine and the comment is helpful.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16608#discussion_r1466536709
More information about the hotspot-dev
mailing list