RFR: 8315856: RISC-V: Use Zacas extension for cmpxchg [v3]
Ludovic Henry
luhenry at openjdk.org
Tue Dec 12 15:17:41 UTC 2023
On Tue, 12 Dec 2023 03:03:00 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Ludovic Henry has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix merge conflict mistake
>
> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 2868:
>
>> 2866:
>> 2867: atomic_cas(old, tmp, aligned_addr, size, acquire, release);
>> 2868: bne(tmp, old, retry);
>
> Does it make sense to use `atomic_cas` here for this case? I don't see the benefit. The input `size` is supposed to be `int8` or `int16`, but the newly-added `atomic_cas` can only handle `int64`, `int32` and `uint32`.
It does make sense to use `atomic_cas` here all to avoid `lr/sc`, for all the reasons where amocas behaves better than lr/sc. The manipulation needed for sub-word atomics is the same for both amocas and lr/sc anyway, just a slightly different order.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16910#discussion_r1424152061
More information about the hotspot-dev
mailing list