[project @ 2006-01-17 16:13:18 by simonmar]
[ghc-hetmet.git] / ghc / rts / ProfHeap.c
index 2593d1e..362bafe 100644 (file)
@@ -23,7 +23,6 @@
 #include "ProfHeap.h"
 #include "Stats.h"
 #include "Hash.h"
-#include "StrHash.h"
 #include "RetainerProfile.h"
 #include "LdvProfile.h"
 #include "Arena.h"
@@ -154,12 +153,13 @@ static char *type_names[] = {
 
     , "ARR_WORDS"
 
-    , "MUT_ARR_PTRS"
+    , "MUT_ARR_PTRS_CLEAN"
+    , "MUT_ARR_PTRS_DIRTY"
     , "MUT_ARR_PTRS_FROZEN"
-    , "MUT_VAR"
+    , "MUT_VAR_CLEAN"
+    , "MUT_VAR_DIRTY"
 
     , "WEAK"
-    , "FOREIGN"
   
     , "TSO"
 
@@ -405,7 +405,7 @@ initHeapProfiling(void)
 #ifdef PROFILING
     if (doingLDVProfiling() && doingRetainerProfiling()) {
        errorBelch("cannot mix -hb and -hr");
-       stg_exit(1);
+       stg_exit(EXIT_FAILURE);
     }
 #endif
 
@@ -907,6 +907,17 @@ heapCensusChain( Census *census, bdescr *bd )
                size = sizeW_fromITBL(info);
                break;
                
+           case IND:
+               // Special case/Delicate Hack: INDs don't normally
+               // appear, since we're doing this heap census right
+               // after GC.  However, GarbageCollect() also does
+               // resurrectThreads(), which can update some
+               // blackholes when it calls raiseAsync() on the
+               // resurrected threads.  So we know that any IND will
+               // be the size of a BLACKHOLE.
+               size = BLACKHOLE_sizeW();
+               break;
+
            case BCO:
                prim = rtsTrue;
                size = bco_sizeW((StgBCO *)p);
@@ -914,9 +925,9 @@ heapCensusChain( Census *census, bdescr *bd )
 
            case MVAR:
            case WEAK:
-           case FOREIGN:
            case STABLE_NAME:
-           case MUT_VAR:
+           case MUT_VAR_CLEAN:
+           case MUT_VAR_DIRTY:
                prim = rtsTrue;
                size = sizeW_fromITBL(info);
                break;
@@ -938,8 +949,10 @@ heapCensusChain( Census *census, bdescr *bd )
                size = arr_words_sizeW(stgCast(StgArrWords*,p));
                break;
                
-           case MUT_ARR_PTRS:
+           case MUT_ARR_PTRS_CLEAN:
+           case MUT_ARR_PTRS_DIRTY:
            case MUT_ARR_PTRS_FROZEN:
+           case MUT_ARR_PTRS_FROZEN0:
                prim = rtsTrue;
                size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
                break;
@@ -960,8 +973,28 @@ heapCensusChain( Census *census, bdescr *bd )
                }
 #endif
 
+           case TREC_HEADER: 
+               prim = rtsTrue;
+               size = sizeofW(StgTRecHeader);
+               break;
+
+           case TVAR_WAIT_QUEUE:
+               prim = rtsTrue;
+               size = sizeofW(StgTVarWaitQueue);
+               break;
+               
+           case TVAR:
+               prim = rtsTrue;
+               size = sizeofW(StgTVar);
+               break;
+               
+           case TREC_CHUNK:
+               prim = rtsTrue;
+               size = sizeofW(StgTRecChunk);
+               break;
+
            default:
-               barf("heapCensus");
+               barf("heapCensus, unknown object: %d", info->type);
            }
            
            identity = NULL;