dotnet / dotnet/runtime

[x64\[APX]Add support in JIT for jmpabs and use jmpabs where possible.

Open
#131,817 18 comments 0 reactions 1 assignee Claimed by @DeepakRajendrakumaran View on GitHub
apx area-CodeGen-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Add support for the APX JMPABS instruction in the .NET JIT compiler and use it to optimize virtual call stubs on x64.

What is JMPABS?
APX (Advanced Performance Extensions) introduces the JMPABS instruction - a direct absolute 64-bit jump encoded in 11 bytes:

`D5 00 A1 [8-byte address] ; jmpabs `

Advantages over existing jumps
More compact than register-indirect jumps:

Legacy: mov rax, imm64; jmp rax = 12 bytes
JMPABS: 11 bytes (saves 1 byte, no register clobbering)
More flexible than relative jumps:

Relative jump (jmp rel32): limited to ±2GB range, 5 bytes
JMPABS: can reach any 64-bit address, 11 bytes
Cleaner than register-indirect:

No register allocation/spilling required
No data dependencies on register state
Direct encoding of target address

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.