{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec22 - CS415 Compilers Procedure Abstraction These slides...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS415 Compilers Procedure Abstraction These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Lecture 22 2 cs415, spring 10 Lexical Scoping: Translating Local Names How does the compiler represent a specific instance of x ? • Name is translated into a static coordinate → < level,offset > pair → “ level ” is lexical nesting level of the procedure → “ offset ” is unique within that scope • Subsequent code will use the static coordinate to generate addresses and references • “ level ” is a function of the table in which x is found → Stored in the entry for each x • “ offset ” must be assigned and stored in the symbol table → Assigned at compile time → Known at compile time → Used to generate code that executes at run-time Lecture 22 3 cs415, spring 10 Activation Record Basics parameters register save area return value return address addressability caller’s ARP local variables ARP Space for parameters to the current routine Saved register contents If function, space for return value Address to resume caller Help with non-local access To restore caller’s AR on a return (control link) Space for local values & variables (including spills) One AR for each invocation of a procedure Lecture 22 4 cs415, spring 10 Activation Record Details How does the compiler find the variables?...
View Full Document

{[ snackBarMessage ]}

Page1 / 11

lec22 - CS415 Compilers Procedure Abstraction These slides...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online