Why is a stack frame for Sys.init required?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why is a stack frame for Sys.init required?

faIan36
Looking at the tests for NestedCall, FibonacciElement and StaticsTest, they all expect the base of the stack to be at 261, which would be 256 + the 5 elements of a stack frame.
But what I don't quite understand is why you would want to even push this stack frame. The Sys.init function shouldn't return and even if it did, the information in the frame is useless because it is all zeroes. (Even worse, it might be garbage data from a previous execution)
Also, just jumping uses way less assembly instructions. Can someone please explain this?
Reply | Threaded
Open this post in threaded view
|

Re: Why is a stack frame for Sys.init required?

WBahn
Administrator
Conceptually, it isn't required. I think the authors were just trying to keep things clean by abiding by the notion that every function that is running is associated with a stack frame, and also with the notion that the boot strap code needs to have the effect of calling Sys.init().