summaryrefslogtreecommitdiff
path: root/rts/RtsStartup.c
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2018-05-10 11:13:37 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2018-05-10 11:53:09 +0300
commitb2ff5dde399cd012218578945ada1d9ff68daa35 (patch)
tree730a83ea4b91622894412f7882d5b2f1d5c7c6f2 /rts/RtsStartup.c
parent5fe6aaa3756cda654374ebfd883fa8f064ff64a4 (diff)
downloadhaskell-b2ff5dde399cd012218578945ada1d9ff68daa35.tar.gz
Fix #15038
We introduce a new Id for unused pointer values in unboxed sums that is not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY definitions CAFFY, fixing #15038. To make sure anything referenced by the new id will be retained we get a stable pointer to in on RTS startup. Test Plan: Passes validate Reviewers: simonmar, simonpj, hvr, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4680
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r--rts/RtsStartup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index e4ca6b906d..7eb98a8ba0 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -247,6 +247,10 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
/* Add some GC roots for things in the base package that the RTS
* knows about. We don't know whether these turn out to be CAFs
* or refer to CAFs, but we have to assume that they might.
+ *
+ * Because these stable pointers will retain any CAF references in
+ * these closures `Id`s of these can be safely marked as non-CAFFY
+ * in the compiler.
*/
getStablePtr((StgPtr)runIO_closure);
getStablePtr((StgPtr)runNonIO_closure);
@@ -265,6 +269,9 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
getStablePtr((StgPtr)cannotCompactPinned_closure);
getStablePtr((StgPtr)cannotCompactMutable_closure);
getStablePtr((StgPtr)nestedAtomically_closure);
+ getStablePtr((StgPtr)absentSumFieldError_closure);
+ // `Id` for this closure is marked as non-CAFFY,
+ // see Note [aBSENT_SUM_FIELD_ERROR_ID] in MkCore.
getStablePtr((StgPtr)runSparks_closure);
getStablePtr((StgPtr)ensureIOManagerIsRunning_closure);