RFR: 8323497: On x64, use 32-bit immediate moves for narrow klass base if possible [v6]

Thomas Stuefe stuefe at openjdk.org
Thu May 22 13:41:20 UTC 2025


> On x64, we always use the long form of mov immediate to load the klass base into a register. If the klass base fits into 32 bits, we could use the short form and save four instruction bytes. 
> 
> Before: mov uses 10 instruction bytes:
> 
> 
>    35  ;; decode_klass_not_null
>    36   0x00007f8b089e51c4:   movabs $0x82000000,%r11
>    37   0x00007f8b089e51ce:   add    %r11,%r10
> 
> 
> Now: mov uses 6 instruction bytes:
> 
> 
>    35  ;; decode_klass_not_null
>    36   0x00007fbe609e51c4:   mov    $0x82000000,%r11d
>    37   0x00007fbe609e51ca:   add    %r11,%r10
> 
> 
> Note that this optimization does not depend on zero-based addressing, and therefore we change class space reservation: we now always look in low-address regions first.
> 
> ----------
> 
> Tests: tier1 (GHA), tier 2 on x64 linux

Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:

  fix COH

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17340/files
  - new: https://git.openjdk.org/jdk/pull/17340/files/af1e9804..a6f20a0b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17340&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17340&range=04-05

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/17340.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17340/head:pull/17340

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


More information about the hotspot-dev mailing list