[gclist] Finalization and object orientation.

Eliot & Linda elcm@pacbell.net
Fri, 28 Mar 1997 13:03:07 -0800


James McCartney wrote:
> 
> Eliot Miranda <eliot@parcplace.com> wrote:
> >So can we agree that in languages which reify execution state and
> >don't allow pointer forging that reachability is decidable?
> 
> Not as I understand it. x would be reachable by a Smalltalk garbage
> collector, but not truly reachable by the program itself.
> He could have just as well have written:
> 
> Object>>
> ---
> foo
>    | x |
>    x := Something new.
>    self bar.
>    x doSomething.
> -----
> bar
>    true whileTrue: [ ..blah.. ].
> -----
> 
> x is unreachable by the definition given. It doesn't matter that a
> tracing gc would know where it is in an activation frame, the program
> will never access it.

Not so in a Smalltalk _environment_ with contexts.  In the above one
could interrupt the compuation, gain access to the suspended process,
walk the context chain and reach x.  This is exactly what one might do
e.g. to freeze a process via binary storage to a file, or to look at
the process via a debugger.  Once one has contexts one can reach
programmatically all live variables.  The roots of a classical
Smalltalk-80 system are
	Set with: thisContext with: Smalltalk

Hence the system tracer.  The system tracer is a Smalltalk program that
completely clones an image file from within a running Smalltalk,
starting
its trace from thisContext and Smalltalk.  Loading this image resumes
compuation at the point immediately following the invocation of the
tracer.

In the original reference-counted Smalltalk implementations at PARC
the system tracer was the global garbage collector, but then one
can't do finalization with it because it can only find reachable
objects. 
_______________,,,^..^,,,_______________
Eliot Miranda, ParcPlace-Digitalk