RFR: 8319799: Recursive lightweight locking: x86 implementation [v14]

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Jan 29 14:16:51 UTC 2024


On Fri, 26 Jan 2024 18:08:33 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 21 additional commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'upstream_jdk/pr/16606' into JDK-8319799
>>  - Update variable names in ad files
>>  - Preload markWord unconditionally
>>  - Merge remote-tracking branch 'upstream_jdk/pr/16606' into JDK-8319799
>>  - Add more expressive stub continuation names
>>  - Remove outdated anonymous owner fix in stub
>>  - Merge remote-tracking branch 'upstream_jdk/pr/16606' into JDK-8319799
>>  - Remove C2HandleAnonOMOwnerStub definitions on x86.
>>  - Add MFENCE comment
>>  - Merge remote-tracking branch 'upstream_jdk/pr/16606' into JDK-8319799
>>  - ... and 11 more: https://git.openjdk.org/jdk/compare/f944f1ec...4d37c4b7
>
> src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp line 141:
> 
>> 139: 
>> 140:     __ bind(fix_zf_and_unlocked);
>> 141:     __ xorl(rax, rax);
> 
> Just curious: why use `xorl` here and `xorptr` on L135 above?

Legacy. `xorl` is what `fast_unlock` used to set the zero flag. `xorl` is there only to set the zero flag. `xorptr` is there to store `nullptr` in `rax` (the expected value for the CAS). Maybe it doesn't matter if x64 used `xorq` to set the zero flag. There are many other ways to do it as well. `fast_unlock` also use `testl` with a 0 immediate in one place. 

If there is a recommended way to set the zero flag we can change it to that. I could not find a definitive answer to what is best to use.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16607#discussion_r1469652978


More information about the hotspot-dev mailing list