13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For example, the declarationsVAR I, J: INTEGER;BOOL: BOOLEAN;will cause space in the activation record to be allocated as shown inFigure 3-5.Figure 3-5. The Order of Local Variable Allocation in an Activation Recordhigh memory addressesBOOLJlow memory addressesSpace for parameter passing is allocated below the local variable space. Ifthe procedure is a function, space is also reserved (below the parameterspace) for storing the value returned by the function. A description of theformat of variables in activation records is given in Chapter 4. The order ofpassed parameters is discussed in Part III, Chapter 9.Local variables in the activation record of an active procedure are accessedby indexing from the location pointed to by the MP register. Global variablesin the activation record of an active procedure are accessed by indexingfrom the location pointed to by the BASE register.When a procedure is terminated, its activation record is removed from thestack.MarkstacksThe lower portion of the activation record is called a markstack. When aprocedure call is made, the current values of the system pseudoregistersthat characterize the operating environment of the calling procedure arestored in the markstack of the called procedure. Thus the system registerscan be restored to precall conditions when control is returned to the callingprocedure.The Program Stack and the HeapIV-53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!