[commit: ghc] master: Don't clearNurseries() in parallel with -debug (2073e3e)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2073e3ecc5dd0e37e097bd331f19a782eb96785d

>---------------------------------------------------------------

commit 2073e3ecc5dd0e37e097bd331f19a782eb96785d
Author: Simon Marlow <[email protected]>
Date:   Wed Oct 31 12:38:06 2012 +0000

    Don't clearNurseries() in parallel with -debug
    
    It makes sanity-checking fail.

>---------------------------------------------------------------

 includes/Rts.h |    6 ++++++
 rts/sm/GC.c    |    8 +++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/includes/Rts.h b/includes/Rts.h
index b317768..edb48c1 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -306,6 +306,12 @@ TICK_VAR(2)
 #define DEBUG_ONLY(s) doNothing()
 #endif
 
+#ifdef DEBUG
+#define DEBUG_IS_ON   1
+#else
+#define DEBUG_IS_ON   0
+#endif
+
 /* -----------------------------------------------------------------------------
    Useful macros and inline functions
    -------------------------------------------------------------------------- */
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 8b92ca8..b9485f2 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -404,7 +404,7 @@ GarbageCollect (nat collect_gen,
       break;
   }
 
-  if (n_gc_threads != 1) {
+  if (!DEBUG_IS_ON && n_gc_threads != 1) {
       gct->allocated = clearNursery(cap);
   }
 
@@ -638,7 +638,7 @@ GarbageCollect (nat collect_gen,
   }
 
   // Reset the nursery: make the blocks empty
-  if (n_gc_threads == 1) {
+  if (DEBUG_IS_ON || n_gc_threads == 1) {
       for (n = 0; n < n_capabilities; n++) {
           allocated += clearNursery(&capabilities[n]);
       }
@@ -1074,7 +1074,9 @@ gcWorkerThread (Capability *cap)
 
     scavenge_until_all_done();
     
-    gct->allocated = clearNursery(cap);
+    if (!DEBUG_IS_ON) {
+        gct->allocated = clearNursery(cap);
+    }
 
 #ifdef THREADED_RTS
     // Now that the whole heap is marked, we discard any sparks that
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.