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.

>                                       Dan

leo

Reply via email to