RFR: 8359218: RISC-V: Only enable CRC32 intrinsic when AvoidUnalignedAccess == false

Anjian Wen wenanjian at openjdk.org
Wed Jun 11 09:49:07 UTC 2025


When test **Specjvm** in p550, we can find the compress test result shown below.


before patch
-XX:-UseCompactObjectHeaders
Warmup (30s) begins: Wed Jun 11 16:10:18 CST 2025
Warmup (30s) ends:   Wed Jun 11 16:10:53 CST 2025
Warmup (30s) result: 68.98 ops/m

Iteration 1 (60s) begins: Wed Jun 11 16:10:53 CST 2025
Iteration 1 (60s) ends:   Wed Jun 11 16:11:57 CST 2025
Iteration 1 (60s) result: 71.25 ops/m


-XX:+UseCompactObjectHeaders
Warmup (30s) begins: Wed Jun 11 16:13:03 CST 2025
Warmup (30s) ends:   Wed Jun 11 16:13:42 CST 2025
Warmup (30s) result: 31.87 ops/m

Iteration 1 (60s) begins: Wed Jun 11 16:13:42 CST 2025
Iteration 1 (60s) ends:   Wed Jun 11 16:14:56 CST 2025
Iteration 1 (60s) result: 29.13 ops/m


The reason is that when enable compactObjectHeaders, the arraylist header turn to 4 Byte, but the copy instruction used in CRC intrinsic loop is 8 Byte one loop, which may reduce the performance when hardware is sensitive to unaligned access, we can close it when AvoidUnalignedAccesses is true

after patch 

-XX:-UseCompactObjectHeaders
Warmup (30s) begins: Wed Jun 11 16:23:22 CST 2025
Warmup (30s) ends:   Wed Jun 11 16:23:57 CST 2025
Warmup (30s) result: 68.61 ops/m

Iteration 1 (60s) begins: Wed Jun 11 16:23:57 CST 2025
Iteration 1 (60s) ends:   Wed Jun 11 16:25:00 CST 2025
Iteration 1 (60s) result: 71.57 ops/m


-XX:+UseCompactObjectHeaders
Warmup (30s) begins: Wed Jun 11 16:25:28 CST 2025
Warmup (30s) ends:   Wed Jun 11 16:26:03 CST 2025
Warmup (30s) result: 68.36 ops/m

Iteration 1 (60s) begins: Wed Jun 11 16:26:03 CST 2025
Iteration 1 (60s) ends:   Wed Jun 11 16:27:08 CST 2025
Iteration 1 (60s) result: 70.85 ops/m

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

Commit messages:
 - RISC-V: Only enable CRC32 intrinsic when AvoidUnalignedAccess == false

Changes: https://git.openjdk.org/jdk/pull/25743/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25743&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8359218
  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/25743.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25743/head:pull/25743

PR: https://git.openjdk.org/jdk/pull/25743


More information about the hotspot-dev mailing list