diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-03-11 13:48:05 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-05-09 17:59:04 -0400 |
commit | fb42a0eb55473bdf0638aba202c81b968accef3b (patch) | |
tree | b36c641d2f6b73f57a52a0f853cee0a4c110f764 /rts/sm/Storage.h | |
parent | ec4d47dc6b607b7bfbd5c0b76fbd28a1bd9cb3ff (diff) | |
download | haskell-wip/T20959.tar.gz |
codeGen: Ensure that static datacon apps are included in SRTswip/T20959
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/Storage.h')
-rw-r--r-- | rts/sm/Storage.h | 6 |
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 |