
Introduction
The data required during the program's execution is stored in an activation record block.
The address in the target code can be described using two ways:
Activation Record has a fixed position reserved during compile time in Static Allocation. A new activation record is pushed into the stack for each execution in Stack Allocation.
The different address statements associated with allocation and de-allocation of activation records are
- Call
- Return
- Halt
- Action
Also See, procedure call in compiler design
Static Allocation
The different steps involved in Static Allocation are as follows.
1. Implementing Call Statement
The following code is needed for implementing the call statement.
MOV #here + 20, callee.static_area
GOTO callee.code_area
Where,
callee.static_area represents the address of the activation record.
callee.code_area represents the address for the procedure’s first function.
2. Implementing Return Statement
The following code is needed for implementing the call statement.
GOTO * callee.static_area
Where, callee.static_area represents the transfer of control to the address.
3. Implementing Action Statement
For implementing an Action statement, ACTION instruction is used.
4. Implementing Halt Statement
This is the final instruction for returning the control to the operating system.
Also See, Top Down Parsing