Next: Example of evolution of
Up: Unit 11
Previous: Heap management and garbage
A stack is a linear data structure with LIFO access strategy: LIFO
stands for Last-In-First-Out, which means that the last element that entered
the stack is the first element that leaves the stack among those present
(confront with a stack of plates).
At run-time, the JVM manages the stack of activation records (AR):
- for each method activation a new AR is created on top of the
stack;
- at the end of the method activation, the AR is removed from the stack.
Each AR contains:
- the memory locations for the formal parameters, including the reference
to the invocation object (if the method is not a static one);
- the memory locations for the local variables (if present);
- the return value for the method invocation (if the method has a return
type different from void);
- a memory location for the return address, i.e., the address of the next
statement to execute in the calling method.
Next: Example of evolution of
Up: Unit 11
Previous: Heap management and garbage