-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reducing stack consumption through overlapping frames #471
Comments
The problem with the above design is that we would need to flip all the arguments to call a C function.
|
Doesn't it have the same problem that the locals and the stack grow in opposite directions, so you always have to flip the arguments? |
For Python functions, yes. But we need to move them anyway: if frames don't overlap, we bulk copy, if they do overlap we flip them. |
I'm closing this for two reasons:
|
In #31 (comment) I discussed various frame layout options and came to the conclusion that the most compact form, option A, was not viable as it required 3 pointers.
However, this is incorrect as it assumes that the stack must grow upward. There is no reason for this, most hardware stacks grow down.
With the frame stack growing down the frame would look this:
The downside of this scheme is the extra care we need to take when initializing locals from the stack as they overlap and overlap in reverse order. E.g take the call
g(a,b)
from a functionf
:Before the call:
Once frame for g has been created:
The local variables for
g
need to reordered in place:The text was updated successfully, but these errors were encountered: