public abstract class FrameMap extends Object
StackSlot
is
used to index slots of the frame relative to the stack pointer. The frame size is only fixed
after register allocation when all spill slots have been allocated. Both the outgoing argument
area and the spill are can grow until then. Therefore, outgoing arguments are indexed from the
stack pointer, while spill slots are indexed from the beginning of the frame (and the total frame
size has to be added to get the actual offset from the stack pointer).Modifier and Type | Class and Description |
---|---|
static interface |
FrameMap.ReferenceMapBuilderFactory |
Modifier and Type | Field and Description |
---|---|
private boolean |
accessesCallerFrame
Records whether an offset to an incoming stack argument was ever returned by
offsetForStackSlot(StackSlot) . |
private int |
frameSize
The final frame size, not including the size of the
return address slot . |
private boolean |
hasOutgoingStackArguments
Determines if this frame has values on the stack for outgoing calls.
|
protected int |
initialSpillSize
Initial size of the area occupied by spill slots and other stack-allocated memory blocks.
|
private List<StackSlot> |
objectStackSlots
The list of stack slots allocated in this frame that are present in every reference map.
|
protected int |
outgoingSize
Size of the area occupied by outgoing overflow arguments.
|
private FrameMap.ReferenceMapBuilderFactory |
referenceMapFactory |
private RegisterConfig |
registerConfig |
protected int |
spillSize
Size of the area occupied by spill slots and other stack-allocated memory blocks.
|
private TargetDescription |
target |
Constructor and Description |
---|
FrameMap(CodeCacheProvider codeCache,
RegisterConfig registerConfig,
FrameMap.ReferenceMapBuilderFactory referenceMapFactory)
Creates a new frame map for the specified method.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accessesCallerFrame()
Determines if an offset to an incoming stack argument was ever returned by
offsetForStackSlot(StackSlot) . |
void |
addLiveValues(ReferenceMapBuilder refMap) |
protected void |
addObjectStackSlot(StackSlot objectSlot) |
protected abstract int |
alignFrameSize(int size)
Aligns the given frame size to the stack alignment size and return the aligned size.
|
protected abstract StackSlot |
allocateNewSpillSlot(LIRKind kind,
int additionalOffset)
Reserves a new spill slot in the frame of the method being compiled.
|
StackSlot |
allocateSpillSlot(LIRKind kind)
Reserves a spill slot in the frame of the method being compiled.
|
StackSlot |
allocateStackSlots(int slots,
BitSet objects)
Reserves a number of contiguous slots in the frame of the method being compiled.
|
protected int |
calleeSaveAreaSize() |
void |
callsMethod(CallingConvention cc)
Informs the frame map that the compiled code calls a particular method, which may need stack
space for outgoing arguments.
|
abstract int |
currentFrameSize()
Gets the current size of this frame.
|
void |
finish()
Computes the final size of this frame.
|
boolean |
frameNeedsAllocating()
Determines if any space is used in the frame apart from the
return address slot . |
int |
frameSize()
Gets the frame size of the compiled frame, not including the size of the
return address slot . |
RegisterConfig |
getRegisterConfig() |
TargetDescription |
getTarget() |
ReferenceMapBuilder |
newReferenceMapBuilder() |
int |
offsetForStackSlot(StackSlot slot)
Computes the offset of a stack slot relative to the frame register.
|
abstract int |
offsetToCalleeSaveArea()
Gets the offset from the stack pointer to the stack area where callee-saved registers are
stored.
|
int |
outgoingSize() |
void |
reserveOutgoing(int argsSize)
Reserves space for stack-based outgoing arguments.
|
protected int |
returnAddressSize() |
int |
spillSlotRangeSize(int slots)
Returns the size of the stack slot range for
slots objects. |
int |
spillSlotSize(LIRKind kind)
Returns the spill slot size for the given
LIRKind . |
abstract int |
totalFrameSize()
Gets the total frame size of the compiled frame, including the size of the
return address slot . |
private final TargetDescription target
private final RegisterConfig registerConfig
private final FrameMap.ReferenceMapBuilderFactory referenceMapFactory
private int frameSize
return address slot
. The value is only set after
register allocation is complete, i.e., after all spill slots have been allocated.protected int initialSpillSize
protected int spillSize
protected int outgoingSize
private boolean hasOutgoingStackArguments
private final List<StackSlot> objectStackSlots
private boolean accessesCallerFrame
offsetForStackSlot(StackSlot)
.public FrameMap(CodeCacheProvider codeCache, RegisterConfig registerConfig, FrameMap.ReferenceMapBuilderFactory referenceMapFactory)
public RegisterConfig getRegisterConfig()
public TargetDescription getTarget()
public void addLiveValues(ReferenceMapBuilder refMap)
protected int returnAddressSize()
protected int calleeSaveAreaSize()
public boolean accessesCallerFrame()
offsetForStackSlot(StackSlot)
.public int frameSize()
return address slot
.public int outgoingSize()
public boolean frameNeedsAllocating()
return address slot
.public abstract int totalFrameSize()
return address slot
.public abstract int currentFrameSize()
frameSize()
if finish()
were called now.protected abstract int alignFrameSize(int size)
size
- the initial frame size to be alignedpublic void finish()
public int offsetForStackSlot(StackSlot slot)
slot
- a stack slotpublic abstract int offsetToCalleeSaveArea()
public void callsMethod(CallingConvention cc)
cc
- The calling convention for the called method.public void reserveOutgoing(int argsSize)
argsSize
- The amount of space (in bytes) to reserve for stack-based outgoing arguments.protected abstract StackSlot allocateNewSpillSlot(LIRKind kind, int additionalOffset)
kind
- The kind of the spill slot to be reserved.additionalOffset
- public int spillSlotSize(LIRKind kind)
LIRKind
. The default value is the size in
bytes for the target architecture.kind
- the LIRKind
to be stored in the spill slot.public StackSlot allocateSpillSlot(LIRKind kind)
kind
- The kind of the spill slot to be reserved.public int spillSlotRangeSize(int slots)
slots
objects.slots
- The number of slots.public StackSlot allocateStackSlots(int slots, BitSet objects)
null
.slots
- the number of slots to reserveobjects
- specifies the indexes of the object pointer slots. The caller is responsible
for guaranteeing that each such object pointer slot is initialized before any
instruction that uses a reference map. Without this guarantee, the garbage
collector could see garbage object values.protected void addObjectStackSlot(StackSlot objectSlot)
public ReferenceMapBuilder newReferenceMapBuilder()