summaryrefslogtreecommitdiff
path: root/rts/ProfHeap.c
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-06-06 14:03:50 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-27 10:42:29 -0400
commita586b33f8e8ad60b5c5ef3501c89e9b71794bbed (patch)
treec1c23bc071458a63769433adecc0e072cc6adc64 /rts/ProfHeap.c
parent1c4f18d071dcd76d068ae06d43d7c5048b57d980 (diff)
downloadhaskell-a586b33f8e8ad60b5c5ef3501c89e9b71794bbed.tar.gz
rts: Correct handling of LARGE ARR_WORDS in LDV profiler
This implements the correct fix for #11627 by skipping over the slop (which is zeroed) rather than adding special case logic for LARGE ARR_WORDS which runs the risk of not performing a correct census by ignoring any subsequent blocks. This approach implements similar logic to that in Sanity.c
Diffstat (limited to 'rts/ProfHeap.c')
-rw-r--r--rts/ProfHeap.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 6fbfb6ea88..155e4d55a5 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -1010,19 +1010,6 @@ 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 = true;
- heapProfObject(census, (StgClosure *)p, size, prim);
- continue;
- }
-
while (p < bd->free) {
info = get_itbl((const StgClosure *)p);
prim = false;
@@ -1172,6 +1159,8 @@ heapCensusChain( Census *census, bdescr *bd )
heapProfObject(census,(StgClosure*)p,size,prim);
p += size;
+ /* skip over slop */
+ while (p < bd->free && !*p) p++; // skip slop
}
}
}