class LinearScanWalker extends IntervalWalker
Modifier and Type | Field and Description |
---|---|
protected Register[] |
availableRegs |
protected int[] |
blockPos |
private static List<Interval> |
EMPTY_LIST
Only 10% of the lists in
spillIntervals are actually used. |
private int |
maxReg |
private int |
minReg |
private MoveResolver |
moveResolver |
protected List<Interval>[] |
spillIntervals |
protected int[] |
usePos |
activeLists, allocator, currentBinding, currentPosition, inactiveLists, unhandledLists
Constructor and Description |
---|
LinearScanWalker(LinearScan allocator,
Interval unhandledFixedFirst,
Interval unhandledAnyFirst) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
activateCurrent(Interval interval)
Processes the
currentInterval interval in an attempt to allocate a physical register
to it and thus allow it to be moved to a list of active intervals. |
(package private) boolean |
allocFreeRegister(Interval interval) |
(package private) void |
allocLockedRegister(Interval interval) |
(package private) AbstractBlockBase<?> |
blockAt(int idx) |
(package private) int |
blockCount() |
(package private) AbstractBlockBase<?> |
blockOfOpWithId(int opId) |
private void |
changeSpillState(Interval interval,
int spillPos) |
(package private) void |
combineSpilledIntervals(Interval interval) |
(package private) void |
excludeFromUse(Interval i) |
(package private) int |
findOptimalSplitPos(AbstractBlockBase<?> minBlock,
AbstractBlockBase<?> maxBlock,
int maxSplitPos) |
(package private) int |
findOptimalSplitPos(Interval interval,
int minSplitPos,
int maxSplitPos,
boolean doLoopOptimization) |
void |
finishAllocation() |
(package private) void |
freeCollectInactiveAny(Interval current) |
(package private) void |
freeCollectInactiveFixed(Interval current) |
(package private) void |
freeCollectUnhandled(Interval.RegisterBinding kind,
Interval current) |
(package private) void |
freeExcludeActiveAny() |
(package private) void |
freeExcludeActiveFixed() |
protected void |
handleSpillSlot(Interval interval)
This is called for every interval that is assigned to a stack slot.
|
(package private) void |
initUseLists(boolean onlyProcessUsePos) |
(package private) void |
initVarsForAlloc(Interval interval) |
(package private) void |
insertMove(int operandId,
Interval srcIt,
Interval dstIt) |
(package private) static boolean |
isMove(LIRInstruction op,
Interval from,
Interval to) |
(package private) boolean |
isRegisterInRange(int reg) |
(package private) int |
maxRegisterNumber() |
(package private) int |
minRegisterNumber() |
(package private) boolean |
noAllocationPossible(Interval interval) |
(package private) void |
printRegisterState() |
(package private) void |
setBlockPos(Interval i,
int blockPos) |
(package private) void |
setUsePos(Interval interval,
int usePos,
boolean onlyProcessUsePos) |
(package private) void |
spillBlockInactiveFixed(Interval current) |
(package private) void |
spillBlockUnhandledFixed(Interval current) |
(package private) void |
spillCollectActiveAny(Interval.RegisterPriority registerPriority) |
(package private) void |
spillCollectInactiveAny(Interval current) |
(package private) void |
spillExcludeActiveFixed() |
(package private) void |
splitAndSpillIntersectingIntervals(Register reg) |
(package private) void |
splitAndSpillInterval(Interval interval) |
(package private) void |
splitBeforeUsage(Interval interval,
int minSplitPos,
int maxSplitPos) |
(package private) void |
splitForSpilling(Interval interval) |
(package private) void |
splitStackInterval(Interval interval) |
(package private) void |
splitWhenPartialRegisterAvailable(Interval interval,
int registerAvailableUntil) |
removeFromList, walk, walkBefore, walkTo
protected Register[] availableRegs
protected final int[] usePos
protected final int[] blockPos
protected List<Interval>[] spillIntervals
private MoveResolver moveResolver
private int minReg
private int maxReg
private static final List<Interval> EMPTY_LIST
spillIntervals
are actually used. But when they are used,
they can grow quite long. The maximum length observed was 45 (all numbers taken from a
bootstrap run of Graal). Therefore, we initialize spillIntervals
with this marker
value, and allocate a "real" list only on demand in setUsePos(com.oracle.graal.lir.alloc.lsra.Interval, int, boolean)
.LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst)
int blockCount()
AbstractBlockBase<?> blockAt(int idx)
AbstractBlockBase<?> blockOfOpWithId(int opId)
void initUseLists(boolean onlyProcessUsePos)
int maxRegisterNumber()
int minRegisterNumber()
boolean isRegisterInRange(int reg)
void excludeFromUse(Interval i)
void setBlockPos(Interval i, int blockPos)
void freeExcludeActiveFixed()
void freeExcludeActiveAny()
void freeCollectInactiveFixed(Interval current)
void freeCollectInactiveAny(Interval current)
void freeCollectUnhandled(Interval.RegisterBinding kind, Interval current)
void spillExcludeActiveFixed()
void spillBlockUnhandledFixed(Interval current)
void spillBlockInactiveFixed(Interval current)
void spillCollectActiveAny(Interval.RegisterPriority registerPriority)
void spillCollectInactiveAny(Interval current)
void insertMove(int operandId, Interval srcIt, Interval dstIt)
int findOptimalSplitPos(AbstractBlockBase<?> minBlock, AbstractBlockBase<?> maxBlock, int maxSplitPos)
int findOptimalSplitPos(Interval interval, int minSplitPos, int maxSplitPos, boolean doLoopOptimization)
void splitBeforeUsage(Interval interval, int minSplitPos, int maxSplitPos)
void splitForSpilling(Interval interval)
private void changeSpillState(Interval interval, int spillPos)
protected void handleSpillSlot(Interval interval)
void splitStackInterval(Interval interval)
void splitWhenPartialRegisterAvailable(Interval interval, int registerAvailableUntil)
void splitAndSpillInterval(Interval interval)
boolean allocFreeRegister(Interval interval)
void splitAndSpillIntersectingIntervals(Register reg)
void allocLockedRegister(Interval interval)
void printRegisterState()
boolean noAllocationPossible(Interval interval)
void initVarsForAlloc(Interval interval)
static boolean isMove(LIRInstruction op, Interval from, Interval to)
void combineSpilledIntervals(Interval interval)
protected boolean activateCurrent(Interval interval)
IntervalWalker
currentInterval
interval in an attempt to allocate a physical register
to it and thus allow it to be moved to a list of active intervals.activateCurrent
in class IntervalWalker
true
if a register was allocated to the currentInterval
intervalpublic void finishAllocation()