RFR: 8306667: RISC-V: Fix storeImmN0 matching rule by using zr register
Guoxiong Li
gli at openjdk.org
Thu May 11 23:16:49 UTC 2023
On Fri, 21 Apr 2023 10:16:44 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:
> The `storeImmN0` in the RISC-V backend missed a `CompressedOops::base() == NULL` predication. Under non-zero-based compressed oops mode, the `xheapbase` can be a non-zero value and crashes the VM.
>
> Reproduced by `<JDK>/bin/java -Xcomp -XX:HeapBaseMinAddress=72030M -version` simply. A hs_err file is attached in the JBS issue.
>
> x86 uses `r12` as a zero register in `storeImmN0`, but RISC-V has a zero register so we can use it to implement the matching rule.
>
> Testing in progress.
>
> Thanks,
> Xiaolin
A potential issue in the comment of [iRegIHeapbase](https://github.com/openjdk/jdk/blob/302bc2fd7fdfc02314e22ecc34ba2c78ef5ca9a1/src/hotspot/cpu/riscv/riscv.ad#L3544):
// heap base register -- used for encoding immN0
operand iRegIHeapbase()
And unfortunately, `aarch64` has the same issue in [iRegIHeapbase](https://github.com/openjdk/jdk/blob/302bc2fd7fdfc02314e22ecc34ba2c78ef5ca9a1/src/hotspot/cpu/aarch64/aarch64.ad#L5241) since [JDK-8242449](https://bugs.openjdk.org/browse/JDK-8242449).
They can be fixed together in a follow-up patch. Or only fix the `riscv64` part in this patch and fix the `aarch64` part in another patch.
>> And unfortunately, aarch64 has the same issue in [iRegIHeapbase](https://github.com/openjdk/jdk/blob/302bc2fd7fdfc02314e22ecc34ba2c78ef5ca9a1/src/hotspot/cpu/aarch64/aarch64.ad#L5241) since [JDK-8242449](https://bugs.openjdk.org/browse/JDK-8242449).
>
> Though, I think the AArch64 backend does not have this issue because it has the [CompressedOops::base() == NULL && CompressedKlassPointers::base() == NULL](https://hg.openjdk.org/jdk/jdk/rev/aedc9bf21743#l1.24) guard before JDK-8242449 - if I understand your comments correctly?
`the same issue` I mentioned means `the same unnecessary comments`. Sorry for the ambiguity.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13577#issuecomment-1535867825
PR Comment: https://git.openjdk.org/jdk/pull/13577#issuecomment-1536010896
More information about the hotspot-compiler-dev
mailing list