summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-10 09:31:00 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-07 00:10:15 -0500
commit30f7137d1acc48499840d9a106ecce6109fd8e7a (patch)
treea7a792bf6f014b574fde8032a6f0488567dd01dc /includes
parentfb81f2edccaa8a02b0b3f68e82f0c795346e3b54 (diff)
downloadhaskell-30f7137d1acc48499840d9a106ecce6109fd8e7a.tar.gz
rts: Zero shrunk array slop in vanilla RTS
But only when profiling or DEBUG are enabled. Fixes #17572.
Diffstat (limited to 'includes')
-rw-r--r--includes/Cmm.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 574c60a1b3..fdb4badf9a 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -630,7 +630,11 @@
#else
#define OVERWRITING_CLOSURE_SIZE(c, size) /* nothing */
#define OVERWRITING_CLOSURE(c) /* nothing */
-#define OVERWRITING_CLOSURE_MUTABLE(c, off) /* nothing */
+/* This is used to zero slop after shrunk arrays. It is important that we do
+ * this whenever profiling is enabled as described in Note [slop on the heap]
+ * in Storage.c. */
+#define OVERWRITING_CLOSURE_MUTABLE(c, off) \
+ if (TO_W_(RtsFlags_ProfFlags_doHeapProfile(RtsFlags)) != 0) { foreign "C" overwritingMutableClosureOfs(c "ptr", off); }
#endif
// Memory barriers.