RFR: 8351839: RISC-V: Fix base offset calculation introduced in JDK-8347489

Fei Yang fyang at openjdk.org
Wed Mar 12 11:55:25 UTC 2025


As discussed in https://github.com/openjdk/jdk/pull/23633#discussion_r1974591975, there is no need to distinuish `T_BYTE` and `T_CHAR` when calculating base offset for strings.
The reason is that the low-level character storage used for both Latin1 and UTF16 strings is always a byte array [1].
So we should always use `T_BYTE` for both cases. This won't make a difference on the calculated base offset for now.
But it's better to fix this for code readability purposes. Sanity tested on linux-riscv64 w/wo COH.

[1] https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/String.java#L160

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

Commit messages:
 - 8351839: RISC-V: Fix base offset calculation introduced in JDK-8347489

Changes: https://git.openjdk.org/jdk/pull/24006/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24006&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351839
  Stats: 14 lines in 2 files changed: 0 ins; 6 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/24006.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24006/head:pull/24006

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


More information about the hotspot-compiler-dev mailing list