DESKTOP

Algorithms for Compiler Design: ACTIVATION OF THE PROCEDURE AND THE ACTIVATION RECORD

7/24/2010 8:06:31 PM
8.2 ACTIVATION OF THE PROCEDURE AND THE ACTIVATION RECORD

Each execution of a procedure is referred to as an activation of the procedure. This is different from the procedure definition, which in its simplest form is the association of an identifier with a statement; the identifier is the name of the procedure, and the statement is the body of the procedure.

If a procedure is non-recursive, then there exists only one activation of procedure at any one time. Whereas if a procedure is recursive, several activations of that procedure may be active at the same time. The information needed by a single execution or a single activation of a procedure is managed using a contiguous block of storage called an "activation record" or fiactivation framefl consisting of the collection of fields. (Very often, registers take the place of one or more of the fields in the activation record.) The activation record contains the following information:

  1. Temporary values, such as those arising during the evaluation of the expression.

  2. Local data of a procedure.

  3. The information about the machine state (i.e., the machine status) just before a procedure is called, including PC values and the values of these registers that must be restored when control is relinquished after the procedure.

  4. Access links (optional) referring to non-local data that is held in other activation records. This is not required for a language like FORTRAN, because non-local data is kept in fixed place. But it is required for Pascal.

  5. Actual parameters (i.e., the parameters supplied to the called procedure). These parameters may also be passed in machine registers for greater efficiency.

  6. The return value used by called procedure to return a value to calling procedure. Again, for greater efficiency, a machine register may be used for returning values.

The size of almost all of the fields of the activation record can be determined at compile time. An exception is if a called procedure has a local array whose size is determined by the values of the actual parameters.

The information in the activation record is organized in a manner that enables easy access at execution time. A pointer to the activation record is required. This pointer is called the current environment pointer (CEP), and it points to one of the fixed fields in the activation record. Using the proper offset from this pointer, and depending upon the format of the activation record, the contents of the activation record can be accessed. Figure 1 shows the organization of information in a typical activation record.

Click To expand
Figure 1: Typical format of an activation record.

Other  
  •  Algorithms for Compiler Design: STACK ALLOCATION
  •  Algorithms for Compiler Design: ERROR RECOVERY IN LR PARSING
  •  Algorithms for Compiler Design: PREDICTIVE PARSING ERROR RECOVERY
  •  Algorithms for Compiler Design: LOOP OPTIMIZATION
  •  Algorithms for Compiler Design: ELIMINATING INDUCTION VARIABLES
  •  Algorithms for Compiler Design: ELIMINATING LOCAL COMMON SUBEXPRESSIONS
  •  Algorithms for Compiler Design:
  •  Algorithms for Compiler Design
  •  Algorithms for Compiler Design: THE MACHINE MODEL
  •  Algorithms for Compiler Design: STRAIGHTFORWARD CODE GENERATION
  •  Algorithms for Compiler Design: USING DAG FOR CODE GENERATION
  •  Algorithms for Compiler Design: USING ALGEBRAIC PROPERTIES TO REDUCE THE REGISTER REQUIREMENT
  •  Algorithms for Compiler Design: PEEPHOLE OPTIMIZATION
  •  Algorithms for Compiler Design: IMPLEMENTATION OF THE TRANSLATIONS SPECIFIED BY SYNTAX-DIRECTED DEFINITIONS
  •  Algorithms for Compiler Design: L-ATTRIBUTED DEFINITIONS
  •  Algorithms for Compiler Design: SYNTAX-DIRECTED TRANSLATION SCHEMES
  •  Algorithms for Compiler Design: INTERMEDIATE CODE GENERATION
  •  Algorithms for Compiler Design: REPRESENTING THREE-ADDRESS STATEMENTS
  •  Algorithms for Compiler Design: SYNTAX-DIRECTED TRANSLATION SCHEMES TO SPECIFY THE TRANSLATION OF VARIOUS PROGRAMMING LANGUAGE CONSTRUCTS
  •  Algorithms for Compiler Design: THE ARRAY REFERENCE
  •  
    Top 10
    SQL Server 2008 R2 : Dropping Indexes, Online Indexing Operations, Indexes on Views
    SQL Server 2008 R2 : Managing Indexes - Managing Indexes with T-SQL, Managing Indexes with SSMS
    iPhone Developer : Search Tables and Core Data
    iPhone Developer : Using Core Data for a Table Data Source
    Adobe Illustrator CS5 : Proofing and Printing Documents - Setting Advanced Options, Setting Color Management Options
    Adobe Illustrator CS5 : Setting Graphics Options, Previewing Color Separations, Setting Output Options
    Adobe Illustrator CS5 : Setting General Print Options, Setting Marks and Bleed Options
    Windows Vista : Customizing Windows PE Boot Images (part 3) - Working with OSCDImg, Working with vLite
    Windows Vista : Customizing Windows PE Boot Images (part 2) - Working with an ImageX GUI, Working with PEImg
    Windows Vista : Customizing Windows PE Boot Images (part 1) - Working with ImageX
    Most View
    Canon Powershot SX260 HS
    IIS 7.0 : Using Command Line Tools - Microsoft.Web.Administration
    Take Your Office On The Go
    SQL Server 2008 : OPENXML, sp_xml_preparedocument, and sp_xml_removedocument
    Resolve a Hostname to an IP Address
    Windows Server 2008 R2 : Work with Remote Clients (part 1) - Install and Configure Windows Server 2008 R2 VPNs
    Searching for Google’s future (Part 1) - Taking the tablets
    Customizing Hardware Device Settings
    Got an iPad? Get a styIus (Part 1)
    SQL Server 2005 : Advanced OLAP - Advanced Dimensions and Measures (part 1)
    Major Access Control List Changes in Vista
    Business Intelligence in SharePoint 2010 with Business Connectivity Services : Consuming External Content Types (part 3) - Business Connectivity Services Web Parts
    Rebuilding The Dream (Machine) (Part 2)
    Documenting an Exchange Server 2010 Environment : Benefits of Documentation
    Visual Basic 2010 : Localizing Applications - Windows Forms Localization
    Tools for the job (Part 3) - Clonezilla, Hardinfo & Truecrypt
    Windows Server 2008 : DHCP/WINS/Domain Controllers - Exploring the Dynamic Host Configuration Protocol (DHCP)
    iPhone 3D Programming : Anti-Aliasing Tricks with Offscreen FBOs (part 1) - A Super Simple Sample App for Supersampling
    View Quest Retro WI-FI Radio
    iPhone Application Development : Working with Text, Keyboards, and Buttons (part 4) - Hiding the Keyboard