RFR: 8347489: RISC-V: Misaligned memory access with COH [v4]
Fei Yang
fyang at openjdk.org
Mon Jan 27 04:21:36 UTC 2025
On Wed, 15 Jan 2025 15:06:01 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2531:
>>
>>> 2529: tmpL = isLU ? tmp1 : tmp2; // where to keep L for comparison
>>> 2530:
>>> 2531: if ((base_offset1 % 8) == 0) {
>>
>> The condition should be `((base_offset1 % 8) != 0)`? Seems we try to make the `strL` aligned in the main loop below.
>
> And do we need below piece of code when `AvoidUnalignedAccesses == false`?
The alignment is 8 bytes without COH. And the caller of the stub has loaded 4 characters [1]. So when we have to process another 4 characters to make `strL` 8-byte aligned when entering the main loop. But this is not needed with COH, because the alignment is 4 bytes. That's why I added this if check. Hope that explains.
And I have added check for `AvoidUnalignedAccesses` to this logic.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp#L2511
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23053#discussion_r1929970388
More information about the hotspot-compiler-dev
mailing list