RFR: 8368724: RISC-V: Check if unaligned_access is enabled before use
Hamlin Li
mli at openjdk.org
Fri Sep 26 10:33:51 UTC 2025
On Fri, 26 Sep 2025 08:31:05 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> we can notice that the `unaligned_access.value()` can only be used when the `unaligned_access.enabled()` is true, so we add the check here before use
>>
>> Manually checked the result on platforms w/wo fast misaligned accesses by running: $java -XX:+PrintFlagsFinal -version | grep AvoidUnalignedAccess
>
> I think we're going to remove the `AvoidUnalignedAccesses`? And if `unaligned_access` is not enabled, then its value can not be `MISALIGNED_FAST`?
> If both above are true, then seems this check is not necessary?
> @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?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27510#issuecomment-3338014373
More information about the hotspot-dev
mailing list