- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is role of Run-time Storage Management in compiler design?
The compiler demands a block of memory for the operating system. The compiler utilizes this block of memory executing the compiled program. This block of memory is called storage management. One of the important tasks that a compiler must perform is to allocate the resources of the target machine to represent the data objects that are being manipulated by the source program.
A compiler must decide the runtime representation of the data objects in the source program. In the source program, runtime representations of the data objects, such as integers and real variables, usually take the form of equivalent data objects at the machine level whereas data structures such as arrays and strings are represented by several words of machine memory.
As far as allocating storage space for the lifetime of a variable, there are three possibilities −
If the lifetime of a variable is the lifetime of the program and space for its value, once allocated, cannot be released later. Such storage is defined as static storage.
If the lifetime of a variable is a particular block, function, or procedure in which the variable is declared, the storage allocated to the variable can be de-allocated when the execution of block, function, or procedure is over. Such storage is defined as dynamic storage.
Storage can be allocated for values not necessarily associated with variables, at a particular point in the execution of a program not necessarily corresponding to the start of a block or the entry to a procedure. The storage is then required from that point on until it is released either by language mechanism or through simply being no longer reachable from the program.
However, the movement of this release, this space is only known as runtime. Such storage is defined as global storage. So, at the end of the introduction it can finally conclude that at runtime following issues must be taken care of −
- It can be managing the relationship between names in the source program and data objects that exist at runtime.
- It can be managing the allocation/deallocation of and access to data objects at runtime.
- It can be controlling and keeping track of different procedures and their calls.
- It can be managing the library function, provided by the language.
The strategies that can be used to allocate storage to the data objects are determined by the rules defining the scope and duration of the names in the programing language. The simplest strategy is static allocation, which is used in a language like FORTRAN.
With static allocation, it is possible to determine the runtime size and relative position of each data object during compilation. A more complex strategy for dynamic memory allocation that involves stacks is required for languages that support recursion− an entry to a new block or procedure causes the allocation of space on a stack, which is freed on exit from the block or procedure.
- What is techniques of storage allocation in compiler design?
- What is role of different data structures in compiler design?
- What is the role of the lexical analyzer in compiler design?
- What is Compiler Design?
- What is binding and binding time in compiler design?
- What is Storage Management?
- What is Design of Lexical Analysis in Compiler Design?
- What is minimizing of DFA in compiler design?
- What is the role of Compiler Construction Tools?
- What is Chomsky Hierarchy in compiler design?
- What is error handling in compiler design?
- What is Input Buffering in Compiler Design?
- What is Finite Automata in Compiler Design?
- Is JIT compiler a part of JVM or run time interpreter?
- What is the Representation of DFA in compiler design?