Procedure Calls
S call id ( Elist )
Elist Elist , E
Elist E
. Calling sequence
- allocate space for activation record
- evaluate arguments
- establish environment pointers
- save status and return address
- jump to the beginning of the procedure
calling sequences
. allocate space for activation record (AR) on stack
. evaluate arguments to procedure and make available at known location
. save state of calling procedure - used to resume execution after call
. save return address (in known location) (instruction following call)
. generate jump to the beginning of the called procedure
return sequence
. if a function, save the result(s) in a known place
. restore the activation record of the calling procedure
. generate a jump to the return address (of calling procedure)
|