mirror of
https://github.com/corda/corda.git
synced 2025-05-02 16:53:22 +00:00
prepare to move stack manipulation out of CallEvent
This commit is contained in:
parent
ae534bed5f
commit
9f36a8e0ec
@ -386,6 +386,10 @@ 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++) {
|
||||||
|
s2 = s2->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;
|
stack = stack->next;
|
||||||
@ -404,6 +408,8 @@ class CallEvent: public Event {
|
|||||||
arguments[i] = v;
|
arguments[i] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(c, s2 == stack);
|
||||||
|
|
||||||
int returnAddressIndex;
|
int returnAddressIndex;
|
||||||
int framePointerIndex;
|
int framePointerIndex;
|
||||||
int frameOffset;
|
int frameOffset;
|
||||||
@ -492,6 +498,8 @@ class CallEvent: public Event {
|
|||||||
virtual void compile(Context* c) {
|
virtual void compile(Context* c) {
|
||||||
lir::UnaryOperation op;
|
lir::UnaryOperation op;
|
||||||
|
|
||||||
|
unsigned footprint = c->arch->argumentFootprint(stackArgumentFootprint);
|
||||||
|
|
||||||
if (TailCalls and (flags & Compiler::TailJump)) {
|
if (TailCalls and (flags & Compiler::TailJump)) {
|
||||||
if (flags & Compiler::LongJumpOrCall) {
|
if (flags & Compiler::LongJumpOrCall) {
|
||||||
if (flags & Compiler::Aligned) {
|
if (flags & Compiler::Aligned) {
|
||||||
@ -530,9 +538,9 @@ class CallEvent: public Event {
|
|||||||
fps = lir::NoRegister;
|
fps = lir::NoRegister;
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset
|
int offset = static_cast<int>(footprint)
|
||||||
= static_cast<int>(c->arch->argumentFootprint(stackArgumentFootprint))
|
- static_cast<int>(
|
||||||
- static_cast<int>(c->arch->argumentFootprint(c->parameterFootprint));
|
c->arch->argumentFootprint(c->parameterFootprint));
|
||||||
|
|
||||||
c->assembler->popFrameForTailCall(c->alignedFrameSize, offset, ras, fps);
|
c->assembler->popFrameForTailCall(c->alignedFrameSize, offset, ras, fps);
|
||||||
} else if (flags & Compiler::LongJumpOrCall) {
|
} else if (flags & Compiler::LongJumpOrCall) {
|
||||||
@ -563,14 +571,8 @@ class CallEvent: public Event {
|
|||||||
if (framePointerSurrogate) {
|
if (framePointerSurrogate) {
|
||||||
framePointerSurrogate->source->thaw(c, framePointerSurrogate);
|
framePointerSurrogate->source->thaw(c, framePointerSurrogate);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (footprint > c->arch->stackAlignmentInWords()) {
|
||||||
unsigned footprint = c->arch->argumentFootprint
|
c->assembler->adjustFrame(footprint - c->arch->stackAlignmentInWords());
|
||||||
(stackArgumentFootprint);
|
|
||||||
|
|
||||||
if (footprint > c->arch->stackAlignmentInWords()) {
|
|
||||||
c->assembler->adjustFrame
|
|
||||||
(footprint - c->arch->stackAlignmentInWords());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user