mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
try harder to find a suitable stack frame site in pickTarget when there are no free registers left
This commit is contained in:
parent
7433abd402
commit
c9400316fd
@ -1153,7 +1153,7 @@ pickFrameTarget(Context* c, Value* v)
|
||||
do {
|
||||
if (p->home >= 0) {
|
||||
Target mine(p->home, MemoryOperand, frameCost(c, v, p->home));
|
||||
if (mine.cost == 0) {
|
||||
if (mine.cost == 1) {
|
||||
return mine;
|
||||
} else if (mine.cost < best.cost) {
|
||||
best = mine;
|
||||
@ -1165,6 +1165,24 @@ pickFrameTarget(Context* c, Value* v)
|
||||
return best;
|
||||
}
|
||||
|
||||
Target
|
||||
pickAnyFrameTarget(Context* c, Value* v)
|
||||
{
|
||||
Target best;
|
||||
|
||||
unsigned count = usableFrameSize(c) + c->parameterFootprint;
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
Target mine(i, MemoryOperand, frameCost(c, v, i));
|
||||
if (mine.cost == 1) {
|
||||
return mine;
|
||||
} else if (mine.cost < best.cost) {
|
||||
best = mine;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
Target
|
||||
pickTarget(Context* c, Read* read, bool intersectRead,
|
||||
unsigned registerReserveCount)
|
||||
@ -1221,6 +1239,14 @@ pickTarget(Context* c, Read* read, bool intersectRead,
|
||||
}
|
||||
}
|
||||
|
||||
if (best.cost > 3 and c->availableRegisterCount == 0) {
|
||||
// there are no free registers left, so moving from memory to
|
||||
// memory isn't an option - try harder to find an available frame
|
||||
// site:
|
||||
best = pickAnyFrameTarget(c, read->value);
|
||||
assert(c, best.cost <= 3);
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user