Home | | Compiler Design | Storage Organization

Chapter: Principles of Compiler Design : Syntax Analysis and Run-Time Environments

Storage Organization

The executing target program runs in its own logical address space in which each program value has a location.

STORAGE ORGANIZATION

 

The executing target program runs in its own logical address space in which each program value has a location. The management and organization of this logical address space is shared between the complier, operating system and target machine. The operating system maps the logical address into physical addresses, which are usually spread throughout memory.


Fig. 2.9 Typical subdivision of run-time memory into code and data areas

 

Run-time storage comes in blocks, where a byte is the smallest unit of memory. Four bytesform a machine word. Multibyte objects are bytes and given the address of first byte.

 

The storage layout for data objects is strongly influenced by the addressing constraints of the target machine.

 

A character array of length 10 needs only enough bytes to hold 10 characters, a compiler may allocate 12 bytes to get alignment, leaving 2 bytes unused.

This unused space due to alignment considerations is referred to as padding.

 

The size of some program objects may be known at run time and may be placed in an area called static.

The dynamic areas used to maximize the utilization of space at run time are stack and heap.

 

Activation records:

 

Procedure calls and returns are usually managed by a run time stack called the control stack. Each live activation has an activation record on the control stack, with the root of the activation tree at the bottom, the latter activation has its record at the top of the stack. The contents of the activation record vary with the language being implemented.

 

Temporary values such as those arising from the evaluation of expressions.

Local data belonging to the procedure whose activation record this is.

 

A saved machine status, with information about the state of the machine just before the call to procedures.

 

An access link may be needed to locate data needed by the called procedure but found elsewhere.

A control link pointing to the activation record of the caller.

 

Space for the return value of the called functions, if any. Again, n return a value, and if one does, we may prefer to place that value i efficiency.

The actual parameters used by the calling procedure. These are not placed in record but rather in registers, when possible, for greater efficiency.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Principles of Compiler Design : Syntax Analysis and Run-Time Environments : Storage Organization |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.