RFR: 8362504: AArch64: Replace MOVZ+MOVK+MOVK with ADRP+ADD

Fei Gao fgao at openjdk.org
Wed Aug 6 09:19:51 UTC 2025


If the relocation or target address is guaranteed to reside within the CodeCache, we can safely replace a `movz + movk + movk` sequence with a more compact and efficient `adrp + add` instruction pair.

In `MacroAssembler::mov(Register r, Address dest)`, this replacement can be applied if any of the following rules hold:

1. The relocation type indicates that the address resides within the CodeCache and the necessary patching logic is provided in `fix_relocation_after_move()`.
2. The target address is fixed (i.e., does not require relocation) and is within the reachable range for `adrp`.

The patch performs the filtering in `is_relocated_within_codecache()` and `is_adrp_reachable()` to ensure this optimization is applied safely and selectively.

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

Commit messages:
 - 8362504: AArch64: Replace MOVZ+MOVK+MOVK with ADRP+ADD

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

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


More information about the hotspot-dev mailing list