public final class Interval extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Interval.Pair
A pair of intervals.
|
(package private) static class |
Interval.RegisterBinding
Constants denoting whether an interval is bound to a specific register.
|
(package private) static class |
Interval.RegisterBindingLists
A set of interval lists, one per binding type.
|
static class |
Interval.RegisterPriority
Constants denoting the register usage priority for an interval.
|
static class |
Interval.SpillState
Constants used in optimization of spilling of an interval.
|
(package private) static class |
Interval.State
Constants denoting the linear-scan states an interval may be in with respect to the
start
position of the interval being processed. |
static class |
Interval.UsePosList
List of use positions.
|
Modifier and Type | Field and Description |
---|---|
private int |
cachedTo |
private Range |
current
Iterator used to traverse the ranges of an interval.
|
private Interval |
currentSplitChild
Current split child that has been active or inactive last (always stored in split parents).
|
(package private) static Interval |
EndMarker
Sentinel interval to denote the end of an interval list.
|
private Range |
first
The head of the list of ranges describing this interval.
|
private boolean |
insertMoveWhenActivated
Specifies if move is inserted between currentSplitChild and this interval when interval gets
active the first time.
|
private LIRKind |
kind
The kind of this interval.
|
private AllocatableValue |
location
The register or spill slot assigned to this
interval.
|
private Interval |
locationHint
This interval should be assigned the same location as the hint interval.
|
private JavaConstant |
materializedValue
The value with which a spilled child interval can be re-materialized.
|
(package private) Interval |
next
Link to next interval in a sorted list of intervals that ends with
EndMarker . |
private int |
numMaterializationValuesAdded
The number of times
addMaterializationValue(JavaConstant) is called. |
AllocatableValue |
operand
|
int |
operandNumber
The operand number for this interval's operand.
|
private int |
spillDefinitionPos
Position where this interval is defined (if defined only once).
|
private StackSlotValue |
spillSlot
The stack slot to which all splits of this interval are spilled if necessary.
|
private Interval.SpillState |
spillState
For spill move optimization.
|
private List<Interval> |
splitChildren
List of all intervals that are split off from this interval.
|
private Interval |
splitParent
The interval from which this one is derived.
|
(package private) Interval.State |
state
The linear-scan state of this interval.
|
private Interval.UsePosList |
usePosList
List of (use-positions, register-priorities) pairs, sorted by use-positions.
|
Constructor and Description |
---|
Interval(AllocatableValue operand,
int operandNumber) |
Modifier and Type | Method and Description |
---|---|
private Interval.RegisterPriority |
adaptPriority(Interval.RegisterPriority priority) |
void |
addMaterializationValue(JavaConstant value)
Sets the value which is used for re-materialization.
|
void |
addRange(int from,
int to) |
void |
addUsePos(int pos,
Interval.RegisterPriority registerPriority) |
boolean |
alwaysInMemory() |
(package private) void |
assignLocation(AllocatableValue newLocation) |
(package private) int |
calcTo() |
boolean |
canMaterialize()
Returns true if this interval can be re-materialized when spilled.
|
private boolean |
checkSplitChild(Interval result,
int opId,
LinearScan allocator,
int toOffset,
LIRInstruction.OperandMode mode) |
(package private) boolean |
checkSplitChildren() |
(package private) boolean |
covers(int opId,
LIRInstruction.OperandMode mode) |
(package private) boolean |
currentAtEnd() |
(package private) int |
currentFrom() |
(package private) boolean |
currentIntersects(Interval it) |
(package private) int |
currentIntersectsAt(Interval it) |
(package private) Interval |
currentSplitChild() |
(package private) int |
currentTo() |
Range |
first() |
(package private) int |
firstUsage(Interval.RegisterPriority minRegisterPriority) |
int |
from() |
(package private) Interval |
getIntervalCoveringOpId(int opId) |
JavaConstant |
getMaterializedValue()
Returns a value which can be moved to a register instead of a restore-move from stack.
|
(package private) Interval |
getSplitChildAtOpId(int opId,
LIRInstruction.OperandMode mode,
LinearScan allocator) |
(package private) Interval |
getSplitChildBeforeOpId(int opId) |
(package private) List<Interval> |
getSplitChildren() |
(package private) boolean |
hasHoleBetween(int holeFrom,
int holeTo) |
(package private) boolean |
insertMoveWhenActivated() |
(package private) boolean |
intersects(Interval i) |
(package private) int |
intersectsAt(Interval i) |
(package private) boolean |
isSplitChild() |
boolean |
isSplitParent() |
LIRKind |
kind() |
AllocatableValue |
location()
Gets the register or spill slot assigned to
this interval.
|
Interval |
locationHint(boolean searchSplitChild) |
String |
logString(LinearScan allocator)
Gets a single line string for logging the details of this interval to a log stream.
|
(package private) void |
makeCurrentSplitChild() |
(package private) Interval |
newSplitChild(LinearScan allocator) |
(package private) void |
nextRange() |
(package private) int |
nextUsage(Interval.RegisterPriority minRegisterPriority,
int from) |
(package private) int |
nextUsageExact(Interval.RegisterPriority exactRegisterPriority,
int from) |
(package private) int |
numUsePositions() |
(package private) int |
previousUsage(Interval.RegisterPriority minRegisterPriority,
int from) |
(package private) void |
removeFirstUsePos() |
(package private) void |
rewindRange() |
(package private) void |
setInsertMoveWhenActivated(boolean b) |
void |
setKind(LIRKind kind) |
void |
setLocationHint(Interval interval) |
void |
setSpillDefinitionPos(int pos) |
(package private) void |
setSpillSlot(StackSlotValue slot) |
void |
setSpillState(Interval.SpillState state) |
int |
spillDefinitionPos() |
(package private) StackSlotValue |
spillSlot()
Gets the canonical spill slot for this interval.
|
Interval.SpillState |
spillState() |
(package private) Interval |
split(int splitPos,
LinearScan allocator)
Splits this interval at a specified position and returns the remainder as a new child
interval of this interval's parent interval.
|
(package private) boolean |
splitChildCovers(int opId,
LIRInstruction.OperandMode mode) |
(package private) Interval |
splitFromStart(int splitPos,
LinearScan allocator)
Splits this interval at a specified position and returns the head as a new interval (this
interval is the tail).
|
Interval |
splitParent()
Gets the split parent for this interval.
|
(package private) int |
to() |
String |
toString() |
Interval.UsePosList |
usePosList()
Gets the use position information for this interval.
|
public final AllocatableValue operand
public final int operandNumber
private AllocatableValue location
Value.ILLEGAL
.private StackSlotValue spillSlot
private Range first
private Interval.UsePosList usePosList
Interval.State state
private int cachedTo
private Interval splitParent
private List<Interval> splitChildren
private Interval currentSplitChild
private boolean insertMoveWhenActivated
private Interval.SpillState spillState
private int spillDefinitionPos
private Interval locationHint
private JavaConstant materializedValue
private int numMaterializationValuesAdded
addMaterializationValue(JavaConstant)
is called.Interval(AllocatableValue operand, int operandNumber)
void assignLocation(AllocatableValue newLocation)
public AllocatableValue location()
public int from()
int to()
int numUsePositions()
public void setLocationHint(Interval interval)
public boolean isSplitParent()
boolean isSplitChild()
public Interval splitParent()
StackSlotValue spillSlot()
void setSpillSlot(StackSlotValue slot)
Interval currentSplitChild()
void makeCurrentSplitChild()
boolean insertMoveWhenActivated()
void setInsertMoveWhenActivated(boolean b)
public Interval.SpillState spillState()
public int spillDefinitionPos()
public void setSpillState(Interval.SpillState state)
public void setSpillDefinitionPos(int pos)
public boolean alwaysInMemory()
void removeFirstUsePos()
boolean intersects(Interval i)
int intersectsAt(Interval i)
void rewindRange()
void nextRange()
int currentFrom()
int currentTo()
boolean currentAtEnd()
boolean currentIntersects(Interval it)
int currentIntersectsAt(Interval it)
public void addMaterializationValue(JavaConstant value)
public boolean canMaterialize()
materializedValue
is restored.public JavaConstant getMaterializedValue()
int calcTo()
boolean checkSplitChildren()
public Interval locationHint(boolean searchSplitChild)
Interval getSplitChildAtOpId(int opId, LIRInstruction.OperandMode mode, LinearScan allocator)
private boolean checkSplitChild(Interval result, int opId, LinearScan allocator, int toOffset, LIRInstruction.OperandMode mode)
Interval getIntervalCoveringOpId(int opId)
Interval getSplitChildBeforeOpId(int opId)
boolean splitChildCovers(int opId, LIRInstruction.OperandMode mode)
private Interval.RegisterPriority adaptPriority(Interval.RegisterPriority priority)
int firstUsage(Interval.RegisterPriority minRegisterPriority)
int nextUsage(Interval.RegisterPriority minRegisterPriority, int from)
int nextUsageExact(Interval.RegisterPriority exactRegisterPriority, int from)
int previousUsage(Interval.RegisterPriority minRegisterPriority, int from)
public void addUsePos(int pos, Interval.RegisterPriority registerPriority)
public void addRange(int from, int to)
Interval newSplitChild(LinearScan allocator)
Interval split(int splitPos, LinearScan allocator)
When an interval is split, a bi-directional link is established between the original parent interval and the children intervals that are split off this interval. When a split child is split again, the new created interval is a direct child of the original parent. That is, there is no tree of split children stored, just a flat list. All split children are spilled to the same spill slot.
splitPos
- the position at which to split this intervalallocator
- the register allocator contextInterval splitFromStart(int splitPos, LinearScan allocator)
boolean covers(int opId, LIRInstruction.OperandMode mode)
boolean hasHoleBetween(int holeFrom, int holeTo)
public Interval.UsePosList usePosList()
public String logString(LinearScan allocator)
allocator
- the register allocator contextList<Interval> getSplitChildren()