RFR: 8350095: RISC-V: Refactor string_compare [v6]
Hamlin Li
mli at openjdk.org
Tue Feb 25 13:28:54 UTC 2025
On Tue, 25 Feb 2025 11:58:35 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>>
>> clean 3
>
> src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1408:
>
>> 1406: addi(str1, str1, 4);
>> 1407: addi(str2, str2, 4);
>> 1408: subi(cnt2, cnt2, minCharsInWord / 2);
>
> Ah, I just realized that the check at [1] is discarded. Suppose this is LL case and input `cnt2` is 9, `cnt2` will be 5 after this `subi` instruction. This means the remaining number of latin chars is 5, so the two 8-byte loads at L1421 and L1422 will exceed the boundary. Maybe we should also consider moving the check at [2] to a proper place?
>
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1445
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1457
Previously, we have a `TAIL` label at [1], seems when it get here, it could also exceed the boundary of the string?
But seems to me exceeding the boundary should be fine, as we can not exceed the page boundary in this way.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L1550
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23633#discussion_r1969782048
More information about the hotspot-compiler-dev
mailing list