RFR: 8315856: RISC-V: Use Zacas extension for cmpxchg [v3]
Fei Yang
fyang at openjdk.org
Tue Dec 12 03:11:28 UTC 2023
On Mon, 11 Dec 2023 11:35:43 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:
>> 8315856: RISC-V: Use Zacas extension for cmpxchg
>
> Ludovic Henry has updated the pull request incrementally with one additional commit since the last revision:
>
> fix merge conflict mistake
Changes requested by fyang (Reviewer).
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`.
src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 2929:
> 2927:
> 2928: atomic_cas(tmp, new_val, addr, size, acquire, release);
> 2929: bne(tmp, old, fail);
Similar question as above here for this case.
src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 3009:
> 3007: Register result) {
> 3008: if (UseZacas) {
> 3009: cmpxchg(addr, expected, new_val, size, acquire, release, result, false);
The logic emitted by the original `MacroAssembler::cmpxchg_weak` returns a boolean value in register `result`. So shouldn't we set `result_as_bool` param to `true` when calling `cmpxchg` here?
-------------
PR Review: https://git.openjdk.org/jdk/pull/16910#pullrequestreview-1776497580
PR Review Comment: https://git.openjdk.org/jdk/pull/16910#discussion_r1423350176
PR Review Comment: https://git.openjdk.org/jdk/pull/16910#discussion_r1423352211
PR Review Comment: https://git.openjdk.org/jdk/pull/16910#discussion_r1423338735
More information about the hotspot-dev
mailing list