RFR: 8360179: RISC-V: Only enable BigInteger intrinsics when AvoidUnalignedAccess == false

Feilong Jiang fjiang at openjdk.org
Mon Jun 23 02:57:28 UTC 2025


On Sat, 21 Jun 2025 12:23:57 GMT, Anjian Wen <wenanjian at openjdk.org> wrote:

> This disables BigInteger.multiplyToLen(), BigInteger.squareToLen(), BigInteger.montgomeryMultiply()
> and BigInteger.montgomerySquare() on linux-riscv64 platforms where misaligned memory accesses is slow.
> The reason is that these four BigInteger intrinsics do 8-byte misaligned memory accesses to int arrays
> under -XX:+UseCompactObjectHeaders. And this will have a negative impact on SPECJvm2008 crypto tests.
> 
> Testing:
> - [x] Tier1-3 tests.
> - [x] SPECJvm2008 crypto performance tests.
> [score.txt](https://github.com/user-attachments/files/20846531/score.txt)

Changes requested by fjiang (Committer).

src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 5624:

> 5622:     Label L_second_loop_unaligned, L_third_loop, L_third_loop_exit;
> 5623: 
> 5624:     multiply_32_x_32_loop(x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);

`multiply_32_x_32_loop` was only used in `AvoidUnalignedAccesses` case. It could be removed too.

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

PR Review: https://git.openjdk.org/jdk/pull/25923#pullrequestreview-2948525135
PR Review Comment: https://git.openjdk.org/jdk/pull/25923#discussion_r2160627705


More information about the hotspot-dev mailing list