RFR: 8344916: RISC-V: Misaligned access in array fill stub
Fei Yang
fyang at openjdk.org
Mon Nov 25 02:27:12 UTC 2024
Hi, Please review this small change.
In `generate_fill`, we fill the remaining elements by a single 8-byte store when the remaining count is less than 8 bytes in size after `fill_words`. This may overwrite some elements and create misaligned access. While it's not an issue for mordern CPUs with fast misaligned access, this does affect performance on CPUs where misaligned access is emulated by a trap handler and thus is very slow. async-profiler tells 2.8% of `jshort_fill` in flame graph when sampling Specjbb2005 on these platforms.
In this particular case, the copy address `to` is 8-byte aligned after `fill_words`. So if `AvoidUnalignedAccesses` is true, one choice would be directing control to `L_fill_elements` which avoids alignment issue while filling the remaining elements.
Test on linux-riscv64 platform:
- [x] tier1-3 (release)
- [x] 2.5% Specjbb2005 performance benefit on both HiFive Unmatched and Premier P550 SBCs.
- [x] No obvious performance impact witnessed on other platforms like BFI-F3 or Pioneer box.
-------------
Commit messages:
- 8344916: RISC-V: Misaligned access in array fill stub
Changes: https://git.openjdk.org/jdk/pull/22347/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22347&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8344916
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/22347.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22347/head:pull/22347
PR: https://git.openjdk.org/jdk/pull/22347
More information about the hotspot-compiler-dev
mailing list