IAE Academy

Runtime environments formulas

Runtime environments: activation records and storage allocation. 3 formulas for GATE CS Compiler Design, each with when to use it. Each is explained in the topic notes.

All 3 Runtime environments formulas

LIVE ACTIVATIONS

Holds under stack allocation, where every live activation has exactly one record on the stack. Counts the records on the stack at one instant; the maximum over the run is the peak stack depth. Includes the main program's record.

ACCESS-LINK HOPS FOR A VARIABLE

Static scoping with access links. A procedure at nesting depth uses a variable whose nearest enclosing declaration is at depth . Start at the current record and follow access links this many times; 0 means the variable is local.

ACCESS LINK OF A CALLEE

Procedure (depth ) calls procedure (depth ), which is visible from , so . Follow this many access links from 's record; the record reached is the most recent activation of 's lexical parent, and 's access link is set to it. Cases: ( declared inside ) gives 0, so the link points to itself; gives 1, so the link equals 's own access link; gives links.