Wed Jul 7 11:54:25 BRT 2010 Marco TĂșlio Gontijo e Silva * Don't check blocks that were swept with -DS. diff -rN -u old-ghc-temp/includes/rts/storage/Block.h new-ghc-temp-1/includes/rts/storage/Block.h --- old-ghc-temp/includes/rts/storage/Block.h 2010-07-07 19:24:01.000000000 -0300 +++ new-ghc-temp-1/includes/rts/storage/Block.h 2010-07-07 19:24:02.000000000 -0300 @@ -100,6 +100,8 @@ #define BF_KNOWN 128 /* Block contains objects larger than a line */ #define BF_MEDIUM 256 +/* Blocks that were swept in the last GC */ +#define BF_SWEPT 512 /* Finding the block descriptor for a given block -------------------------- */ diff -rN -u old-ghc-temp/rts/sm/GC.c new-ghc-temp-1/rts/sm/GC.c --- old-ghc-temp/rts/sm/GC.c 2010-07-07 19:24:01.000000000 -0300 +++ new-ghc-temp-1/rts/sm/GC.c 2010-07-07 19:24:02.000000000 -0300 @@ -1302,6 +1302,10 @@ if (!(bd->flags & BF_FRAGMENTED)) { bd->flags |= BF_MARKED; } + + // BF_SWEPT should be marked only for blocks that are being + // collected in sweep() + bd->flags &= ~BF_SWEPT; } } } diff -rN -u old-ghc-temp/rts/sm/Sanity.c new-ghc-temp-1/rts/sm/Sanity.c --- old-ghc-temp/rts/sm/Sanity.c 2010-07-07 19:24:01.000000000 -0300 +++ new-ghc-temp-1/rts/sm/Sanity.c 2010-07-07 19:24:02.000000000 -0300 @@ -473,17 +473,18 @@ #endif for (; bd != NULL; bd = bd->link) { - p = bd->start; - while (p < bd->free) { - nat size = checkClosure((StgClosure *)p); - /* This is the smallest size of closure that can live in the heap */ - ASSERT( size >= MIN_PAYLOAD_SIZE + sizeofW(StgHeader) ); - p += size; - + if(!(bd->flags & BF_SWEPT)) { + p = bd->start; + while (p < bd->free) { + nat size = checkClosure((StgClosure *)p); + /* This is the smallest size of closure that can live in the heap */ + ASSERT( size >= MIN_PAYLOAD_SIZE + sizeofW(StgHeader) ); + p += size; /* skip over slop */ while (p < bd->free && (*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; } - } + } + } } } diff -rN -u old-ghc-temp/rts/sm/Sweep.c new-ghc-temp-1/rts/sm/Sweep.c --- old-ghc-temp/rts/sm/Sweep.c 2010-07-07 19:24:01.000000000 -0300 +++ new-ghc-temp-1/rts/sm/Sweep.c 2010-07-07 19:24:02.000000000 -0300 @@ -64,6 +64,8 @@ blocks++; resid = 0; + bd->flags |= BF_SWEPT; + // The block is analyzed in groups of BITS_IN(W_) words, where // BITS_IN(W_) is the word size in bits. for (i = 0; i < BLOCK_SIZE_W / BITS_IN(W_); i++)