Stack Frame

References:

Class of variables:

  • Temporary variables:
  • Local variables:
  • Global variables:

Stack Frame Layout

Frame pointer (FP): ptr to beginning of stack frame (fixed)

Stack pointer (SP): ptr to end of stack (can move).

Stack frame hold space for:

  • formals
  • local variables
  • return addresses
  • (maybe) dynamic link (ptr to calling stack frame)
  • (maybe) static link (ptr to lexically-enclosing stack frame)
  • other run-time data (e.g. caller-saved registers)

Key property: all data in stack frames is at fixed, statically computed offset from FP.

Good about this property:

  • easy to generate fast code to access data in stack frame, even lexically enclosing stack frames.
  • compute all offsets solely from symbol tables.
Created Jul 15, 2020 // Last Updated Aug 15, 2020

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?