2009-12-16

CAR (current activation record)


7.5:
. a var`init associates a var`instantiation
with a particular subroutine or block activation
(stacked activation record, or act'rec)
. at the end of the act'rec (when the stack gets rolled back),
a type-class gets another call to close
-- this doesn't need a parameter because it implicitly refers to
the current act'rec .
this is done without the programmer,
by translating var creations into these {init, close} pairs of calls .

7.6:
. when a subprogram starts up,
it needs space for its own locals,
and when done, then it needs to release its own locals .
. this space typically comes from a combination of
the system's stack and heap .

. the elaboration of a declare block or subprogram call
results in the creation of a new scope,
meaning it creates a new activation record on the stack,
referred to as the [current activation record] (CAR) .
. for the sake of modularity,
the computer's heap space should be decomposed into
separate subheaps for each subprogram call .
. this will make it easy to both get the memory back
after the subprogram returns,
and associate each object with a particular subheap .
. so then, in its simplest incarnation,
the CAR on the stack is simply a pointer to a subheap;
and, when the subprogram returns,
it can simply dispose of its one subheap
rather than asking each involved type-mgt
to recycle its own objects .

. when a scope creates a new variable of type"T,
it's calling T`type-mgt to implicitely use CAR space
to allocate a piece of the subheap and initialize it .

No comments:

Post a Comment