Is it during a pre-processing or compilation stage, say on gcc? Is it different on other compilers?
+3
A:
The stack frame is created at runtime by modifying the stack register of the processor (esp
for Intel x86).
The compiler only dump specific instructions to reserve space on the stack at each function call. This space is then recovered when the function exits.
cedrou
2009-09-10 11:21:14
Except some languages don't use a stack for instantiating the activation records at runtime, and some compilers have a data structure which represents the content of the activation record which is created during translation and then the code is generated from the constructed record.
Pete Kirkham
2009-09-10 12:11:45
And some processors (esp. SPARC) use sliding register windows for the activation record - it's important to understand that a simple description of how it could be done will leave out all complex real-world optimizations.
MSalters
2009-09-11 10:21:04