P. 1
0 Introduction and Basics

0 Introduction and Basics

|Views: 590|Likes:
Published by sbk123

More info:

Published by: sbk123 on Nov 10, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/24/2012

pdf

text

original

The word ‘activation record’ is used in the same meaning as ‘stack frame’ here.

Every function that is called is allocated memory in the stack and that is called as stack-

frame.

Outgoing parameters
(becomes incoming for
next frame)

Incoming actual
parameters
with argument count
Saved state information
(like old stack pointer)

Local data (variables)

Temporary storage area

Frame(stack)pointer

Format of a generalized activation record

This format of generalized C activation record is adapted from [Johnson and

Ritchie1981]. This format is generally followed in many implementations but may differ

from implementations.

Return values are actually passed by register. The size of all the contents can be

predetermined by the compiler in the compile time itself. If the arguments are variable

length arguments then the size may vary only for that part of the frame. So except for the

variable length arguments, the size of the activation record remains fixed.

It has to be noted that, the incoming parameters are saved by the calling function

rather than in the called function’s activation record. The stack frame of the called

function overlaps the stack frame of the calling function to get the parameters. Similarly

when the called function calls yet another function, it stores the parameter data to be

passed to the next frame in its activation record and so on.

The saved information includes the control link to the calling function. Only for

the activation records of same function, the size remains the same. For different functions

the size may vary. So control links are required to keep track of how to return to the

function that called it.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->