CD 5
CD 5
fib(3) fib(2)
fib(2) fib(1)
Storage organization: It deals with the division of memory into
different areas ,management of the activation records and layout of
the local data.
a.Sub division of run-time memory: The underlying hardware and
operating system provide a division of memory into the following
areas. Heap area
Stack area
Static area
Code area
• When a procedure call occurs then space is allocated for activation record.
• Evaluate the argument of the called procedure.
• Establish the environment pointers to enable the called procedure to access data in
enclosing blocks.
• Save the state of the calling procedure so that it can resume execution after the call.
• Also save the return address. It is the address of the location to which the called
routine must transfer after it is finished.
• Finally generate a jump to the beginning of the code for the called procedure.
• Let us consider a grammar for a simple procedure call statement
• S → call id(Elist)
• Elist → Elist, E
• Elist → E