CSCE 2214 Lecture Notes - Lecture 16: Call Stack
Document Summary
Lec 16 9-30-16 stack in memory / leaf procedure. Lifo data structure which means last in first out. Stack pointer points to the top element in the stack. Push: place an element on the top of stack and update the pointer. Pop: remove an element from the top of stack and update pointer. General register is used to address the stack. The top of stack grows from a high address to a lower one. Pushing adds data onto the stack which makes the top of the stack a lower address. Pop removes data which makes the address of the top of stack higher. Non-leaf procedure: is both a caller and a callee, can perform instruction and then call on another procedure to perform another instruction. Leaf procedure: is a callee, performs instruction and returns result. Needs to save any arguments and temporaries needed after calling the callee. Restore from the stack after calling the callee.