RFR: 8296924: C2: assert(is_valid_AArch64_address(dest.target())) failed: bad address

Tobias Hartmann thartmann at openjdk.org
Tue Nov 29 12:06:43 UTC 2022


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

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

Commit messages:
 - 8296924: C2: assert(is_valid_AArch64_address(dest.target())) failed: bad address

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

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


More information about the hotspot-compiler-dev mailing list