RFR: 8319801: Recursive lightweight locking: aarch64 implementation [v9]

Axel Boldt-Christmas aboldtch at openjdk.org
Thu Jan 25 08:03:29 UTC 2024


On Wed, 24 Jan 2024 17:31:47 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Preloads markWord unconditionally
>>  - Revert "Add preload_mark to MacroAssembler::lightweight_lock"
>>    
>>    This reverts commit 8950f503aa5dba0e203613bd9737ea0d50388ca3.
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16608#discussion_r1465975881


More information about the hotspot-dev mailing list