diff options
author | simonmar <unknown> | 2006-01-17 16:03:47 +0000 |
---|---|---|
committer | simonmar <unknown> | 2006-01-17 16:03:47 +0000 |
commit | da69fa9c5047c5b0d05bdb05eaddefa1eb5d5a36 (patch) | |
tree | e36c0dbe532aa64733194420ff9b0dd96359e7f6 /ghc/rts/Sanity.c | |
parent | ba41623270c1d541e74bd5182e1b4fcbe99809cc (diff) | |
download | haskell-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/Sanity.c')
-rw-r--r-- | ghc/rts/Sanity.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ghc/rts/Sanity.c b/ghc/rts/Sanity.c index 43200d2ba9..f6947c9f8c 100644 --- a/ghc/rts/Sanity.c +++ b/ghc/rts/Sanity.c @@ -400,7 +400,8 @@ checkClosure( StgClosure* 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: { |