Re: [commit: ghc] master: a fix for checkTSO(): the TSO could be a WHITEHOLE (65e46f1)

Henrique Ferreiro <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <CAOVzDXS+DUBcRKOGfvXHSbtZwKEyAYa=MyuHWGhDO=Pfnzp60w@mail.gmail.com>
commit 65e46f144f3d8b18de7264b0b099086153c68d6c

> Author: Simon Marlow <[email protected]>
> Date:   Mon Nov 5 15:43:21 2012 +0000
>
>     a fix for checkTSO(): the TSO could be a WHITEHOLE
>
> >---------------------------------------------------------------
>
>  rts/sm/Sanity.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
> index 6237662..a760e57 100644
> --- a/rts/sm/Sanity.c
> +++ b/rts/sm/Sanity.c
> @@ -499,6 +499,9 @@ checkSTACK (StgStack *stack)
>  void
>  checkTSO(StgTSO *tso)
>  {
> +    StgTSO *next;
> +    const StgInfoTable *info;
> +
>      if (tso->what_next == ThreadKilled) {
>        /* The garbage collector doesn't bother following any pointers
>         * from dead threads, so don't check sanity here.
> @@ -506,9 +509,13 @@ checkTSO(StgTSO *tso)
>        return;
>      }
>
> -    ASSERT(tso->_link == END_TSO_QUEUE ||
> -           tso->_link->header.info == &stg_MVAR_TSO_QUEUE_info ||
> -           tso->_link->header.info == &stg_TSO_info);
> +    next = tso->_link;
> +    info = (const StgInfoTable*) tso->header.info;
> +
> +    ASSERT(next == END_TSO_QUEUE ||
> +           info == &stg_MVAR_TSO_QUEUE_info ||
> +           info == &stg_TSO_info ||
> +           info == &stg_WHITEHOLE_info); // happens due to STM doing
> lockTSO()
>
>      if (   tso->why_blocked == BlockedOnMVar
>         || tso->why_blocked == BlockedOnBlackHole
>

I may be missing something but in the original code you are checking the
info table of tso->_link and, in the new one, the info table of tso.

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.