Download presentation
Presentation is loading. Please wait.
1
Runtime Stack Activation record for hanoi; 1 2 3 1
Activation record for main
2
Support for Function Calls
Call usually simple, but setup not call printf what comes before and after call? Support recursion? No --- simple, use static space Yes --- runtime stack of activation record(s) Return value(s)
3
Activation Record Information
Parameters Locals Compiler Temporaries Register Save/Restore Previous Activation Record Previous Scope Anything else?
4
A Function Call Convention
fp and sp defined by assembler Caller function (in order) push parameters on stack, in reverse push fp fp = sp - 4 call callee fp = 0 (fp) sp = sp – (size of arguments + 4) Callee function (in order) sp = sp + size of function execute function sp = sp – size of function return
5
An Activation Record sp fp Next stack location – beyond the stack
Reg save … Reg save … Reg save … Temps … 8(fp) – local 2 4(fp) – local 1 fp 0(fp) – old fp -4(fp) – parameter 1 -8(fp) – parameter 2 -12(fp) – parameter 3
6
Function Call Convention (2)
Alpha conventions Parameters passed in registers, r16 - r24 or d16 - d24 Return in r0 (or d0) Registers r1 - r8, d1 - d8 are NOT saved across function call invocations (caller save) Registers r25 - r31 and d25 - d31 ARE saved across function call invocations (callee save)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.