It is the simplest allocation scheme in which allocation of data objects is done at compile time because the size of every data item can be determined by the compiler. The main function of static allocation is to bind data items to a particular memory location. The static memory allocation procedure consists of determining the size of the instruction and data space.
Recursive Subprogram and Arrays of adjustable length are not permitted in a language. In static allocation, the compiler can decide the amount of storage needed by each data object. Thus, it becomes easy for a compiler to find the address of these data in the activation record. FORTRAN uses this kind of storage allocation strategy.
The binding of the name with the amount of storage allocated does not change at runtime. Therefore, the name of this allocation is static allocation. In static allocation, the compiler can decide the amount of storage needed by each data object. Therefore, it becomes easy for a compiler to find the address of these data in the activation record.
At compile time compiler can fill the addresses at which the target code can find the data it operates on.
Implementation of the 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 */
callee.static_area− An address of the activation record.
callee.code_area− An 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 an action statement.
Implementation of halt statement
The statement HALT is the final instruction that returns control to the operating system.