mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
respect constraints specified by Assembler::plan in MoveEvent::compile
This commit is contained in:
parent
21c5eb2d9e
commit
790e2fee42
@ -817,6 +817,7 @@ class VirtualSite: public AbstractSite {
|
|||||||
if (site) {
|
if (site) {
|
||||||
return site;
|
return site;
|
||||||
} else {
|
} else {
|
||||||
|
assert(c, typeMask & (1 << RegisterOperand));
|
||||||
return freeRegisterSite(c, registerMask);
|
return freeRegisterSite(c, registerMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1267,7 +1268,7 @@ class CallEvent: public Event {
|
|||||||
} else {
|
} else {
|
||||||
target = 0;
|
target = 0;
|
||||||
s->pushEvent->active = true;
|
s->pushEvent->active = true;
|
||||||
++ argumentFootprint;
|
argumentFootprint += s->size;
|
||||||
}
|
}
|
||||||
addRead(c, s->value, s->size * BytesPerWord, target);
|
addRead(c, s->value, s->size * BytesPerWord, target);
|
||||||
index += s->size;
|
index += s->size;
|
||||||
@ -1406,8 +1407,8 @@ appendReturn(Context* c, unsigned size, Value* value)
|
|||||||
class MoveEvent: public Event {
|
class MoveEvent: public Event {
|
||||||
public:
|
public:
|
||||||
MoveEvent(Context* c, BinaryOperation type, unsigned size, Value* src,
|
MoveEvent(Context* c, BinaryOperation type, unsigned size, Value* src,
|
||||||
Value* dst, Site* srcTarget):
|
Value* dst, Site* srcTarget, VirtualSite* dstTarget):
|
||||||
Event(c), type(type), size(size), src(src), dst(dst)
|
Event(c), type(type), size(size), src(src), dst(dst), dstTarget(dstTarget)
|
||||||
{
|
{
|
||||||
addRead(c, src, size, srcTarget);
|
addRead(c, src, size, srcTarget);
|
||||||
}
|
}
|
||||||
@ -1429,6 +1430,9 @@ class MoveEvent: public Event {
|
|||||||
} else {
|
} else {
|
||||||
target = targetOrRegister(c, dst);
|
target = targetOrRegister(c, dst);
|
||||||
cost = src->source->copyCost(c, target);
|
cost = src->source->copyCost(c, target);
|
||||||
|
if (type != Move) {
|
||||||
|
++ cost;
|
||||||
|
}
|
||||||
if (cost == 0) {
|
if (cost == 0) {
|
||||||
target = src->source;
|
target = src->source;
|
||||||
}
|
}
|
||||||
@ -1441,7 +1445,20 @@ class MoveEvent: public Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cost) {
|
if (cost) {
|
||||||
apply(c, type, size, src->source, target);
|
if (match(c, target, dstTarget->typeMask, dstTarget->registerMask)) {
|
||||||
|
apply(c, type, size, src->source, target);
|
||||||
|
} else {
|
||||||
|
assert(c, dstTarget->typeMask & (1 << RegisterOperand));
|
||||||
|
|
||||||
|
Site* tmpTarget = freeRegisterSite(c, dstTarget->registerMask);
|
||||||
|
|
||||||
|
addSite(c, stack, size, dst, tmpTarget);
|
||||||
|
|
||||||
|
apply(c, type, size, src->source, tmpTarget);
|
||||||
|
apply(c, Move, max(size, BytesPerWord), tmpTarget, target);
|
||||||
|
|
||||||
|
removeSite(c, dst, tmpTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst->reads == 0) {
|
if (dst->reads == 0) {
|
||||||
@ -1453,6 +1470,7 @@ class MoveEvent: public Event {
|
|||||||
unsigned size;
|
unsigned size;
|
||||||
Value* src;
|
Value* src;
|
||||||
Value* dst;
|
Value* dst;
|
||||||
|
VirtualSite* dstTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1475,7 +1493,7 @@ appendMove(Context* c, BinaryOperation type, unsigned size, Value* src,
|
|||||||
assert(c, procedure == 0); // todo
|
assert(c, procedure == 0); // todo
|
||||||
|
|
||||||
new (c->zone->allocate(sizeof(MoveEvent)))
|
new (c->zone->allocate(sizeof(MoveEvent)))
|
||||||
MoveEvent(c, type, size, src, dst, srcTarget);
|
MoveEvent(c, type, size, src, dst, srcTarget, dstTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CompareEvent: public Event {
|
class CompareEvent: public Event {
|
||||||
@ -1590,8 +1608,8 @@ appendCombine(Context* c, BinaryOperation type, unsigned size, Value* first,
|
|||||||
|
|
||||||
Stack* oldStack = c->state->stack;
|
Stack* oldStack = c->state->stack;
|
||||||
|
|
||||||
::push(c, size, second);
|
|
||||||
::push(c, size, first);
|
::push(c, size, first);
|
||||||
|
::push(c, size, second);
|
||||||
|
|
||||||
Stack* argumentStack = c->state->stack;
|
Stack* argumentStack = c->state->stack;
|
||||||
c->state->stack = oldStack;
|
c->state->stack = oldStack;
|
||||||
@ -1690,7 +1708,7 @@ class MemoryEvent: public Event {
|
|||||||
nextRead(c, base);
|
nextRead(c, base);
|
||||||
if (index) {
|
if (index) {
|
||||||
if (BytesPerWord == 8) {
|
if (BytesPerWord == 8) {
|
||||||
apply(c, Move4To8, 0, index->source, index->source);
|
apply(c, Move4To8, 8, index->source, index->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
nextRead(c, index);
|
nextRead(c, index);
|
||||||
|
@ -1941,6 +1941,7 @@ class MyAssembler: public Assembler {
|
|||||||
|
|
||||||
case Divide:
|
case Divide:
|
||||||
if (BytesPerWord == 4 and size == 8) {
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
*bTypeMask = ~static_cast<uint8_t>(0);
|
||||||
*procedure = reinterpret_cast<uintptr_t>(divideLong);
|
*procedure = reinterpret_cast<uintptr_t>(divideLong);
|
||||||
} else {
|
} else {
|
||||||
*aRegisterMask = ~((1 << rax) | (1 << rdx));
|
*aRegisterMask = ~((1 << rax) | (1 << rdx));
|
||||||
@ -1950,6 +1951,7 @@ class MyAssembler: public Assembler {
|
|||||||
|
|
||||||
case Remainder:
|
case Remainder:
|
||||||
if (BytesPerWord == 4 and size == 8) {
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
*bTypeMask = ~static_cast<uint8_t>(0);
|
||||||
*procedure = reinterpret_cast<uintptr_t>(moduloLong);
|
*procedure = reinterpret_cast<uintptr_t>(moduloLong);
|
||||||
} else {
|
} else {
|
||||||
*aRegisterMask = ~((1 << rax) | (1 << rdx));
|
*aRegisterMask = ~((1 << rax) | (1 << rdx));
|
||||||
|
Loading…
Reference in New Issue
Block a user