From 76ebf3dcb916a1116302896090059c9c32ab5c6a Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 23 Sep 2003 15:38:36 +0000 Subject: [PATCH] [project @ 2003-09-23 15:38:35 by simonmar] Add a BF_PINNED block flag, and attach it to blocks containing pinned objects (in addition to the usual BF_LARGE). In heapCensus, we now ignore blocks containing pinned objects, because they might contain gaps, and in any case it isn't clear that we want to include the whole block in a heap census, because much of it might well be dead. Ignoring it isn't right either, though, so this patch just fixes the crash and leaves a ToDo. --- ghc/includes/Block.h | 3 ++- ghc/rts/ProfHeap.c | 11 ++++++++++- ghc/rts/Storage.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ghc/includes/Block.h b/ghc/includes/Block.h index 867a73c..f07d4e7 100644 --- a/ghc/includes/Block.h +++ b/ghc/includes/Block.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Block.h,v 1.13 2003/03/28 15:13:52 sof Exp $ + * $Id: Block.h,v 1.14 2003/09/23 15:38:35 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -78,6 +78,7 @@ typedef struct _bdescr { #define BF_EVACUATED 1 #define BF_LARGE 2 +#define BF_PINNED 4 /* Finding the block descriptor for a given block -------------------------- */ diff --git a/ghc/rts/ProfHeap.c b/ghc/rts/ProfHeap.c index 19beb9c..27a1a41 100644 --- a/ghc/rts/ProfHeap.c +++ b/ghc/rts/ProfHeap.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: ProfHeap.c,v 1.47 2003/08/22 22:24:12 sof Exp $ + * $Id: ProfHeap.c,v 1.48 2003/09/23 15:38:36 simonmar Exp $ * * (c) The GHC Team, 1998-2003 * @@ -825,6 +825,15 @@ heapCensusChain( Census *census, bdescr *bd ) rtsBool prim; for (; bd != NULL; bd = bd->link) { + + // HACK: ignore pinned blocks, because they contain gaps. + // It's not clear exactly what we'd like to do here, since we + // can't tell which objects in the block are actually alive. + // Perhaps the whole block should be counted as SYSTEM memory. + if (bd->flags & BF_PINNED) { + continue; + } + p = bd->start; while (p < bd->free) { info = get_itbl((StgClosure *)p); diff --git a/ghc/rts/Storage.c b/ghc/rts/Storage.c index 62a383f..f511b76 100644 --- a/ghc/rts/Storage.c +++ b/ghc/rts/Storage.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Storage.c,v 1.79 2003/03/26 18:59:34 sof Exp $ + * $Id: Storage.c,v 1.80 2003/09/23 15:38:36 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -588,7 +588,7 @@ allocatePinned( nat n ) dbl_link_onto(bd, &g0s0->large_objects); bd->gen_no = 0; bd->step = g0s0; - bd->flags = BF_LARGE; + bd->flags = BF_PINNED | BF_LARGE; bd->free = bd->start; alloc_blocks++; } -- 1.7.10.4