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

2012-11-14 Thread Simon Marlow

On 13/11/2012 16:43, Henrique Ferreiro wrote:

commit 65e46f144f3d8b18de7264b0b099086153c68d6c

Author: Simon Marlow marlo...@gmail.com mailto:marlo...@gmail.com
Date:   Mon Nov 5 15:43:21 2012 +

 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 http://header.info ==
stg_MVAR_TSO_QUEUE_info ||
-   tso-_link-header.info http://header.info ==
stg_TSO_info);
+next = tso-_link;
+info = (const StgInfoTable*) tso-header.info http://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.


Well spotted, thanks.

Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


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

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/65e46f144f3d8b18de7264b0b099086153c68d6c

---

commit 65e46f144f3d8b18de7264b0b099086153c68d6c
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 15:43:21 2012 +

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



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


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

2012-11-13 Thread Henrique Ferreiro
commit 65e46f144f3d8b18de7264b0b099086153c68d6c

 Author: Simon Marlow marlo...@gmail.com
 Date:   Mon Nov 5 15:43:21 2012 +

 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
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc