Tuesday, February 3, 2015

Chapter 10 : Review Question

Q6 : What is the difference between an activation record and an activation record instance?
A : An activation record is the format, or layout, of the moncode part of a subprogram. An activation record instance is a concrete example of an activation record, a collection of data in the form of an activation record.

Q7 : Why are the return address, dynamic link, and parameters placed in the bottom of the activation record?
A : It's because the entry must appear first.

Q8 : What kind of machines often use registers to pass parameters?
A : RISC Machines often use registers to pass parameters.

Q9 : What are the two steps in locating a nonlocal variable in a static-scoped language with stack-dynamic local variables and nested subprograms?
A : First step, find correct activation record (the harder part) and then the second step is determine the offset within that activation record (easy part).

Q10 : Define static chain, static_depth, nesting_depth, and chain_offset.
A : Static chain is chain of static links connecting an activation record to all of it's static ancestors (it's enclosing subprograms).
Static depth is depth of the nesting for each enclosing static scope.
Nesting depth is the difference between the static depth of the reference and that of the scope where it was declared.
Chain offset is same as nesting depth.

No comments:

Post a Comment