summaryrefslogtreecommitdiff
path: root/ghc/rts/GCCompact.c
diff options
context:
space:
mode:
authorsimonmar <unknown>2006-01-17 16:03:47 +0000
committersimonmar <unknown>2006-01-17 16:03:47 +0000
commitda69fa9c5047c5b0d05bdb05eaddefa1eb5d5a36 (patch)
treee36c0dbe532aa64733194420ff9b0dd96359e7f6 /ghc/rts/GCCompact.c
parentba41623270c1d541e74bd5182e1b4fcbe99809cc (diff)
downloadhaskell-da69fa9c5047c5b0d05bdb05eaddefa1eb5d5a36.tar.gz
[project @ 2006-01-17 16:03:47 by simonmar]
Improve the GC behaviour of IOArrays/STArrays See Ticket #650 This is a small change to the way mutable arrays interact with the GC, that can have a dramatic effect on performance, and make tricks with unsafeThaw/unsafeFreeze redundant. Data.HashTable should be faster now (I haven't measured it yet). We now have two mutable array closure types, MUT_ARR_PTRS_CLEAN and MUT_ARR_PTRS_DIRTY. Both are on the mutable list if the array is in an old generation. writeArray# sets the type to MUT_ARR_PTRS_DIRTY. The garbage collector can set the type to MUT_ARR_PTRS_CLEAN if it finds that no element of the array points into a younger generation (discovering this required a small addition to evacuate(), but rough tests indicate that it doesn't measurably affect performance). NOTE: none of this affects unboxed arrays (IOUArray/STUArray), only boxed arrays (IOArray/STArray). We could go further and extend the DIRTY bit to be per-block rather than for the whole array, but for now this is an easy improvement.
Diffstat (limited to 'ghc/rts/GCCompact.c')
-rw-r--r--ghc/rts/GCCompact.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ghc/rts/GCCompact.c b/ghc/rts/GCCompact.c
index 58753feed4..9d05f5d49a 100644
--- a/ghc/rts/GCCompact.c
+++ b/ghc/rts/GCCompact.c
@@ -138,7 +138,8 @@ obj_sizeW( StgClosure *p, StgInfoTable *info )
return pap_sizeW((StgPAP *)p);
case ARR_WORDS:
return arr_words_sizeW((StgArrWords *)p);
- case MUT_ARR_PTRS:
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
return mut_arr_ptrs_sizeW((StgMutArrPtrs*)p);
@@ -478,7 +479,8 @@ update_fwd_large( bdescr *bd )
// nothing to follow
continue;
- case MUT_ARR_PTRS:
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
// follow everything
@@ -657,7 +659,8 @@ thread_obj (StgInfoTable *info, StgPtr p)
case ARR_WORDS:
return p + arr_words_sizeW((StgArrWords *)p);
- case MUT_ARR_PTRS:
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
// follow everything