What is the use of the activation record? Explain different fields in the activation record.

We will apply these storage allocation strategies to activation records which is a. conceptual aggregate of data that contains all the information required for a single execution of a procedure. An activation record for a procedure is kept in a run-time stack area for block-structured languages like Pascal and C Whenever a procedure is called, an activation record is pushed on the stack and it is popped from the stack whenever control is returned to the calling program. In the FORTRAN compiler, activation records are kept in a static area.

A typical activation record contains the following fields.

1, Temporaries: To store the temporary values arising from the evaluation of expressions.

2 Local variable; To hold data that is local to the currently activated procedure.

3: Actual parameters: To pass parameters to the called procedure. This field is used by the calling procedure.

4 Return address: To store the return address of the calling procedure to return control to it after the called procedure is over.

5 Returned value: To store the value to be returned to the calling procedure. This field is used by the called procedure.

6.Saved register: To hold the values of the program counter and other processor registers so that they can be restored when control returns back from the procedure.

7 Static link: To refer to nonlocal data held in other activation records. In a block-structured language like Pascal, a procedure may access variables that are not declared locally. These variables may be global variables or variables declared in surrounding procedures. This static link points to the current activation record of the immediately enclosing procedure. FORTRAN-like languages do not require these static links as the nonlocal data in these languages is kept in a fixed place.

8 Dynamic link: To point to the activation record of the calling procedure.

Dynamic link
Static link
Saved registers
Returned value
Return address
Actual parameters
Local variables
Temporaries

The above figure shows the structure of a typical activation record. Most of these fields can be determined at compile-time. Show the DAG for the following statement:

Leave a Reply