On Tue, 2 Sep 2003, Leopold Toetsch wrote:

> Dan Sugalski <[EMAIL PROTECTED]> wrote:
> > On Tue, 2 Sep 2003, Leopold Toetsch wrote:
> 
> >> and no, not that one inside DOD, that one doesn't handle duplicates.
> 
> > Yes, yes it *does* handle duplicates. Otherwise it'd get caught in
> > infinite loops every time it came across a circular data structure. That's
> > what the next pointer in the PObj header gets used for, amongst other
> > things.
> 
> It does handle duplicates like so:
> 
> void pobject_lives(struct Parrot_Interp *interpreter, PObj *obj)
> {
>     /* if object is live or on free list return */
>     if (PObj_is_live_or_free_TESTALL(obj)) {
>         return;
>     }
>     /* mark it live */
>     PObj_live_SET(obj);
> 
> So if it was mark()ed already we return. That's not possible for freeze,
> thaw, dump, clone whatever. These must keep track of already visited
> objects via an hash for freeze, dump, clone, and via an ID array for
> thaw.

No, this isn't necessary. What you need to do when freezing an already 
frozen PMC is to emit a marker label that refers to the original version 
of the PMC, or always emit the marker when a PMC freezes another PMC and 
defer actual freezing of the PMC until the master freeze function walks 
over the PMC to freeze it.

                                        Dan

Reply via email to