Commit 8ea8c371 authored by Simon Marlow's avatar Simon Marlow

Fix up the conditions for zeroing slop (#8402)

parent b9c6fd72
...@@ -457,20 +457,31 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) ...@@ -457,20 +457,31 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
OVERWRITING_CLOSURE(p) on the old closure that is about to be OVERWRITING_CLOSURE(p) on the old closure that is about to be
overwritten. overwritten.
In PROFILING mode, LDV profiling requires that we fill the slop Note [zeroing slop]
with zeroes, and record the old closure as dead (LDV_recordDead()).
In DEBUG mode, we must overwrite the slop with zeroes, because the In some scenarios we write zero words into "slop"; memory that is
sanity checker wants to walk through the heap checking all the left unoccupied after we overwrite a closure in the heap with a
pointers. smaller closure.
In multicore mode, we *cannot* overwrite slop with zeroes, because Zeroing slop is required for:
another thread might be reading it. So,
LDV PROFILING is not compatible with +RTS -N<n> (for n > 1) - full-heap sanity checks (DEBUG, and +RTS -DS)
- LDV profiling (PROFILING, and +RTS -hb)
THREADED_RTS can be used with DEBUG, but full heap sanity Zeroing slop must be disabled for:
checking is disabled except after major GC.
- THREADED_RTS with +RTS -N2 and greater, because we cannot
overwrite slop when another thread might be reading it.
Hence, slop is zeroed when either:
- PROFILING && era <= 0 (LDV is on)
- !THREADED_RTS && DEBUG
And additionally:
- LDV profiling and +RTS -N2 are incompatible
- full-heap sanity checks are disabled for THREADED_RTS
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -489,6 +500,11 @@ EXTERN_INLINE void overwritingClosure (StgClosure *p) ...@@ -489,6 +500,11 @@ EXTERN_INLINE void overwritingClosure (StgClosure *p)
{ {
nat size, i; nat size, i;
#if defined(PROFILING) && !defined(DEBUG)
// see Note [zeroing slop]
if (era <= 0) return;
#endif
size = closure_sizeW(p); size = closure_sizeW(p);
// For LDV profiling, we need to record the closure as dead // For LDV profiling, we need to record the closure as dead
......
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