Function Call evaluation using the system stack
- How regular and recursive function calls are evaluated.
- the system stack: for allocation of function parameters and local variables.
- the heap: for allocation of arrays and objects.
- program counter
- return address
- The function call and return mechanisms:
- when a function is called: a block containing the parameters, local variables and return address is pushed on the system stack
- when a return instruction is executed: the top block is popped from the stack and the control returns to the return address
stored in the popped block. The value returned by the function call is left (temporarily) on top of the stack for immediate processing
at the return point.