On a call stack, we have a frame pointer which gives us the location of the arguments to a procedure and the address of a pointer to the previous frame. We also have a return address. Why it the return address necessary? Could we not just follow the frame pointers back up the stack, popping off the stack frames as we went? Is the return address just an optimisation?
The return address does not point to the previous stack frame, it points into the code segment to the next instruction in the calling method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With