remove stack manipulation from NativeCallingConvention calls

This commit is contained in:
Joshua Warner 2014-05-01 20:30:28 -06:00 committed by Joshua Warner
parent fe2962830c
commit cfc3bd212b

View File

@ -76,8 +76,6 @@ Site*
pickSiteOrMove(Context* c, Value* src, Value* dst, Site* nextWord, pickSiteOrMove(Context* c, Value* src, Value* dst, Site* nextWord,
unsigned index); unsigned index);
void push(Context* c, unsigned footprint, Value* v);
Site* Site*
pickTargetSite(Context* c, Read* read, bool intersectRead = false, pickTargetSite(Context* c, Read* read, bool intersectRead = false,
unsigned registerReserveCount = 0, unsigned registerReserveCount = 0,
@ -232,7 +230,6 @@ Value* pushWordSlice(Context* c,
size_t index UNUSED = slice.count; size_t index UNUSED = slice.count;
Stack* s = stack(c, v, c->stack);
assert(c, slice.count < slice.capacity); assert(c, slice.count < slice.capacity);
slice.push(v); slice.push(v);
@ -240,12 +237,9 @@ Value* pushWordSlice(Context* c,
// fprintf(stderr, "push %p\n", v); // fprintf(stderr, "push %p\n", v);
// } // }
assert(c, s->index == index + stackBase);
if (v) { if (v) {
v->home = frameIndex(c, s->index + c->localFootprint); v->home = frameIndex(c, index + stackBase + c->localFootprint);
} }
c->stack = s;
return v; return v;
} }
@ -295,7 +289,7 @@ class CallEvent: public Event {
public: public:
CallEvent(Context* c, CallEvent(Context* c,
Value* address, Value* address,
ir::CallingConvention callingConvention UNUSED, ir::CallingConvention callingConvention,
unsigned flags, unsigned flags,
TraceHandler* traceHandler, TraceHandler* traceHandler,
Value* result, Value* result,
@ -392,7 +386,6 @@ class CallEvent: public Event {
Stack* stack = stackBefore; Stack* stack = stackBefore;
if (callingConvention == ir::AvianCallingConvention) { if (callingConvention == ir::AvianCallingConvention) {
// assert(c, argumentStack = )
for (int i = stackArgumentFootprint - 1; i >= 0; --i) { for (int i = stackArgumentFootprint - 1; i >= 0; --i) {
Value* v = static_cast<Value*>(arguments[i]); Value* v = static_cast<Value*>(arguments[i]);
stack = stack->next; stack = stack->next;
@ -1036,7 +1029,7 @@ appendCombine(Context* c, lir::TernaryOperation type,
if (thunk) { if (thunk) {
FixedSliceStack<ir::Value*, 6> slice; FixedSliceStack<ir::Value*, 6> slice;
Stack* oldStack = c->stack; Stack* oldStack UNUSED = c->stack;
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
bool threadParameter; bool threadParameter;
@ -1063,8 +1056,7 @@ appendCombine(Context* c, lir::TernaryOperation type,
pushSlice(c, 1, threadRegister(c), stackBase, slice); pushSlice(c, 1, threadRegister(c), stackBase, slice);
} }
// assert(c, c->stack == oldStack); assert(c, c->stack == oldStack);
c->stack = oldStack;
appendCall(c, appendCall(c,
value(c, value(c,
@ -1180,7 +1172,7 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
resultSize, &thunk); resultSize, &thunk);
if (thunk) { if (thunk) {
Stack* oldStack = c->stack; Stack* oldStack UNUSED = c->stack;
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
FixedSliceStack<ir::Value*, 2> slice; FixedSliceStack<ir::Value*, 2> slice;
@ -1190,8 +1182,7 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
stackBase, stackBase,
slice); slice);
// assert(c, c->stack == oldStack); assert(c, c->stack == oldStack);
c->stack = oldStack;
appendCall(c, appendCall(c,
value(c, value(c,
@ -1543,7 +1534,7 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
if (thunk) { if (thunk) {
FixedSliceStack<ir::Value*, 4> slice; FixedSliceStack<ir::Value*, 4> slice;
Stack* oldStack = c->stack; Stack* oldStack UNUSED = c->stack;
size_t stackBase = c->stack ? c->stack->index + 1 : 0; size_t stackBase = c->stack ? c->stack->index + 1 : 0;
bool threadParameter; bool threadParameter;
@ -1563,8 +1554,7 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
stackBase, stackBase,
slice); slice);
// assert(c, c->stack == oldStack); assert(c, c->stack == oldStack);
c->stack = oldStack;
Value* result Value* result
= value(c, ir::Type(ir::Type::Address, vm::TargetBytesPerWord)); = value(c, ir::Type(ir::Type::Address, vm::TargetBytesPerWord));