[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Stop retaining old ModGuts throughout subsequent simplifier phases

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jan 17 02:23:53 UTC 2024



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
f42c8cb8 by Matthew Pickering at 2024-01-16T21:23:48-05:00
Stop retaining old ModGuts throughout subsequent simplifier phases

Each phase of the simplifier typically rewrites the majority of ModGuts,
so we want to be able to release the old ModGuts as soon as possible.

`name_ppr_ctxt` lives throught the whole optimiser phase and it was
retaining a reference to `ModGuts`, so we were failing to release the
old `ModGuts` until the end of the phase (potentially doubling peak
memory usage for that particular phase).

This was discovered using eras profiling (#24332)

Fixes #24328

- - - - -
93402ace by Matthew Pickering at 2024-01-16T21:23:48-05:00
Update nofib submodule

- - - - -


2 changed files:

- compiler/GHC/Core/Opt/Pipeline.hs
- nofib


Changes:

=====================================
compiler/GHC/Core/Opt/Pipeline.hs
=====================================
@@ -463,11 +463,16 @@ doCorePass pass guts = do
   let fam_envs = (p_fam_env, mg_fam_inst_env guts)
   let updateBinds  f = return $ guts { mg_binds = f (mg_binds guts) }
   let updateBindsM f = f (mg_binds guts) >>= \b' -> return $ guts { mg_binds = b' }
+  -- Important to force this now as name_ppr_ctx lives through an entire phase in
+  -- the optimiser and if it's not forced then the entire previous `ModGuts` will
+  -- be retained until the end of the phase. (See #24328 for more analysis)
+  let !rdr_env = mg_rdr_env guts
   let name_ppr_ctx =
         mkNamePprCtx
           (initPromotionTickContext dflags)
           (hsc_unit_env hsc_env)
-          (mg_rdr_env guts)
+          rdr_env
+
 
   case pass of
     CoreDoSimplify opts       -> {-# SCC "Simplify" #-}


=====================================
nofib
=====================================
@@ -1 +1 @@
-Subproject commit f8213d27fa2aa2a70dca86ae35e3d1e7c5517033
+Subproject commit da7eed00e494aba1da9f51cb92089ca10e2454e7



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/270db6fec0c8e3673ae32b31d1cf3351d1c52494...93402ace20b7fb180f7c4737b896fa833fc93515

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/270db6fec0c8e3673ae32b31d1cf3351d1c52494...93402ace20b7fb180f7c4737b896fa833fc93515
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240116/732affca/attachment-0001.html>


More information about the ghc-commits mailing list