image/svg+xml
Overview of a Stack Frame
16 March 2009
Jeremy Bennett
Free Software Foundation
Free Software Foundation
www.gnu.org
stack
frame
A diagram showing all the key features of a stack frame in a compiled l
Jeremy Bennett
n = 0
n = 1
n = 2
n = 3
i = 3
int fact( int n ){ if( 0 == n ) { return 1; } else { return n * fact( n - 1 ); }}main(){ int i; for( i = 0 ; i < 10 ; i++ ) { int f = fact( i ); printf( "%d! = %d\n", i, f ); }}
FP
PC
SP
fact (0)
fact (1)
fact (2)
fact (3)
main ()
#-1
#0
#1
#2
#3
#4
FrameNumber
Direction ofstack growth
f = ?
Red Zone