summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2018-07-26 17:19:54 -0400
committerBen Gamari <ben@smart-cactus.org>2018-07-27 12:29:39 -0400
commite431d75f8350f25159f9aaa49fe9a504e94bc0a4 (patch)
tree30ac7a17f274ad5186aafbd7c1a0bcb4a3396e89
parent3c311e50e760c3ba00dc9692ad1536c79820598d (diff)
downloadhaskell-e431d75f8350f25159f9aaa49fe9a504e94bc0a4.tar.gz
Fix gcCAFs()
The test here should have been changed after D1106. It was harmless but we caught fewer GC'd CAFs than we should have. Test Plan: Using `nofib/imaginary/primes` compiled with `-debug`. Before: ``` > ./primes 100 +RTS -G1 -A32k -DG CAF gc'd at 0x0x7b0960 CAF gc'd at 0x0x788728 CAF gc'd at 0x0x790db0 CAF gc'd at 0x0x790de0 12 CAFs live CAF gc'd at 0x0x788880 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 547 CAF gc'd at 0x0x7995c8 13 CAFs live ``` After: ``` > ./primes 100 +RTS -G1 -A32k -DG CAF gc'd at 0x0x7b0960 CAF gc'd at 0x0x788728 CAF gc'd at 0x0x790db0 CAF gc'd at 0x0x790de0 12 CAFs live CAF gc'd at 0x0x788880 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 12 CAFs live 547 CAF gc'd at 0x0x7995c8 CAF gc'd at 0x0x790ea0 12 CAFs live ``` Reviewers: bgamari, osa1, erikd, noamz Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4963
-rw-r--r--rts/sm/GC.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 67eba93d52..742ae360c5 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1846,7 +1846,10 @@ static void gcCAFs(void)
info = get_itbl((StgClosure*)p);
ASSERT(info->type == IND_STATIC);
- if (p->static_link == NULL) {
+ // See Note [STATIC_LINK fields] in Storage.h
+ // This condition identifies CAFs that have just been GC'd and
+ // don't have static_link==3 which means they should be ignored.
+ if ((((StgWord)(p->static_link)&STATIC_BITS) | prev_static_flag) != 3) {
debugTrace(DEBUG_gccafs, "CAF gc'd at 0x%p", p);
SET_INFO((StgClosure*)p,&stg_GCD_CAF_info); // stub it
if (prev == NULL) {