Professional Documents
Culture Documents
Lect 13
Lect 13
Epilogue 4
Storage Organisation: Activation Records
• Local variables require storage during the lifetime of the procedure
invocation at run-time.
• The compiler arranges to set aside a region of memory for each
individual call to a procedure (run-time support): activation record:
AR parameters In general, the compiler is free
pointer Activation Records to choose any convention for
register (ARs here) are also the AR. The manufacturer
save area known as stack frames. may want to specify a standard
for the architecture.
return value
return address Address to resume caller
access link Help with non-local access
caller’s AR Pointer to caller’s activation record
local variables
& temporaries 5
Procedure linkages
(the procedure linkage convention is a machine-dependent contract between the
compiler, the OS and the target machines to divide clearly responsibility)
Callee (epilogue):
Caller (post-return): •store return value
•copy return value •restore registers, state
•deallocate callee’s AR •unextend basic frame
•restore parameters (if used •restore parent’s AR pointer
for call-by reference) •jump to return address
Apr 26, 2023 COMP36512 Lecture 13 6
Placing run-time data structures
Single logical address space:
Static &
Code Global Heap Stack
• Code, static, and global data have known size.
• Heap & stack grow towards each other.
• From the compiler’s perspective, the logical address space is the
whole picture. Compiler’s
view
OS’s
view
Physical Memory