RFR: 8368722: Several vector load/store tests fail on riscv without support for misaligned vector access

Vladimir Ivanov vlivanov at openjdk.org
Fri Sep 26 14:39:40 UTC 2025


On Fri, 26 Sep 2025 01:44:19 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:

> Hi,
> Can you help to review this patch? Thanks!
> 
> In `*VectorLoadStoreTests.java`,  `loadMemorySegmentMaskIOOBE` and `storeMemorySegmentMaskIOOBE` may fail because `int index = fi.apply((int) a.byteSize())` can generate random indices that result in misaligned addresses, leading to SIGBUS on hardware that disallows misaligned vector accesses.
> 
> Some RISC-V hardware supports fast misaligned scalar accesses but not vector ones, which causes SIGBUS when executing these tests with misaligned vector memory operations.
> 
> So we should adjusted index to align with the element byte size in these tests.
> 
> ### Test
> - [x] Run jdk_vector on k1
> - [x] Run jdk_vector on x86_64 and ARM64

It's not a test bug, but a product one. The Vector API deliberately doesn't require vector accesses to be naturally aligned. If a platform doesn't support misaligned vector accesses it has to either properly emulate them or fail to intrinsify corresponding vector intrinsics.

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

Changes requested by vlivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27506#pullrequestreview-3272573609


More information about the hotspot-dev mailing list