storage organization in compiler design
Mohammed
Guys, does anyone know the answer?
get storage organization in compiler design from screen.
Storage Organization
The executing target program runs in its own logical address space in which each program value has a location.
Chapter: Principles of Compiler Design : Syntax Analysis and Run-Time Environments
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 ORGANIZATIONThe 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.
Run-time storage comes in blocks, where a byte is the smallest unit of memory. Four bytesform 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.
Prev Page Next Page
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Principles of Compiler Design : Syntax Analysis and Run-Time Environments : Storage Organization |
Run
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Run-time Storage Organization
Difficulty Level : Hard
Last Updated : 02 Apr, 2020
Read Discuss(2)
The run-time environment is the structure of the target computers registers and memory that serves to manage memory and maintain information needed to guide a programs execution process.
Types of Runtime Environments –Fully Static :Fully static runtime environment may be useful for the languages in which pointers or dynamic allocation is not possible in addition to no support for recursive function calls.
Every procedure will have only one activation record which is allocated before execution.
Variables are accessed directly via fixed address.
Little bookkeeping overhead; i.e., at most return address may have to be stored in activation record.
The calling sequence involves the calculation of each argument address and storing into its appropriate parameter location and saving the return address and then a jump is made.
Stack Based :In this, activation records are allocated (push of the activation record) whenever a function call is made. The necessary memory is taken from the stack portion of the program. When program execution return from the function the memory used by the activation record is deallocated (pop of the activation record). Thus, the stack grows and shrinks with the chain of function calls.
Fully Dynamic :Functional language such as Lisp, ML, etc. use this style of call stack management. Silently, here activation record is deallocated only when all references to them have disappeared, and this requires the activation records to dynamically freed at arbitrary times during execution. Memory manager (garbage collector) is needed.
The data structure that handles such management is heap an this is also called as Heap Management.
Activation Record –Information needed by a single execution of a procedure is managed using a contiguous block of storage called “activation record”.
An activation record is allocated when a procedure is entered and it is deallocated when that procedure is exited. It contain temporary data, local data, machine status, optional access link, optional control link, actual parameters and returned values.
Program Counter (PC) – whose value is the address of the next instruction to be executed.Stack Pointer (SP) – whose value is the top of the (top of the stack, ToS).Frame pointer (FP) – which points to the current activation.Note:Activation records are allocated from one of static area (like Fortran 77), stack area (like C or Pascal) and heap area (like lisp).
Storage Organization
Storage Organization with introduction, Phases, Passes, Bootstrapping, Optimization of DFA, Finite State machine, Formal Grammar, BNF Notation, YACC, Derivation, Parse Tree, Ambiguity, Syntax directed Translation, slr 1 parsing etc.
Storage Organization
When the target program executes then it runs in its own logical address space in which the value of each program has a location.
The logical address space is shared among the compiler, operating system and target machine for management and organization. The operating system is used to map the logical address into physical address which is usually spread throughout the memory.
Subdivision of Run-time Memory:
Runtime storage comes into blocks, where a byte is used to show the smallest unit of addressable memory. Using the four bytes a machine word can form. Object of multibyte is stored in consecutive bytes and gives the first byte address.
Run-time storage can be subdivide to hold the different components of an executing program:
Generated executable code
Static data objects
Dynamic data-object- heap
Automatic data objects- stack
← Prev Next →
For Videos Join Our Youtube Channel: Join Now
Feedback
Send your Feedback to feedback@javatpoint.com
Help Others, Please Share
Help Others, Please Share Learn Latest Tutorials
Splunk SPSS Swagger Transact-SQL Tumblr ReactJS Regex
Reinforcement Learning
R Programming RxJS React Native
Python Design Patterns
Python Pillow Python Turtle Keras
Preparation
Aptitude Reasoning Verbal Ability Interview Questions Company Questions
Trending Technologies
Artificial Intelligence
AWS Selenium Cloud Computing Hadoop ReactJS Data Science Angular 7 Blockchain Git Machine Learning DevOps
B.Tech / MCA
DBMS Data Structures DAA Operating System Computer Network Compiler Design
Computer Organization
Discrete Mathematics
Ethical Hacking Computer Graphics
Software Engineering
Web Technology Cyber Security Automata C Programming C++ Java .Net Python Programs Control System Data Mining Data Warehouse
Guys, does anyone know the answer?