diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2023-01-23 18:57:59 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-26 12:34:56 -0500 |
commit | 1262d3f8c03799a04d3c5fcf33d4d4db715ca9a1 (patch) | |
tree | 1411ac2e00207228602eea194c9f1e3ebcce9a60 /compiler/GHC/CoreToIface.hs | |
parent | 1bd32a355bd5fc484b641270ca7186e01d1b0c06 (diff) | |
download | haskell-1262d3f8c03799a04d3c5fcf33d4d4db715ca9a1.tar.gz |
Store dehydrated data structures in CgModBreaks
This fixes a tricky leak in GHCi where we were retaining old copies of
HscEnvs when reloading. If not all modules were recompiled then these
hydrated fields in break points would retain a reference to the old
HscEnv which could double memory usage.
Fixes #22530
Diffstat (limited to 'compiler/GHC/CoreToIface.hs')
-rw-r--r-- | compiler/GHC/CoreToIface.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs index 98595f0403..bf713aae53 100644 --- a/compiler/GHC/CoreToIface.hs +++ b/compiler/GHC/CoreToIface.hs @@ -43,12 +43,18 @@ module GHC.CoreToIface , toIfaceVar -- * Other stuff , toIfaceLFInfo + -- * CgBreakInfo + , dehydrateCgBreakInfo ) where import GHC.Prelude +import Data.Word + import GHC.StgToCmm.Types +import GHC.ByteCode.Types + import GHC.Core import GHC.Core.TyCon hiding ( pprPromotionQuote ) import GHC.Core.Coercion.Axiom @@ -685,6 +691,16 @@ toIfaceLFInfo nm lfi = case lfi of LFLetNoEscape -> panic "toIfaceLFInfo: LFLetNoEscape" +-- Dehydrating CgBreakInfo + +dehydrateCgBreakInfo :: [TyVar] -> [Maybe (Id, Word16)] -> Type -> CgBreakInfo +dehydrateCgBreakInfo ty_vars idOffSets tick_ty = + CgBreakInfo + { cgb_tyvars = map toIfaceTvBndr ty_vars + , cgb_vars = map (fmap (\(i, offset) -> (toIfaceIdBndr i, offset))) idOffSets + , cgb_resty = toIfaceType tick_ty + } + {- Note [Inlining and hs-boot files] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this example (#10083, #12789): |