7.1 Referring to a Procedure Invocation

When referring to a specific procedure invocation at run-time, either the virtual frame pointer or the real frame pointer for that invocation can be used. The virtual frame pointer of a procedure invocation is the contents of the stack pointer at entry to the procedure. The real frame pointer of a procedure is the contents of the stack pointer after the size of the fixed part of the stack frame has been subtracted from the virtual frame pointer. Note that the virtual frame pointer of an invocation is not the value used for addressing by the procedure itself. The contents of the SP register are modified in the procedure prologue and the resulting real frame pointer value then possibly copied into a FP register (in the case of a variable-size stack frame). The resulting real frame pointer is then used for addressing local storage throughout the remainder of the procedure.

The real frame pointer is not, of itself, sufficient to unambiguously identify all possible procedure invocations. For example, a null frame procedure has the same real frame pointer as its caller because the null frame procedure allocates no stack storage. This ambiguity is of no consequence for the purposes of this calling standard because the real frame pointer value is always used in combination with a program counter value that identifies an instruction within a particular procedure.

The static link used in calling nested procedures in languages such as Pascal and Ada is usually either the virtual frame pointer or the real frame pointer value. The actual choice is implementation-dependent and can vary from language to language and release to release.