RFR: 8296924: C2: assert(is_valid_AArch64_address(dest.target())) failed: bad address
Andrew Haley
aph at openjdk.org
Tue Nov 29 12:06:45 UTC 2022
On Tue, 29 Nov 2022 11:55:51 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
> With (unreachable) unsafe accesses, it can happen that the base address is invalid. On AArch64, C2 will emit a `loadConP` for loading the constant address that is implemented by [aarch64_enc_mov_p](https://github.com/openjdk/jdk/blob/48017b1d9c3a7867984f54d61f17c7f034d213f5/src/hotspot/cpu/aarch64/aarch64.ad#L3366) calling [MacroAssembler::adrp](https://github.com/openjdk/jdk/blob/48017b1d9c3a7867984f54d61f17c7f034d213f5/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L4576). The `adrp` implementation then asserts in [is_valid_AArch64_address](https://github.com/openjdk/jdk/blob/48017b1d9c3a7867984f54d61f17c7f034d213f5/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp#L1321), assuming that we can only ever load constant pointers that are within the 48-bit AArch64 address space.
>
> The fix, proposed by @theRealAph, is to emit a full-blown `mov` in case of a bad address.
>
> Thanks,
> Tobias
Thanks. That's obviously correct.
src/hotspot/cpu/aarch64/aarch64.ad line 3380:
> 3378: } else {
> 3379: assert(rtype == relocInfo::none, "unexpected reloc type");
> 3380: if (!__ is_valid_AArch64_address(con) ||
Suggestion:
if (! __ is_valid_AArch64_address(con) ||
-------------
Marked as reviewed by aph (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11412
More information about the hotspot-compiler-dev
mailing list