From 4e9a8fa407e0d0287ac7e1a1efdef3380db57df2 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 7 Nov 2000 18:00:26 +0000 Subject: [PATCH] [project @ 2000-11-07 18:00:26 by simonmar] URK! when scanning the heap we might find a DEAD_WEAK that either (a) is the size of a WEAK, because we just overwrote its info table, or (b) is the size of a DEAD_WEAK, because its been around at least one GC. The code herein only accounted for case (a). Fix: check the word at location p+sizeof(DEAD_WEAK), see whether it looks like an info table ptr, and if so we're in case (b). This is guaranteed to work, because we know that in case (a) the appropriate word will be a closure pointer. --- ghc/rts/ProfHeap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ghc/rts/ProfHeap.c b/ghc/rts/ProfHeap.c index 82857f9..d69ac4b 100644 --- a/ghc/rts/ProfHeap.c +++ b/ghc/rts/ProfHeap.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: ProfHeap.c,v 1.16 2000/07/09 16:17:10 panne Exp $ + * $Id: ProfHeap.c,v 1.17 2000/11/07 18:00:26 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -496,9 +496,10 @@ heapCensus(void) break; case CONSTR: - if (((StgClosure *)p)->header.info == &DEAD_WEAK_info) { - size = sizeofW(StgWeak); - break; + if (((StgClosure *)p)->header.info == &DEAD_WEAK_info + && !(LOOKS_LIKE_GHC_INFO(*(p + sizeW_fromITBL(info))))) { + size = sizeofW(StgWeak); + break; } /* else, fall through... */ -- 1.7.10.4