RFR: 8347489: RISC-V: Misaligned memory access with COH [v5]

Fei Yang fyang at openjdk.org
Mon Jan 27 03:57:41 UTC 2025


> Hi, please consider this change.
> 
> We have different base_offset for T_BYTE/T_CHAR (4-byte instead of 8-byte aligned) with COH. This causes misaligned memory accesses for several instrinsics like String.Compare or String.Equals. The reason is that we assume 8-byte alignment and process one 8-byte word starting at the first array element for each iteration in the main loop. As a result, we have performance regressions on platforms with slow misaligned memory accesses like Unmatched and Premier P550 SBCs.
> 
> PS: Same issue is there even without COH. base_offset for T_BYTE/T_CHAR is 20 (thus 4-byte aligned) when `UseCompressedClassPointers` is disabled in this case.
> 
> Correctness test on linux-riscv64:
> - [x] tier1 (TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCompactObjectHeaders") (release)
> - [x] tier1 (TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:-UseCompactObjectHeaders") (release)
> - [x] hotspot:tier1 (TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCompactObjectHeaders") (fastdebug)
> - [x] hotspot:tier1 (TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:-UseCompactObjectHeaders") (fastdebug)
> 
> Performance test on Premier P550 (-XX:+AlwaysPreTouch -Xms8g -Xmx8g):
> 
> SPECjbb2005:
> 
> 1. Without Patch
> 1.1 -XX:+UseParallelGC -XX:-UseCompactObjectHeaders: 32666
> 1.2 -XX:+UseParallelGC -XX:+UseCompactObjectHeaders: 27610
> 1.3 -XX:+UseG1GC       -XX:-UseCompactObjectHeaders: 30911
> 1.4 -XX:+UseG1GC       -XX:+UseCompactObjectHeaders: 26008
> 
> 2. With Patch
> 2.1 -XX:+UseParallelGC -XX:-UseCompactObjectHeaders: 32820
> 2.2 -XX:+UseParallelGC -XX:+UseCompactObjectHeaders: 34179
> 2.3 -XX:+UseG1GC       -XX:-UseCompactObjectHeaders: 30620
> 2.4 -XX:+UseG1GC       -XX:+UseCompactObjectHeaders: 31936
> 
> 
> SPECjbb2015:
> 
> 1. Without Patch
> 1.1 -XX:+UseG1GC -XX:-UseCompactObjectHeaders: max-jOPS = 1444, critical-jOPS = 431
> 1.2 -XX:+UseG1GC -XX:+UseCompactObjectHeaders: max-jOPS = 1092, critical-jOPS = 335
> 
> 2. With Patch
> 2.1 -XX:+UseG1GC -XX:-UseCompactObjectHeaders: max-jOPS = 1452, critical-jOPS = 419
> 2.2 -XX:+UseG1GC -XX:+UseCompactObjectHeaders: max-jOPS = 1438, critical-jOPS = 477

Fei Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:

 - Review comment
 - Merge branch 'master' into JDK-8347489
 - Merge branch 'master' into JDK-8347489
 - Comment
 - Fix assertions
 - Add assertions
 - Comment
 - 8347489: RISC-V: Misaligned memory access with COH

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23053/files
  - new: https://git.openjdk.org/jdk/pull/23053/files/c093e451..2292cc60

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23053&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23053&range=03-04

  Stats: 24197 lines in 2856 files changed: 11082 ins; 6291 del; 6824 mod
  Patch: https://git.openjdk.org/jdk/pull/23053.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23053/head:pull/23053

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


More information about the hotspot-compiler-dev mailing list