RFR: 8349556: RISC-V: improve the performance when -COH and -AvoidUnalignedAccesses for UL and LU string comparison
Fei Yang
fyang at openjdk.org
Fri Feb 7 11:11:11 UTC 2025
On Fri, 7 Feb 2025 10:29:24 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2528:
>>
>>> 2526: tmpL = isLU ? tmp1 : tmp2; // where to keep L for comparison
>>> 2527:
>>> 2528: if (AvoidUnalignedAccesses && (base_offset1 % 8) != 0) {
>>
>> I find that a similar check is in `C2_MacroAssembler::string_compare` for the UU/LL cases [1].
>> Seems more consistent if we move it into the counterpart `generate_compare_long_string_same_encoding`.
>>
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1443
>
> Agree, we should refactor the code a bit to make it more readable.
> As it seems just a refactor, so I can do it in another pr, how do you think about it?
> At the same time I can also clean the invocation of `compare_string_16_bytes_same` from `generate_compare_long_string_same_encoding`, I don't like the implicit registers passing between them.
Sure. Seems the LL/UU cases are kind of different as they already emit direct 8-byte loads before the stub. So not sure if it's doable to move the check.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23495#discussion_r1946363295
More information about the hotspot-compiler-dev
mailing list