RFR: 8368724: RISC-V: Check if unaligned_access is enabled before use

Anjian Wen wenanjian at openjdk.org
Mon Sep 29 02:31:18 UTC 2025


On Fri, 26 Sep 2025 10:51:06 GMT, Hamlin Li <mli at openjdk.org> wrote:

>>> @Hamlin-Li Thanks for your review. According to the current use of `unaligned_access.value`, if it is not enabled, then using value will depend on the default value `-1`. This change is to try to make the use of `unaligned_access.value` more reasonable. Maybe we can keep this judgment and consider removing the Avoid flag latter?
>> 
>> If the default value is `-1`, then `unaligned_access.value() == MISALIGNED_FAST` can only be true when it's enabled, so that makes the extra check added in this pr unnecessary for `UseUnalignedAccesses`.
>> As for `AvoidUnalignedAccesses`, there is a discussion here to remove `AvoidUnalignedAccesses`: https://github.com/openjdk/jdk/pull/27445#pullrequestreview-3257314698.
>> So my suggestion is to just remove `AvoidUnalignedAccesses` in riscv, how do you think about it?
>
>> So my suggestion is to just remove `AvoidUnalignedAccesses` in riscv, how do you think about it?
> 
> I guess no one's already working it? Maybe you could take it if you are available. :)

> > @Hamlin-Li Thanks for your review. According to the current use of `unaligned_access.value`, if it is not enabled, then using value will depend on the default value `-1`. This change is to try to make the use of `unaligned_access.value` more reasonable. Maybe we can keep this judgment and consider removing the Avoid flag latter?
> 
> If the default value is `-1`, then `unaligned_access.value() == MISALIGNED_FAST` can only be true when it's enabled, so that makes the extra check added in this pr unnecessary for `UseUnalignedAccesses`. As for `AvoidUnalignedAccesses`, there is a discussion here to remove `AvoidUnalignedAccesses`: [#27445 (review)](https://github.com/openjdk/jdk/pull/27445#pullrequestreview-3257314698). So my suggestion is to just remove `AvoidUnalignedAccesses` in riscv, how do you think about it?

@Hamlin-Li  Oh, Thanks! I get it, I think it makes sence. I will try to figure out how to modify the code and remove `AvoidUnalignedAccesses` together

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27510#issuecomment-3344638329


More information about the hotspot-dev mailing list