Activation records


Modern imperative programming languages typically have local variables.

In c, cpp all variables written within function or passed as arguments are local to its function which are not accessible outside that function. These are called as local variables.

 Each invocation of a function has its own instantiation of local variables

Recursive calls to a function require several instantiations to exist simultaneously.
Functions return only after all functions it calls have returned μ last-in-first-out
(LIFO) behavior.
A  LIFO structure called a stack is used to hold each instantiation

The portion of the stack used for an invocation of a function is called the function’s

stack frame or activation record.

                                                                  Stack Frame Organization

How is data organized in stack frame?

 Compiler can use any layout scheme that is convenient.

              Microprocessor manufactures specify “standard” layout schemes used by all compilers.

              Sometimes referred to as Calling Conventions.

               If all compilers use the same calling conventions, then functions compiled with one compiler can call functions compiled with another.
Stack frame organization is
Essential for interaction with OS/libraries.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s