Difference between revisions of "Stack frame"

From Computer History Wiki
Jump to: navigation, search
(An OK start)
 
m (Avoid dab)
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
 
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.
 
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 [[condition]]s, 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.
+
In languages which support [[exception|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.
 +
 
 +
[[Category: Software Concepts]]

Latest revision as of 22:21, 16 September 2019

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.