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

Tobias Hartmann thartmann at openjdk.org
Tue Nov 29 12:15:32 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

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  Update src/hotspot/cpu/aarch64/aarch64.ad
  
  Co-authored-by: Andrew Haley <aph-open at littlepinkcloud.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11412/files
  - new: https://git.openjdk.org/jdk/pull/11412/files/fa945fa3..453e6638

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11412&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11412&range=00-01

  Stats: 1 line in 1 file changed: 0 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