Professional Documents
Culture Documents
CS 152 Day 8 Lecture
CS 152 Day 8 Lecture
-temporary values
-local data/variables
-saved machine status information
-parameters
-returned values
-control link(implement functions) – points to activation record of caller – return from functions and
restore stacks as it should be. Always point to previous to POP STACK
-access link – for access to non-local names(globals)
calling sequence – can be split | before and after transfer control | caller / callee
Return sequence – puts return value where caller knows where to find it(top of active record)
Nonlocal variable – not in own activication record, in others activation record (access to non-local
names)
Access link- access link points to outside levels(nonlocal + global) – access variables your allowed to
access. Use nesting levels to set up access links. When do you set up chain? When you do calls and
returns. POINT TO LATEST that calls
Static Q(like a global) – rip out stack, allocate it with globals, never lose value, permantely allocated
Don’t put in stack put in heap. Each time you come, pick up pointer and go to HEAP;
_____________________________________________________________________________________
Final Code Generation and code optimization –last topic
Load and stores are expensive, but quick and dirty will work(how to optimize?) – get rid load/store
Adding edges
Fall through
Live(being used later) – as long as there is a future use for value else NOT live(dead, so FREE register)
Stops being live when you use it for last time. (begins live with assignment, last use becomes dead)
Live range – an isolated and connected group of basic blocks in which a variable is live.
Use(reading)