summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-11 13:48:05 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-17 16:00:14 -0400
commitb048a9f4e28186d2245427d2d83f08418573fae5 (patch)
treee9b7e97ed8ede18bb65c512645620bb460260842 /rts/sm
parentcb52b4ae1508639e2686717d220b977e201394d3 (diff)
downloadhaskell-b048a9f4e28186d2245427d2d83f08418573fae5.tar.gz
codeGen: Ensure that static datacon apps are included in SRTs
When generating an SRT for a recursive group, GHC.Cmm.Info.Build.oneSRT filters out recursive references, as described in Note [recursive SRTs]. However, doing so for static functions would be unsound, for the reason described in Note [Invalid optimisation: shortcutting]. However, the same argument applies to static data constructor applications, as we discovered in #20959. Fix this by ensuring that static data constructor applications are included in recursive SRTs. The approach here is not entirely satisfactory, but it is a starting point. Fixes #20959.
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/Storage.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/sm/Storage.h b/rts/sm/Storage.h
index 00f2943a51..0fecc50208 100644
--- a/rts/sm/Storage.h
+++ b/rts/sm/Storage.h
@@ -147,6 +147,12 @@ void move_STACK (StgStack *src, StgStack *dest);
bits = link_field & 3;
if ((bits | prev_static_flag) != 3) { ... }
+ However, this mechanism for tracking liveness has an important implication:
+ once a static object becomes unreachable it must never become reachable again.
+ One would think that this can by definition never happen but in the past SRT
+ generation bugs have caused precisely this behavior with disasterous results.
+ See Note [No static object resurrection] in GHC.Cmm.Info.Build for details.
+
-------------------------------------------------------------------------- */
#define STATIC_BITS 3