[commit: ghc] ghc-8.6: Fix gcCAFs() (75d3415)
git at git.haskell.org
git at git.haskell.org
Thu Sep 13 21:00:29 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/75d3415bf063ec5ea4eedba3c56d6871bc0b25a3/ghc
>---------------------------------------------------------------
commit 75d3415bf063ec5ea4eedba3c56d6871bc0b25a3
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Jul 26 17:19:54 2018 -0400
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
(cherry picked from commit e431d75f8350f25159f9aaa49fe9a504e94bc0a4)
>---------------------------------------------------------------
75d3415bf063ec5ea4eedba3c56d6871bc0b25a3
rts/sm/GC.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index aeb0c8a..90857ab 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1848,7 +1848,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) {
More information about the ghc-commits
mailing list