COMPSCI 61C Lecture Notes - Lecture 10: Call Stack, Exit Procedure, Memory Address
Document Summary
Calling function can rely on values being unchanged when the called function returns. Caller cannot rely on values being unchanged, so the caller must save them if needed across a function call. Return value registers , , argument registers - , - , . C has two storange classes: automatic and static. Automatic variables are local to function and discarded when function exits. Static variables exist across exits from and entries to procedures. Use the stack for automatic (local) variables that don"t t in registers. Use the stack for all callee-saved registers used in the function and restore those values upon function exit. Procedure frame / activation record: segment of stack with saved registers and local variables. Some mips compilers use a frame pointer to point to rst word of frame aka top of stack (not usually used because frame pointer is usually in reference to stack pointer)