diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-10-11 13:55:05 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-10-11 13:55:05 +0000 |
commit | 1ed01a871030f05905a9595e4837dfffc087ef64 (patch) | |
tree | 32c1335b52d0ec28d6a99d4ccaeae6a36a73bddc /rts/RetainerProfile.c | |
parent | 53d57aa3aa498120eb1beba1b9c30e6a5e4e2d0a (diff) | |
download | haskell-1ed01a871030f05905a9595e4837dfffc087ef64.tar.gz |
Add a proper write barrier for MVars
Previously MVars were always on the mutable list of the old
generation, which meant every MVar was visited during every minor GC.
With lots of MVars hanging around, this gets expensive. We addressed
this problem for MUT_VARs (aka IORefs) a while ago, the solution is to
use a traditional GC write-barrier when the object is modified. This
patch does the same thing for MVars.
TVars are still done the old way, they could probably benefit from the
same treatment too.
Diffstat (limited to 'rts/RetainerProfile.c')
-rw-r--r-- | rts/RetainerProfile.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 036eacf08b..745b8e75db 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -491,7 +491,8 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child ) // three children (fixed), no SRT // need to push a stackElement - case MVAR: + case MVAR_CLEAN: + case MVAR_DIRTY: // head must be TSO and the head of a linked list of TSOs. // Shoule it be a child? Seems to be yes. *first_child = (StgClosure *)((StgMVar *)c)->head; @@ -804,7 +805,8 @@ pop( StgClosure **c, StgClosure **cp, retainer *r ) // three children (fixed), no SRT // need to push a stackElement - case MVAR: + case MVAR_CLEAN: + case MVAR_DIRTY: if (se->info.next.step == 2) { *c = (StgClosure *)((StgMVar *)se->c)->tail; se->info.next.step++; // move to the next step @@ -1057,7 +1059,8 @@ isRetainer( StgClosure *c ) case TSO: // mutable objects - case MVAR: + case MVAR_CLEAN: + case MVAR_DIRTY: case MUT_VAR_CLEAN: case MUT_VAR_DIRTY: case MUT_ARR_PTRS_CLEAN: |