remove stack manipulation from AvianCallingConvention loop

This commit is contained in:
Joshua Warner 2014-05-01 20:56:47 -06:00 committed by Joshua Warner
parent 9f36a8e0ec
commit d62d083733
3 changed files with 4 additions and 7 deletions

View File

@ -2502,6 +2502,7 @@ class MyCompiler: public Compiler {
Slice<ir::Value*> arguments) Slice<ir::Value*> arguments)
{ {
Value* result = value(&c, resultType); Value* result = value(&c, resultType);
Stack* b UNUSED = c.stack;
appendCall(&c, appendCall(&c,
static_cast<Value*>(address), static_cast<Value*>(address),
ir::AvianCallingConvention, ir::AvianCallingConvention,
@ -2510,6 +2511,7 @@ class MyCompiler: public Compiler {
result, result,
resultType.size(), resultType.size(),
arguments); arguments);
assert(&c, c.stack == b);
return result; return result;
} }

View File

@ -386,13 +386,11 @@ class CallEvent: public Event {
Stack* stack = stackBefore; Stack* stack = stackBefore;
if (callingConvention == ir::AvianCallingConvention) { if (callingConvention == ir::AvianCallingConvention) {
Stack* s2 = stack;
for (size_t i = 0; i < arguments.count; i++) { for (size_t i = 0; i < arguments.count; i++) {
s2 = s2->next; stack = stack->next;
} }
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;
if ((vm::TargetBytesPerWord == 8 if ((vm::TargetBytesPerWord == 8
&& (v == 0 || (i >= 1 && arguments[i - 1] == 0))) && (v == 0 || (i >= 1 && arguments[i - 1] == 0)))
@ -403,13 +401,10 @@ class CallEvent: public Event {
arguments[i] = arguments[i - 1]; arguments[i] = arguments[i - 1];
--i; --i;
stack = stack->next;
} }
arguments[i] = v; arguments[i] = v;
} }
assert(c, s2 == stack);
int returnAddressIndex; int returnAddressIndex;
int framePointerIndex; int framePointerIndex;
int frameOffset; int frameOffset;

View File

@ -2033,7 +2033,7 @@ class Frame {
} }
} }
Slice<ir::Value*> peekMethodArguments(unsigned footprint UNUSED) Slice<ir::Value*> peekMethodArguments(unsigned footprint)
{ {
ir::Value** ptr = context->argumentBuffer.items; ir::Value** ptr = context->argumentBuffer.items;