public final class StackframeLayoutConstants extends Object
----------------------------------------------------------------------- Stackframe layout conventions - Intel version. -----------------------------------------------------------------------A stack is an array of "slots", declared formally as integers, each slot containing either a primitive (byte, int, float, etc), an object pointer, a machine code pointer (a return address pointer), or a pointer to another slot in the same stack (a frame pointer). The interpretation of a slot's contents depends on the current value of IP, the machine instruction address register. Each machine code generator provides maps, for use by the garbage collector, that tell how to interpret the stack slots at "safe points" in the program's execution.
Here's a picture of what a stack might look like in memory.
Note: this (array) object is drawn upside down compared to other objects because the hardware stack grows from high memory to low memory, but array objects are layed out from low memory to high (header first).
hi-memory +---------------+ ... | IP=0 | . +---------------+ . +-> | FP=0 | <-- "end of vm stack" sentinel . | +---------------+ . caller's frame | | cmid=0 | <-- "invisible method" id . | +---------------+ ---. | | parameter0 | \ | . | +---------------+ \ parameter area | . | | parameter1 | / (== caller's operand stack area) | . --- | +---------------+ / |... | | | saved IP | <-- return address (in caller) | | \ +---------------+ | header FP-> | saved FP | <-- this frame's caller's frame | | +---------------+ | | | cmid | <-- this frame's compiledmethod id | | +---------------+ | | | saved GPRs | \ | | +---------------+ \ nonvolatile register save area | | | saved FPRS | / | frame | +---------------+ | | | local0 | \ | body +---------------+ \_local variables area | | | local1 | / | | +---------------+ / | | | operand0 | \ | | +---------------+ \_operand stack area | | SP-> | operand1 | / | | +---------------+ / | | | ... | | --- +===============+ --- | ... | +---------------+ stackLimit-> | ... | \ +---------------+ \_guard region for detecting & processing stack overflow | ... | / +---------------+ / |(object header)| low-memory +---------------+The opt compiler uses a different stackframe layout
hi-memory +---------------+ ... | IP=0 | . +---------------+ . +-> | FP=0 | <-- "end of vm stack" sentinel . | +---------------+ . caller's frame | | cmid=-1 | <-- "invisible method" id . | +---------------+ ---. | | parameter0 | \ | . | +---------------+ \ parameter area | . | | parameter1 | / (== caller's operand stack area) | . --- | +---------------+ / |... | | | saved IP | <-- return address (in caller) | | \ +---------------+ | header FP-> | saved FP | <-- this frame's caller's frame | | +---------------+ | | | cmid | <-- this frame's compiledmethod id | --- +---------------+ | | | | | | | Spill Area | <-- spills and other method-specific | | | ... | compiler-managed storage | | +---------------+ | | | Saved FP | only SaveVolatile Frames | | | State | | | +---------------+ | | | VolGPR[0] | | | | ... | only SaveVolatile Frames | | | VolGPR[n] | | | +---------------+ | body | NVolGPR[k] | <-- info.getUnsignedNonVolatileOffset() | frame | | ... | k == info.getFirstNonVolatileGPR() | | | NVolGPR[n] | | | +---------------+ | | | NVolFPR[k] | | | | ... | k == info.getFirstNonVolatileFPR() | | | NVolFPR[n] | | | +---------------+ | | | parameter0 | \ | | +---------------+ \_parameters to callee frame | | SP-> | parameter1 | / | | +---------------+ / | | | ... | | --- +===============+ --- | ... | +---------------+ stackLimit-> | ... | \ +---------------+ \_guard region for detecting & processing stack overflow | ... | / +---------------+ / |(object header)| low-memory +---------------+
Modifier and Type | Field and Description |
---|---|
static int |
BYTES_IN_STACKSLOT |
static int |
FPU_STATE_SIZE
space to save entire FPU state.
|
static int |
INVISIBLE_METHOD_ID
marker for "assembler" frames that have no associated RVMMethod
|
static int |
LOG_BYTES_IN_STACKSLOT |
static int |
STACK_SIZE_BOOT
total stack space to allocate for boot thread (includes guard region)
|
static int |
STACK_SIZE_COLLECTOR
total stack space to allocate for collector thread (includes guard region)
|
static int |
STACK_SIZE_DLOPEN
max space needed for dlopen sys call
|
static int |
STACK_SIZE_GCDISABLED
max space needed while running with gc disabled
|
static int |
STACK_SIZE_GROW
how much to grow stack when overflow detected
|
static int |
STACK_SIZE_GUARD
max space needed for stack overflow trap processing
|
static int |
STACK_SIZE_JNINATIVE_GROW |
static int |
STACK_SIZE_MAX
upper limit on stack size (includes guard region)
|
static int |
STACK_SIZE_NORMAL
initial stack space to allocate for normal thread (includes guard region)
|
static int |
STACK_SIZE_SYSCALL
max space needed for any native code called by vm
|
static int |
STACKFRAME_ALIGNMENT |
static Offset |
STACKFRAME_BODY_OFFSET
offset of work area from FP
|
static Offset |
STACKFRAME_FRAME_POINTER_OFFSET
base of this frame
|
static int |
STACKFRAME_HEADER_SIZE
size of frame header, in bytes
|
static Offset |
STACKFRAME_METHOD_ID_OFFSET
offset of method id from FP
|
static Offset |
STACKFRAME_RETURN_ADDRESS_OFFSET
offset of caller's return address from FP
|
static Address |
STACKFRAME_SENTINEL_FP
fp value indicating end of stack walkback
|
static int |
XMM_STATE_SIZE
Currently only use the low 8 bytes, only use 4 SSE2 params
|
Modifier | Constructor and Description |
---|---|
private |
StackframeLayoutConstants() |
public static final int LOG_BYTES_IN_STACKSLOT
public static final int BYTES_IN_STACKSLOT
public static final Offset STACKFRAME_RETURN_ADDRESS_OFFSET
public static final Offset STACKFRAME_FRAME_POINTER_OFFSET
public static final Offset STACKFRAME_METHOD_ID_OFFSET
public static final Offset STACKFRAME_BODY_OFFSET
public static final int STACKFRAME_HEADER_SIZE
public static final int FPU_STATE_SIZE
public static final int XMM_STATE_SIZE
public static final Address STACKFRAME_SENTINEL_FP
public static final int INVISIBLE_METHOD_ID
public static final int STACKFRAME_ALIGNMENT
public static final int STACK_SIZE_GROW
public static final int STACK_SIZE_GUARD
public static final int STACK_SIZE_SYSCALL
public static final int STACK_SIZE_DLOPEN
public static final int STACK_SIZE_GCDISABLED
public static final int STACK_SIZE_NORMAL
public static final int STACK_SIZE_BOOT
public static final int STACK_SIZE_COLLECTOR
public static final int STACK_SIZE_MAX
public static final int STACK_SIZE_JNINATIVE_GROW
private StackframeLayoutConstants()