Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/doc/diagnostics/CallingConventions.md
5985 views

This document describes the calling conventions for the JIT Private Linkage. The System Linkage info can be found in the Eclipse OMR Project.

x86

x86-64

RegisterJIT Private LinkageCaller Preserved1
RAX✔️
RBX
RCX4th int argument✔️
RDX3rd int argument✔️
RSPstack pointer
RBPcurrent vm thread
RSI2nd int argument✔️
RDI✔️
R8✔️
R9
R10✔️
R11✔️
R12✔️
R13✔️
R14✔️
R15✔️
XMM01st float argument; float return value✔️
XMM12nd float argument✔️
XMM23rd float argument✔️
XMM34th float argument✔️
XMM45th float argument✔️
XMM56th float argument✔️
XMM67th float argument✔️
XMM78th float argument✔️
XMM8
XMM9
XMM10
XMM11
XMM12
XMM13
XMM14
XMM15

  1. The remaining registers are Callee Preserved.

IA32

The IA32 calling convention in the private linkage pushes all arguments on to the stack in left-to-right order, i.e. in the case of an indirect call, the receiver object is furthest away from the top of the Java stack. The callee is responsible for cleaning up the pushed arguments. The return value is placed in EAX, or EDX:EAX for a long value. If SSE2 support is not available, the x87 floating-point stack is used for passing floating-point arguments and returning floating-point results. Otherwise, XMM registers are used.

POWER

Scratch registers are not preserved across calls, while non-volatile registers are preserved by called functions.

RegisterJIT Private linkage
R0Scratch
R1Untouched except for JNI setup
R2Scratch; Preserved in 32-bit Linux
R31st argument/return value
R42nd argument/low-order portion of 64-bit return values in 32-bit mode
R5-103rd-8th arguments; the 9th and above arguments are passed on the stack
R11Scratch (frequently used as a temp for call target address)
R12Scratch
R13vmThread (32-bit); OS dedicated (64-bit)
R14Java stack pointer
R15Non-volatile (32-bit); vmThread (64-bit)
R16Non-volatile (32-bit); JIT pseudo-TOC (64-bit)
R17-31Non-volatile
IARInstruction Address Register (a.k.a PC or NIP on Linux)
LRLink Register (used to pass the return address to a caller)
CTRCount Register (used for calling a far/variable target)
VSR32-63Scratch
CR0Condition Register (used by compare, branch and record-form instructions), scratch
CR1-7Condition Register (used by compare and branch instructions), scratch
FP01st Floating Point argument / Floating point return value
FP1-72nd-8th Floating Point argument
FP8-13Scratch
FP14-31Scratch

Z

zLinux

RegisterJIT Private Linkage1Callee Preserved
R0
R1parameter
R2parameter/return value
R3parameter/return value (long in 31-bit mode)
R4entry point
R5Java stack pointer✔️
R6literal pool (unless dynamically optimized away)✔️
R7extended code base✔️
R8-R11✔️
R12✔️
R13vmThread✔️
R14return address✔️
R15system stack pointer✔️
F0parameter/return value
F1
F2parameter
F3
F4parameter
F5
F6parameter
F7
F8-F15✔️

z/OS

RegisterJIT Private Linkage1Callee Preserved
R0
R1parameter
R2parameter/return value
R3parameter/return value (long in 31-bit mode)
R4system stack pointer✔️
R5Java stack pointer✔️
R6literal pool (unless dynamically optimized away)✔️
R7extended code base✔️
R8-R11✔️
R12✔️
R13vmThread✔️
R14return address✔️
R15entry point
F0parameter/return value
F1
F2parameter
F3
F4parameter
F5
F6parameter
F7
F8-F15✔️

  1. The JIT linkage uses the following conventions for high-word registers (HPRs) z196 support is enabled:

    • On 31-bit platforms, all HPRs are volatile.

    • On 64-bit platforms, HPR6 through HPR12 are preserved, and all other HPRs are volatile.

32-bit Arm

Scratch registers are not preserved across calls, while non-volatile registers are preserved by called functions. Usage of the VFP registers in this table assumes hard-float ABI.

RegisterJIT Private Linkage
R01st argument / return value
R12nd argument / return value
R2-33rd-4th arguments
R4-5Scratch
R6Java BP
R7Java stack pointer
R8vmThread
R9-10Non-volatile
R11Scratch
R12Untouched
R13Untouched except for JNI setup
R14Link Register (LR)
R15Program Counter (PC)
D0-15Scratch1
D16-D31Untouched2

  1. Floating point arguments and return value are passed in GPRs in JIT Private Linkage.

  2. Unavailable in some VFP versions

AArch64 (64-bit Arm)

Scratch registers are not preserved across calls, while non-volatile registers are preserved by called functions.

RegisterJIT Private Linkage
R01st argument / return value
R1-72nd-8th arguments
R8-15Scratch
R16-17Untouched
R18Scratch
R19vmThread
R20Java stack pointer
R21-28Non-volatile
R29Untouched
R30Link Register (LR)
SPUntouched except for JNI setup
PCProgram Counter (PC)
V01st floating point argument / floating point return value
V1-72nd-8th floating point arguments
V8-31Scratch