adjust stack if necessary after non-tail-call in case where callee pops arguments

This commit is contained in:
Joel Dice 2009-04-25 11:47:41 -06:00
parent 3113ae74eb
commit de84afe2fe

View File

@ -2486,6 +2486,20 @@ class CallEvent: public Event {
padIndex, padding);
}
if ((flags & Compiler::TailJump) == 0) {
unsigned footprint = c->arch->argumentFootprint(stackArgumentFootprint);
if (footprint > c->arch->stackAlignmentInWords()) {
Assembler::Register stack(c->arch->stack());
ResolvedPromise adjustmentPromise
((footprint - c->arch->stackAlignmentInWords()) * BytesPerWord);
Assembler::Constant adjustmentConstant(&adjustmentPromise);
c->assembler->apply
(Subtract, BytesPerWord, ConstantOperand, &adjustmentConstant,
BytesPerWord, RegisterOperand, &stack,
BytesPerWord, RegisterOperand, &stack);
}
}
clean(c, this, stackBefore, localsBefore, reads, popIndex);
if (resultSize and live(result)) {