summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-04-10 02:51:56 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-14 23:31:38 -0400
commite149dea9bb89b77d34f50075946d6b4751a974f0 (patch)
treef2b08bd7d9b65ec754ec3a01be71b9e3e8c7f7fe /includes
parentc3c0f662df06500a11970fd391d0a88e081a5296 (diff)
downloadhaskell-e149dea9bb89b77d34f50075946d6b4751a974f0.tar.gz
rts: Fix nomenclature in OVERWRITING_CLOSURE macros
The additional commentary introduced by commit 8916e64e5437 ("Implement shrinkSmallMutableArray# and resizeSmallMutableArray#.") unfortunately got this wrong. We set 'prim' to true in overwritingClosureOfs because we _don't_ want to call LDV_recordDead(). The reason is because of this "inherently used" distinction made in the LDV profiler so I rename the variable to be more appropriate.
Diffstat (limited to 'includes')
-rw-r--r--includes/rts/storage/ClosureMacros.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index c825d32d2b..262a4380c4 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -537,9 +537,9 @@ void LDV_recordDead (const StgClosure *c, uint32_t size);
EXTERN_INLINE void overwritingClosure_ (StgClosure *p,
uint32_t offset /* in words */,
uint32_t size /* closure size, in words */,
- bool prim /* Whether to call LDV_recordDead */
+ bool inherently_used USED_IF_PROFILING
);
-EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t size, bool prim USED_IF_PROFILING)
+EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t size, bool inherently_used USED_IF_PROFILING)
{
#if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK
// see Note [zeroing slop when overwriting closures], also #8402
@@ -548,7 +548,7 @@ EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t
// For LDV profiling, we need to record the closure as dead
#if defined(PROFILING)
- if (!prim) { LDV_recordDead(p, size); };
+ if (!inherently_used) { LDV_recordDead(p, size); };
#endif
for (uint32_t i = offset; i < size; i++) {
@@ -559,7 +559,8 @@ EXTERN_INLINE void overwritingClosure_ (StgClosure *p, uint32_t offset, uint32_t
EXTERN_INLINE void overwritingClosure (StgClosure *p);
EXTERN_INLINE void overwritingClosure (StgClosure *p)
{
- overwritingClosure_(p, sizeofW(StgThunkHeader), closure_sizeW(p), false);
+ overwritingClosure_(p, sizeofW(StgThunkHeader), closure_sizeW(p),
+ /*inherently_used=*/false);
}
// Version of 'overwritingClosure' which overwrites only a suffix of a
@@ -572,21 +573,21 @@ EXTERN_INLINE void overwritingClosure (StgClosure *p)
EXTERN_INLINE void overwritingClosureOfs (StgClosure *p, uint32_t offset);
EXTERN_INLINE void overwritingClosureOfs (StgClosure *p, uint32_t offset)
{
- // Set prim = true because overwritingClosureOfs is only
- // ever called by
- // shrinkMutableByteArray# (ARR_WORDS)
- // shrinkSmallMutableArray# (SMALL_MUT_ARR_PTRS)
- // This causes LDV_recordDead to be invoked. We want this
- // to happen because the implementations of the above
- // primops both call LDV_RECORD_CREATE after calling this,
- // effectively replacing the LDV closure biography.
- // See Note [LDV Profiling when Shrinking Arrays]
- overwritingClosure_(p, offset, closure_sizeW(p), true);
+ // Since overwritingClosureOfs is only ever called by:
+ //
+ // - shrinkMutableByteArray# (ARR_WORDS) and
+ //
+ // - shrinkSmallMutableArray# (SMALL_MUT_ARR_PTRS)
+ //
+ // we can safely set inherently_used = true, which means LDV_recordDead
+ // won't be invoked below. Since these closures are inherenlty used we don't
+ // need to track their destruction.
+ overwritingClosure_(p, offset, closure_sizeW(p), /*inherently_used=*/true);
}
// Version of 'overwritingClosure' which takes closure size as argument.
EXTERN_INLINE void overwritingClosureSize (StgClosure *p, uint32_t size /* in words */);
EXTERN_INLINE void overwritingClosureSize (StgClosure *p, uint32_t size)
{
- overwritingClosure_(p, sizeofW(StgThunkHeader), size, false);
+ overwritingClosure_(p, sizeofW(StgThunkHeader), size, /*inherently_used=*/false);
}