Commit eff182c3 authored by marcotmarcot's avatar marcotmarcot
Browse files

Don't check for swept blocks in -DS.

The checkHeap function assumed the allocated part of the block contained only
alive objects and slops.  This was not true for blocks that are collected using
mark sweep.  The code in this patch skip the test for this kind of blocks.
parent 8d1cbbdf
......@@ -98,6 +98,8 @@ typedef struct bdescr_ {
#define BF_FRAGMENTED 64
/* we know about this block (for finding leaks) */
#define BF_KNOWN 128
/* Block was swept in the last generation */
#define BF_SWEPT 256
/* Finding the block descriptor for a given block -------------------------- */
......
......@@ -1309,6 +1309,10 @@ init_collected_gen (nat g, nat n_threads)
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;
}
}
}
......
......@@ -473,16 +473,18 @@ checkHeap(bdescr *bd)
#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++; }
/* skip over slop */
while (p < bd->free &&
(*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; }
}
}
}
}
......
......@@ -67,6 +67,8 @@ sweep(generation *gen)
fragd++;
bd->flags |= BF_FRAGMENTED;
}
bd->flags |= BF_SWEPT;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment