RUN-TIME STORAGE MANAGEMENT
1. Static allocation 2. Stack allocation
1. Call,
2. Return,
3. Halt, and
4. Action, a placeholder for other statements.
1. Code
2. Static data
3. Stack
Static allocation
Implementation of call statement:
The codes needed to implement static allocation are as follows:
MOV #here + 20, callee.static_area /*It saves return address*/
GOTO callee.code_area /*It transfers control to the target code for the called
procedure */
where,
callee.static_area - Address of the activation record
callee.code_area - Address of the first instruction for called procedure
#here + 20 - Literal return address which is the address of the instruction following GOTO.
Implementation of return statement:
A return from procedure callee is implemented by : GOTO *callee.static_area
This transfers control to the address saved at the beginning of the activation record.
Implementation of action statement:
The instruction ACTION is used to implement action statement.
Implementation of halt statement:
The statement HALT is the final instruction that returns control to the operating system.
Stack allocation
Static allocation can become stack allocation by using relative addresses for storage in activation records. In stack allocation, the position of activation record is stored in register so words in activation records can be accessed as offsets from the value in this register.
The codes needed to implement stack allocation are as follows:
Initialization of stack:
MOV #stackstart , SP /* initializes stack */
Code for the first procedure
HALT /* terminate execution */
1. What is run-time storage management? | ![]() |
2. What is code generation in the context of run-time storage management? | ![]() |
3. What are the main techniques used for run-time storage management? | ![]() |
4. What is the role of a memory manager in run-time storage management? | ![]() |
5. How does run-time storage management impact the performance of a program? | ![]() |