Lectures 15 to 16

Lectures 15 to 16 - Block Structured Languages There are...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Block Structured Languages There are two major structures that are maintained for any computation at run time: A) Soft structure: activation state with the following two parts: a) Fixed Part: the machine code of the program, and b) Variable Part: The activation record (AR) that holds the state of the “activation” (procedure/function in execution). i) Environment part ( ep ): defines the context of an activation; it consists of: I) locals and formal parameters. II) S tatic L ink ( SL ): pointer to all visible non-local accessible scopes (starting at the AR of the definer of the activation) of the current activation. ii) I nstruction P ointer ( IP ): pointer into the current activation code. iii) D ynamic L ink ( DL ): a pointer to the caller’s AR, where the return address is stored. B) Hardware structure (): consists of the following: i) Environment Pointer ( π ep ): a pointer to the current activation environment (its AR). ii) Instruction Pointer ( π ip ): a pointer to the next instruction to be executed. iii) Stack Pointer ( π sp ): a pointer to the next AR record to be placed at the top of the stack, in case of the current “activation” calls a procedure or function. π sp π ip π ep AR of active module “caller” AR of any future “callee” AR’s of other non-active modules in the stack Code of the current activation Virtual Processor π Run Time Stack
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Name Access (local/non-local): i) Static Chain : a chain starting from the current AR’ SL until the main program AR, following the SL of all intermediate ARs. ii) Dynamic Chain : a chain starting from the current AR’ DL until the main program AR, following the DL of all intermediate ARs. ii) Static Nesting Level ( snl ): the snl of a name use or declaration is the number of surrounding contour diagram boxes around its use or declaration, respectively. The Static distance ( sd ) of a name is: sd = snl use snl decl (remember: for locally declared names, sd = 0 ) The compiler will maintain a symbol table that keeps a record of properties (e.g., type, snl use , snl def, sd , and “offset” within the local declarations of its definer, etc) for each name; this will help in compile time type checking and run-time name access (page 216). Question
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/23/2011 for the course CSE 324 taught by Professor Soliman during the Spring '11 term at NMT.

Page1 / 7

Lectures 15 to 16 - Block Structured Languages There are...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online