From b2ff5dde399cd012218578945ada1d9ff68daa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Thu, 10 May 2018 11:13:37 +0300 Subject: 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 --- rts/RtsStartup.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rts/RtsStartup.c') 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); -- cgit v1.2.1