You do not “pop” parameters from the stack, in the sense that you do not push them. Usually you assign a frame register to indicate the top of the stack at the procedure entry point and gain access to parameters with constant known offsets from the frame pointer. Then your index simply “skips” the return address, which, as you know, is.
eg. in some hypothetical assembly when you are in the procedure. Suppose the stack grows:
... argument2 argument1 ret addr <---- stack pointer
Thus, just argument1 can be obtained at offset sp+4 (assuming 32-bit), argument2 at offset sp+8 , etc. Since these calling conventions are known, these offsets are hard-coded in code and are efficient for computation.
The frame pointer is very useful, since you also push local variables to the stack, and you do not want the indexing of parameters to change in different places, so the frame pointer provides a stable anchor throughout the entire procedure.
source share