summaryrefslogtreecommitdiff
path: root/rts
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 /rts
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 'rts')
-rw-r--r--rts/PrimOps.cmm20
1 files changed, 16 insertions, 4 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 57d7b9cea9..a692517d4e 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -158,6 +158,19 @@ stg_isMutableByteArrayPinnedzh ( gcptr mba )
jump stg_isByteArrayPinnedzh(mba);
}
+/* Note [LDV profiling when resizing arrays]
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * When we resize an array, as far as the LDV profiler is concerned, it dies and
+ * then is created anew.
+ *
+ * The OVERWRITING_CLOSURE_OFS macro handles calling LDV_recordDead() to mark it
+ * as dead but in the primops below we still have to call LDV_RECORD_CREATE to
+ * inform the profiler of the new array.
+ *
+ * See also overwritingClosureOfs()
+ */
+
// shrink size of MutableByteArray in-place
stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size )
// MutableByteArray# s -> Int# -> State# s -> State# s
@@ -167,8 +180,7 @@ stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size )
OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
ROUNDUP_BYTES_TO_WDS(new_size)));
StgArrBytes_bytes(mba) = new_size;
- // See the comments in overwritingClosureOfs for an explanation
- // of the interaction with LDV profiling.
+ // See Note [LDV Profiling when Shrinking Arrays]
LDV_RECORD_CREATE(mba);
return ();
@@ -193,6 +205,7 @@ stg_resizzeMutableByteArrayzh ( gcptr mba, W_ new_size )
OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
new_size_wds));
StgArrBytes_bytes(mba) = new_size;
+ // See Note [LDV profiling when resizing arrays]
LDV_RECORD_CREATE(mba);
return (mba);
@@ -222,8 +235,7 @@ stg_shrinkSmallMutableArrayzh ( gcptr mba, W_ new_size )
OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) +
new_size));
StgSmallMutArrPtrs_ptrs(mba) = new_size;
- // See the comments in overwritingClosureOfs for an explanation
- // of the interaction with LDV profiling.
+ // See Note [LDV profiling when resizing arrays]
LDV_RECORD_CREATE(mba);
return ();