Structure
A call stack is composed of stack frames (also called activation records or activation frames). These are machine dependent and ABI-dependent data structures containing subroutine state information. Each stack frame corresponds to a call to a subroutine which has not yet terminated with a return. For example, if a subroutine named DrawLine
is currently running, having been called by a subroutine DrawSquare
, the top part of the call stack might be laid out like this:
A diagram like this can be drawn in either direction as long as the placement of the top, and so direction of stack growth, is understood. Furthermore, independently of this, architectures differ as to whether call stacks grow towards higher addresses or towards lower addresses. The logic of the diagram is independent of the addressing choice.
The stack frame at the top of the stack is for the currently executing routine. The stack frame usually includes at least the following items (in push order):
- the arguments (parameter values) passed to the routine (if any);
- the return address back to the routine's caller (e.g. in the
DrawLine
stack frame, an address intoDrawSquare
's code); and - space for the local variables of the routine (if any).
Read more about this topic: Call Stack
Famous quotes containing the word structure:
“It is difficult even to choose the adjective
For this blank cold, this sadness without cause.
The great structure has become a minor house.
No turban walks across the lessened floors.
The greenhouse never so badly needed paint.”
—Wallace Stevens (18791955)
“Communism is a proposition to structure the world more reasonably, a proposition for changing the world. As such, we have to analyze it and, if we deem it reasonable, act upon it.”
—Friedrich Dürrenmatt (19211990)
“With sixty staring me in the face, I have developed inflammation of the sentence structure and definite hardening of the paragraphs.”
—James Thurber (18941961)