afsara_ben
afsara_ben

Reputation: 672

static allocation and stack allocation in compiler design

I am not clear about was static and stack allocation are? Is static allocation static and stack allocation dynamic? Then where does heap allocation belong?

How is activation record related to this? I thought activation record is a conceptual thing like activation tree, and does not have any physical existence.

What does the following target machine code mean?

static allocation:

ST callee. staticArea , #here + 20
BR callee. codeArea

stack allocation :

LD SP , #stackStart
code for the first procedure
HALT
ADD SP , SP , #caller. recordSize
ST *SP , #here + 16
BR callee. codeArea

BR *O (SP) // return to caller
SUB SP , SP , #caller. recordSize // decrement stack pointer

Upvotes: 0

Views: 549

Answers (0)

Related Questions