Stack frame

From Computer History Wiki
Jump to: navigation, search

A stack frame is the data block on the stack in most procedure-oriented programming languages which records, and stores the data related to, a particular invocation of a particular procedure.

It contains (usually in this approximate order):

  • The argument(s), if any, to this invocation
  • The return point in the calling routine
  • A frame pointer, which links to the stack frame of the calling routine
  • Information about any condition handlers set up by this procedure
  • Any local variables in this procedure

Obviously the arguments have to be first (since those have to be set up before the subroutine call), and the return point next. The rest is set up by the called procedure, which is usually the only place that knows about the information there.

In languages which support conditions, the record of which conditions are handled in any given routine on the call stack is usually listed in that routine's call frame, for use during a stack unwind when a condition is raised.