Binding & Binding Times
- A binding is the association of an attribute of a program entity with a value.
- Moreover, The binding of an attribute may be performed at any convenient time subject to the condition that the value of the attribute should be known when the attribute is referenced. Binding time the time at which a binding is actually performed.
The following binding times arise in compilers:
1) Language definition time of a programming language L, which is the time at which features of the language are specified.
2) Language implementation time of a programming language L, which is the time at which the design of a language translator for L is finalized.
3) Compilation time of a program P.
4) Execution init time of a procedure proc
5) Execution time of a procedure proc
Importance of binding times
- The binding time of an entity’s attributes determines the manner in which a language processor can handle use of the entity in the program.
- Moreover, A compiler can tailor the code generated to access an entity if a relevant binding was performed before or during compilation time.
- However, such tailoring not possible if the binding performed later than compilation time. So the compiler has to generate a general purpose code that would find information about the relevant binding during its execution and use it to access the entity appropriately. It affects execution efficiency of the target program.
- The activation record a block of memory used for managing information needed for a single execution of a procedure.
1.Temporary values: The temporary variables needed during the evaluation of expressions. Such variables stored in the temporary field of activation record.
2.Local variables: The local data is a data that local to the execution procedure stored in this field of activation record.
3.Saved machine registers: This field holds the information regarding the status of a machine just before the procedure called. Moreover, This field contains the registers and program counter.
4.Control link: This field is optional. It points to the activation record of the calling procedure. This link also called dynamic link.
5.Access link: This field is also optional. It refers to the non-local data in other activation records.Similarly, This field also called static link field. Actual parameters: This field holds the information about the actual parameters.
6.These actual parameters passed to the called procedure.
7.Return values: This field used to store the result of a function call.