Commit 75d3415b authored by Simon Marlow's avatar Simon Marlow Committed by Ben Gamari

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 e431d75f)
parent d2ac6e95
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment