Per-generation lists of weak pointers

Akio Takano tkn.akio at gmail.com
Mon May 6 11:46:54 CEST 2013


Thank you for your comments.


On Mon, May 6, 2013 at 4:32 AM, Simon Marlow <marlowsd at gmail.com> wrote:

> Akio, I looked at your first patch, which mostly seems good.  The sequence
> at the beginning of deRefWeak certainly looks strange - I think it's ok,
> but it needs a comment.
>

I update my patches and added a comment to that part.


>
> One thing I'm confused about is the handling of DEAD_WEAK pointers.  You
> removed the StgDeadWeak struct - how is that possible?  I don't understand
> why DEAD_WEAK has 4 payload words, but StgDeadWeak has only one, and
> furthermore a DEAD_WEAK appears to have the link field in a different place
> from the WEAK closure.  Something is suspicious here.
>

Before my patch, dead weak pointers had the same size as live ones,  but
they had the link field in different places.

With my patch, dead weak pointers have the same layout as live ones, so
they can be accessed with the single StgWeak struct. The only differences
between live and dead weak pointers now are the info pointer, and whether
the "cfinalizers" field is followed by the GC. The code is simplified a bit
because it doesn't need to deal with two different layouts.

I think I needed this change in order to keep finalizeWeak# atomic, but now
that I use lockClosure() to ensure atomicity, probably I can remove this
change from the patch. Should I do so?

- Akio



>
> Cheers,
>         Simon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130506/ffa2ed66/attachment.htm>


More information about the ghc-devs mailing list