CS 342 Lecture -*- Outline -*- * Activation record (AR or frame) info needed for a single execution of a procedure --------------------- Aho and Ullman's design for Activation Record (using static links): |\\\\\\\\\\\\\\\\\\\\\\\\\ <____ SP (stack pointer) | | TEMP:| temporaries | |________________________| | | VAR: | local data | | (storage for vars) | |________________________| fixed | IP: | saved machine status | <_________ EP (env pointer) size | | (ip and other regs) | fields | |________________________| | SL: | static link | | | (or display) | | |________________________| | DL: | dynamic link | |________________________| PAR: | | | actual parameters | | | |________________________| RET: | returned value | | (for functions) | __________________________ --------------------- *describe reasons for this layout, how affected by semidynamic arrays. MacLennen's environment part consists of VAR, TEMP, PAR, and SL dynamic link (DL): pointer to AR of caller parameters and results may be passed in machine registers ** Machine status part (IP) does saved part save information about caller or callee? -MacLennan: stores information for callee -Sebesta, Aho, et al: stores information for caller less code why? -caller can access it on return, with less indirection -want to put as much in caller as possible, since callee's code is executed for all calls ** Local data storage laid out when declarations processed (aggregates laid out contiguously) (dynamic arrays kept outside this field) at compile time can determine relative address = offset of variables (and fields within aggregates)