Benjamin Goldberg writes:
> Juergen Boemmels wrote:
> > Benjamin Goldberg <[EMAIL PROTECTED]> writes:
> > 
> > > The pobject_weakref function first checks if the 'weakref' argument
> > > has been marked as alive -- if so, nothing happens.  Then, it adds the
> > > Pobj* to a lookup table, pointing from the Pobj*, to a list of
> > > registered callbacks for that Pobj*.
> > 
> > This is far to complicated. Each object has a list of
> > destroy-functions, one of them is the costom-destroy function the
> > others are the weakref-callbacks.
> 
> But suppose that at the end of DoD, the object we're weakly referring to
> gets marked as alive?  Now, we would need to look through that object's
> list of destroy-functions, and remove all of the weakref-callbacks.
> 
> But if the weakref-callbacks are stored in a seperate data structure,
> created during DoD, then there's no problem; this data structure will
> get re-created for each DoD pass, and thus always start empty.
> 
> Also, by keeping them seperate, we can walk all the callback functions
> before destructing the dead objects.
> 
> (But you're right -- it is too complicated to do a lookup table.  A
> simple linked list should do fine.)

I may be missing the problem that you are talking about, but it seems to
me that since we have PMCs which mark themselves instead of being
automatically marked, a WeakRef PMC would be trivial...  I don't think
it needs to be any more fundamental than a PMC.

Luke

Reply via email to