22-06-2012, 02:11 PM
Subprogram Control
Subprogram Control.ppt (Size: 246 KB / Downloads: 29)
Assumptions
Subprograms cannot be recursive
Explicit call statements are required
Subprograms must execute completely at
Immediate transfer of control at point of call
Single execution sequence
Subprogram definition
The definition is translated into a template,
used to create an activation each time a subprogram is called.
On call instruction
An activation record is created
Current CIP and CEP are saved in the created activation record as return point
CEP is assigned the address of the activation record.
CIP gets the address of the first instruction in the code segment
The execution continues from the address in CIP
The simplest implementation
Allocate storage for a single activation record statically as an extension of the code segment.
Used in FORTRAN and COBOL.
The activation record is not destroyed - only reinitialized for each subprogram execution.
Hardware support - CIP is the program counter,
CEP is not used, simple jump executed on return.
Attributes of Data Control
Data control features determine the accessibility of data at different points during program execution.
Central problem:
the meaning of variable names, i.e. the correspondence between names and memory locations.