diff options
author | Jason Eisenberg <jasoneisenberg@gmail.com> | 2016-03-20 17:49:24 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-20 18:31:20 +0100 |
commit | ba95f22eb98cc2ee2d8d76e56df80769c379413d (patch) | |
tree | a0e00e3d6a10c90ce010bc9b750e775303d1e11f /rts/ProfHeap.c | |
parent | 7186a01ab4278102ec4e21d3cf67795d51973365 (diff) | |
download | haskell-ba95f22eb98cc2ee2d8d76e56df80769c379413d.tar.gz |
prof: Fix heap census for large ARR_WORDS (#11627)
The heap census now handles large ARR_WORDS objects which have
been shrunk by shrinkMutableByteArray# or resizeMutableByteArray#.
Test Plan: ./validate && make test WAY=profasm
Reviewers: hvr, bgamari, austin, thomie
Reviewed By: thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2005
GHC Trac Issues: #11627
Diffstat (limited to 'rts/ProfHeap.c')
-rw-r--r-- | rts/ProfHeap.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index a7ea3eb565..819faeb9be 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -937,6 +937,20 @@ heapCensusChain( Census *census, bdescr *bd ) } p = bd->start; + + // When we shrink a large ARR_WORDS, we do not adjust the free pointer + // of the associated block descriptor, thus introducing slop at the end + // of the object. This slop remains after GC, violating the assumption + // of the loop below that all slop has been eliminated (#11627). + // Consequently, we handle large ARR_WORDS objects as a special case. + if (bd->flags & BF_LARGE + && get_itbl((StgClosure *)p)->type == ARR_WORDS) { + size = arr_words_sizeW((StgArrBytes *)p); + prim = rtsTrue; + heapProfObject(census, (StgClosure *)p, size, prim); + continue; + } + while (p < bd->free) { info = get_itbl((StgClosure *)p); prim = rtsFalse; |