1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

  • Then stack space is allocated for the called procedure's
    local variables, the address of a local variable is relative
    to the link register
  • All the information that has been put on the stack is
    called the activation record or stack frame for the
    procedure - this activation record must be constructed
    each time a procedure is called
  • When the procedure is ready to return all the above
    operations must be reversed
  • The return value of the procedure is placed in a
    register, the calling procedure can retrieve this value
    from the register after the return is complete
  • The link register and the stack pointer are then
    restored to their previous values and an rts is executed
  • Nested procedure calls and recursive procedure calls
    cause the stack to grow towards the data segment - if
    you have an infinite recursion the stack will continue to
    grow until it reaches the data segment
    --at that point
    your program will be terminated with a segmentation
    error and a core dump

March 3, 1998

Page 13

C201/TAM