Wolfgang Jeltsch pushed to branch wip/jeltsch/smaller-pit at Glasgow Haskell Compiler / GHC

Commits:

23 changed files:

Changes:

  • compiler/GHC/Driver/Downsweep.hs
    ... ... @@ -688,7 +688,8 @@ expandFixedModuleNode key loc = do
    688 688
           -- part of the compiler.
    
    689 689
           lookupIfaceByModuleHsc hsc_env (mnkToModule key) >>= \case
    
    690 690
             Just iface -> return (M.Succeeded iface)
    
    691
    -        Nothing -> readIface (hsc_hooks hsc_env) (hsc_logger hsc_env) (hsc_dflags hsc_env) (hsc_NC hsc_env) (mnkToModule key) (ml_hi_file loc)
    
    691
    +        Nothing    -> fmap shrinkModIface <$>
    
    692
    +                      readIface (hsc_hooks hsc_env) (hsc_logger hsc_env) (hsc_dflags hsc_env) (hsc_NC hsc_env) (mnkToModule key) (ml_hi_file loc)
    
    692 693
         case read_result of
    
    693 694
           M.Succeeded iface -> do
    
    694 695
             -- Computer information about this node
    

  • compiler/GHC/Driver/Env.hs
    ... ... @@ -372,10 +372,10 @@ lookupIfaceByModule
    372 372
             :: HomeUnitGraph
    
    373 373
             -> PackageIfaceTable
    
    374 374
             -> Module
    
    375
    -        -> IO (Maybe ModIface)
    
    375
    +        -> IO (Maybe RetainedModIface)
    
    376 376
     lookupIfaceByModule hug pit mod
    
    377 377
       = HUG.lookupHugByModule mod hug >>= pure . \case
    
    378
    -       Just hm -> Just (hm_iface hm)
    
    378
    +       Just hm -> Just (shrinkModIface (hm_iface hm))
    
    379 379
            Nothing -> lookupModuleEnv pit mod
    
    380 380
        -- If the module does come from the home package, why do we look in the PIT as well?
    
    381 381
        -- (a) In OneShot mode, even home-package modules accumulate in the PIT
    
    ... ... @@ -384,7 +384,7 @@ lookupIfaceByModule hug pit mod
    384 384
        -- We could eliminate (b) if we wanted, by making GHC.Prim belong to a package
    
    385 385
        -- of its own, but it doesn't seem worth the bother.
    
    386 386
     
    
    387
    -lookupIfaceByModuleHsc :: HscEnv -> Module -> IO (Maybe ModIface)
    
    387
    +lookupIfaceByModuleHsc :: HscEnv -> Module -> IO (Maybe RetainedModIface)
    
    388 388
     lookupIfaceByModuleHsc hsc_env mod = do
    
    389 389
       eps <- hscEPS hsc_env
    
    390 390
       lookupIfaceByModule (hsc_HUG hsc_env) (eps_PIT eps) mod
    

  • compiler/GHC/Driver/Main/Interactive.hs
    ... ... @@ -148,7 +148,7 @@ hscIsGHCiMonad :: HscEnv -> String -> IO Name
    148 148
     hscIsGHCiMonad hsc_env name
    
    149 149
       = runHsc hsc_env $ ioMsgMaybe $ hoistTcRnMessage $ isGHCiMonad hsc_env name
    
    150 150
     
    
    151
    -hscGetModuleInterface :: HscEnv -> Module -> IO ModIface
    
    151
    +hscGetModuleInterface :: HscEnv -> Module -> IO RetainedModIface
    
    152 152
     hscGetModuleInterface hsc_env0 mod = runInteractiveHsc hsc_env0 $ do
    
    153 153
       hsc_env <- getHscEnv
    
    154 154
       ioMsgMaybe $ hoistTcRnMessage $ getModuleInterface hsc_env mod
    
    ... ... @@ -270,7 +270,7 @@ hscCheckSafe' m l = do
    270 270
                 _ | isHomeModule home_unit mod      -> True
    
    271 271
                 _ -> isUnitTrusted unit_state (moduleUnit m)
    
    272 272
     
    
    273
    -    lookup' :: Module -> Hsc (Maybe ModIface)
    
    273
    +    lookup' :: Module -> Hsc (Maybe RetainedModIface)
    
    274 274
         lookup' m = do
    
    275 275
             hsc_env <- getHscEnv
    
    276 276
             iface <- liftIO $ lookupIfaceByModuleHsc hsc_env m
    

  • compiler/GHC/Driver/Main/Passes.hs
    ... ... @@ -1335,7 +1335,7 @@ hscCheckSafe' m l = do
    1335 1335
                 _ | isHomeModule home_unit mod      -> True
    
    1336 1336
                 _ -> isUnitTrusted unit_state (moduleUnit m)
    
    1337 1337
     
    
    1338
    -    lookup' :: Module -> Hsc (Maybe ModIface)
    
    1338
    +    lookup' :: Module -> Hsc (Maybe RetainedModIface)
    
    1339 1339
         lookup' m = do
    
    1340 1340
             hsc_env <- getHscEnv
    
    1341 1341
             iface <- liftIO $ lookupIfaceByModuleHsc hsc_env m
    

  • compiler/GHC/Driver/Plugins.hs
    ... ... @@ -224,7 +224,7 @@ data PluginWithArgs = PluginWithArgs
    224 224
     data LoadedPlugin = LoadedPlugin
    
    225 225
       { lpPlugin :: PluginWithArgs
    
    226 226
       -- ^ the actual plugin together with its commandline arguments
    
    227
    -  , lpModule :: ModIface
    
    227
    +  , lpModule :: RetainedModIface
    
    228 228
       -- ^ the module containing the plugin
    
    229 229
       }
    
    230 230
     
    

  • compiler/GHC/Driver/Session/Inspect.hs
    ... ... @@ -87,7 +87,7 @@ data ModuleInfo = ModuleInfo {
    87 87
             minf_type_env  :: TypeEnv,
    
    88 88
             minf_exports   :: [AvailInfo],
    
    89 89
             minf_instances :: [ClsInst],
    
    90
    -        minf_iface     :: Maybe ModIface,
    
    90
    +        minf_iface     :: Maybe RetainedModIface,
    
    91 91
             minf_safe      :: SafeHaskellMode,
    
    92 92
             minf_modBreaks :: Maybe InternalModBreaks
    
    93 93
       }
    
    ... ... @@ -140,7 +140,7 @@ getHomeModuleInfo hsc_env mdl =
    140 140
         Nothing  -> return Nothing
    
    141 141
         Just hmi -> do
    
    142 142
           let details  = hm_details hmi
    
    143
    -          iface    = hm_iface hmi
    
    143
    +          iface    = shrinkModIface (hm_iface hmi)
    
    144 144
           return (Just (ModuleInfo {
    
    145 145
                             minf_type_env  = md_types details,
    
    146 146
                             minf_exports   = md_exports details,
    
    ... ... @@ -187,7 +187,7 @@ modInfoLookupName minf name = withSession $ \hsc_env -> do
    187 187
          Just tyThing -> return (Just tyThing)
    
    188 188
          Nothing      -> liftIO (lookupType hsc_env name)
    
    189 189
     
    
    190
    -modInfoIface :: ModuleInfo -> Maybe ModIface
    
    190
    +modInfoIface :: ModuleInfo -> Maybe RetainedModIface
    
    191 191
     modInfoIface = minf_iface
    
    192 192
     
    
    193 193
     -- | Retrieve module safe haskell mode
    

  • compiler/GHC/HsToCore/Usage.hs
    ... ... @@ -276,7 +276,7 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
    276 276
         --  a) we used something from it; has something in used_names
    
    277 277
         --  b) we imported it, even if we used nothing from it
    
    278 278
         --     (need to recompile if its export list changes: export_fprint)
    
    279
    -    mkUsage :: Module -> ModIface -> Maybe Usage
    
    279
    +    mkUsage :: Module -> RetainedModIface -> Maybe Usage
    
    280 280
         mkUsage mod iface
    
    281 281
           | toUnitId (moduleUnit mod) `Set.notMember` home_unit_ids
    
    282 282
           = Just $ UsagePackageModule{ usg_mod      = mod,
    
    ... ... @@ -302,9 +302,9 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
    302 302
                           usg_entities = Map.toList ent_hashs,
    
    303 303
                           usg_safe     = imp_safe }
    
    304 304
           where
    
    305
    -        finsts_mod = mi_finsts iface
    
    305
    +        finsts_mod = mi_abi_finsts (mi_abi_hashes iface)
    
    306 306
             hash_env   = mi_hash_fn iface
    
    307
    -        mod_hash   = mi_mod_hash iface
    
    307
    +        mod_hash   = mi_abi_mod_hash (mi_abi_hashes iface)
    
    308 308
             imported_exports
    
    309 309
               = if not depend_on_exports
    
    310 310
                 then Nothing
    
    ... ... @@ -312,9 +312,9 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
    312 312
                   Just $
    
    313 313
                     HomeModImport
    
    314 314
                      { hmiu_orphanLikeHash
    
    315
    -                     = mi_orphan_like_hash iface
    
    315
    +                     = mi_abi_orphan_like_hash (mi_abi_hashes iface)
    
    316 316
                      , hmiu_importedAvails
    
    317
    -                     = moduleImportedAvails mod (mi_export_avails_hash iface) imp_decls
    
    317
    +                     = moduleImportedAvails mod (mi_abi_export_avails_hash (mi_abi_hashes iface)) imp_decls
    
    318 318
                      }
    
    319 319
     
    
    320 320
             by_is_safe (ImportedByUser imv) = imv_is_safe imv
    

  • compiler/GHC/Iface/Load.hs
    ... ... @@ -308,7 +308,7 @@ loadKnownKeyOccMaps
    308 308
         known_key_maps :: Module -> IfM lcl KnownKeyNameMaps
    
    309 309
         known_key_maps mod
    
    310 310
           = do { iface <- loadInterfaceWithException doc mod ImportBySystem
    
    311
    -           ; let !abi_hash = mi_mod_hash iface
    
    311
    +           ; let !abi_hash = mi_abi_mod_hash (mi_abi_hashes iface)
    
    312 312
                ; eps <- getEps
    
    313 313
                ; case lookupModuleEnv (eps_known_keys eps) mod of
    
    314 314
                    Just (cached_hash, kk_maps)
    
    ... ... @@ -321,7 +321,7 @@ loadKnownKeyOccMaps
    321 321
                                          (abi_hash, kk_maps) }
    
    322 322
                            ; return kk_maps } }
    
    323 323
     
    
    324
    -    build_maps :: ModIface -> KnownKeyNameMaps
    
    324
    +    build_maps :: RetainedModIface -> KnownKeyNameMaps
    
    325 325
         build_maps iface = (kk_map, occ_map)
    
    326 326
           where
    
    327 327
             kk_map :: UniqFM KnownKey Name
    
    ... ... @@ -628,7 +628,7 @@ loadSrcInterface :: SDoc
    628 628
                      -> ModuleName
    
    629 629
                      -> IsBootInterface     -- {-# SOURCE #-} ?
    
    630 630
                      -> PkgQual             -- "package", if any
    
    631
    -                 -> RnM ModIface
    
    631
    +                 -> RnM RetainedModIface
    
    632 632
     
    
    633 633
     loadSrcInterface doc scope mod want_boot maybe_pkg
    
    634 634
       = do { res <- loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
    
    ... ... @@ -648,7 +648,7 @@ loadSrcInterface_maybe :: SDoc
    648 648
                            -> ModuleName
    
    649 649
                            -> IsBootInterface     -- {-# SOURCE #-} ?
    
    650 650
                            -> PkgQual             -- "package", if any
    
    651
    -                       -> RnM (MaybeErr MissingInterfaceError ModIface)
    
    651
    +                       -> RnM (MaybeErr MissingInterfaceError RetainedModIface)
    
    652 652
     
    
    653 653
     loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
    
    654 654
       -- We must first find which Module this import refers to.  This involves
    
    ... ... @@ -667,7 +667,7 @@ loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
    667 667
     -- rare operation, but in particular it is used to load orphan modules
    
    668 668
     -- in order to pull their instances into the global package table and to
    
    669 669
     -- handle some operations in GHCi).
    
    670
    -loadModuleInterface :: SDoc -> Module -> TcM ModIface
    
    670
    +loadModuleInterface :: SDoc -> Module -> TcM RetainedModIface
    
    671 671
     loadModuleInterface doc mod = initIfaceTcRn (loadSysInterface doc mod)
    
    672 672
     
    
    673 673
     -- | Load interfaces for a collection of modules.
    
    ... ... @@ -681,7 +681,7 @@ loadModuleInterfaces doc mods
    681 681
     -- | Loads the interface for a given Name.
    
    682 682
     -- Should only be called for an imported name;
    
    683 683
     -- otherwise loadSysInterface may not find the interface
    
    684
    -loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
    
    684
    +loadInterfaceForName :: SDoc -> Name -> TcRn RetainedModIface
    
    685 685
     loadInterfaceForName doc name
    
    686 686
       = do { when debugIsOn $  -- Check pre-condition
    
    687 687
              do { this_mod <- getModule
    
    ... ... @@ -690,7 +690,7 @@ loadInterfaceForName doc name
    690 690
             initIfaceTcRn $ loadSysInterface doc (nameModule name) }
    
    691 691
     
    
    692 692
     -- | Loads the interface for a given Module.
    
    693
    -loadInterfaceForModule :: SDoc -> Module -> TcRn ModIface
    
    693
    +loadInterfaceForModule :: SDoc -> Module -> TcRn RetainedModIface
    
    694 694
     loadInterfaceForModule doc m
    
    695 695
       = do
    
    696 696
         -- Should not be called with this module
    
    ... ... @@ -724,23 +724,23 @@ loadWiredInHomeIface name
    724 724
     
    
    725 725
     ------------------
    
    726 726
     -- | Loads a system interface and throws an exception if it fails
    
    727
    -loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
    
    727
    +loadSysInterface :: SDoc -> Module -> IfM lcl RetainedModIface
    
    728 728
     loadSysInterface doc mod_name = loadInterfaceWithException doc mod_name ImportBySystem
    
    729 729
     
    
    730 730
     ------------------
    
    731 731
     -- | Loads a user interface and throws an exception if it fails. The first parameter indicates
    
    732 732
     -- whether we should import the boot variant of the module
    
    733
    -loadUserInterface :: IsBootInterface -> SDoc -> Module -> IfM lcl ModIface
    
    733
    +loadUserInterface :: IsBootInterface -> SDoc -> Module -> IfM lcl RetainedModIface
    
    734 734
     loadUserInterface is_boot doc mod_name
    
    735 735
       = loadInterfaceWithException doc mod_name (ImportByUser is_boot)
    
    736 736
     
    
    737
    -loadPluginInterface :: SDoc -> Module -> IfM lcl ModIface
    
    737
    +loadPluginInterface :: SDoc -> Module -> IfM lcl RetainedModIface
    
    738 738
     loadPluginInterface doc mod_name
    
    739 739
       = loadInterfaceWithException doc mod_name ImportByPlugin
    
    740 740
     
    
    741 741
     ------------------
    
    742 742
     -- | A wrapper for 'loadInterface' that throws an exception if it fails
    
    743
    -loadInterfaceWithException :: SDoc -> Module -> WhereFrom -> IfM lcl ModIface
    
    743
    +loadInterfaceWithException :: SDoc -> Module -> WhereFrom -> IfM lcl RetainedModIface
    
    744 744
     loadInterfaceWithException doc mod_name where_from
    
    745 745
       = do
    
    746 746
         dflags <- getDynFlags
    
    ... ... @@ -749,7 +749,7 @@ loadInterfaceWithException doc mod_name where_from
    749 749
     
    
    750 750
     ------------------
    
    751 751
     loadInterface :: SDoc -> Module -> WhereFrom
    
    752
    -              -> IfM lcl (MaybeErr MissingInterfaceError ModIface)
    
    752
    +              -> IfM lcl (MaybeErr MissingInterfaceError RetainedModIface)
    
    753 753
     
    
    754 754
     -- loadInterface looks in both the HPT and PIT for the required interface
    
    755 755
     -- If not found, it loads it, and puts it in the PIT (always).
    
    ... ... @@ -796,7 +796,7 @@ loadInterface doc_str mod from
    796 796
                                  liftIO $ computeInterface hsc_env doc_str hi_boot_file mod
    
    797 797
             ; case read_result of {
    
    798 798
                 Failed err -> do
    
    799
    -                { let fake_iface = emptyFullModIface mod
    
    799
    +                { let fake_iface = shrinkModIface (emptyFullModIface mod)
    
    800 800
     
    
    801 801
                     ; updateEps_ $ \eps ->
    
    802 802
                             eps { eps_PIT = extendModuleEnv (eps_PIT eps) (mi_module fake_iface) fake_iface }
    
    ... ... @@ -856,16 +856,7 @@ loadInterface doc_str mod from
    856 856
             ; new_eps_complete_matches <- tcIfaceCompleteMatches (mi_complete_matches iface)
    
    857 857
             ; purged_hsc_env <- getTopEnv
    
    858 858
     
    
    859
    -        ; let final_iface = iface
    
    860
    -                               & set_mi_decls     (panic "No mi_decls in PIT")
    
    861
    -                               & set_mi_insts     (panic "No mi_insts in PIT")
    
    862
    -                               & set_mi_defaults  (panic "No mi_defaults in PIT")
    
    863
    -                               & set_mi_fam_insts (panic "No mi_fam_insts in PIT")
    
    864
    -                               & set_mi_rules     (panic "No mi_rules in PIT")
    
    865
    -                               & set_mi_anns      (panic "No mi_anns in PIT")
    
    866
    -                               & set_mi_simplified_core (panic "No mi_simplified_core in PIT")
    
    867
    -
    
    868
    -              bad_boot = mi_boot iface == IsBoot
    
    859
    +        ; let bad_boot = mi_boot iface == IsBoot
    
    869 860
                               && isJust (lookupKnotVars (if_rec_types gbl_env) mod)
    
    870 861
                                 -- Warn against an EPS-updating import
    
    871 862
                                 -- of one's own boot file! (one-shot only)
    
    ... ... @@ -892,7 +883,7 @@ loadInterface doc_str mod from
    892 883
                     then eps { eps_PTE = addDeclsToPTE (eps_PTE eps) new_eps_decls }
    
    893 884
                else
    
    894 885
                     eps {
    
    895
    -                  eps_PIT          = extendModuleEnv (eps_PIT eps) mod final_iface,
    
    886
    +                  eps_PIT          = extendModuleEnv (eps_PIT eps) mod (shrinkModIface iface),
    
    896 887
                       eps_PTE          = addDeclsToPTE   (eps_PTE eps) new_eps_decls,
    
    897 888
                       eps_iface_bytecode = add_bytecode (eps_iface_bytecode eps),
    
    898 889
                       eps_rule_base    = extendRuleBaseList (eps_rule_base eps)
    
    ... ... @@ -921,10 +912,8 @@ loadInterface doc_str mod from
    921 912
                       eps_defaults    =  extendModuleEnv (eps_defaults eps) mod new_eps_defaults
    
    922 913
                                                        }
    
    923 914
     
    
    924
    -        ; -- invoke plugins with *full* interface, not final_iface, to ensure
    
    925
    -          -- that plugins have access to declarations, etc.
    
    926
    -          res <- withPlugins (hsc_plugins hsc_env) (\p -> interfaceLoadAction p) iface
    
    927
    -        ; return (Succeeded res)
    
    915
    +        ; res <- withPlugins (hsc_plugins hsc_env) (\p -> interfaceLoadAction p) iface
    
    916
    +        ; return (Succeeded (shrinkModIface res))
    
    928 917
         }}}}
    
    929 918
     
    
    930 919
     {- Note [Loading your own hi-boot file]
    

  • compiler/GHC/Iface/Load.hs-boot
    ... ... @@ -2,7 +2,7 @@ module GHC.Iface.Load where
    2 2
     
    
    3 3
     import GHC.Unit.Module (Module)
    
    4 4
     import GHC.Tc.Utils.Monad (IfM)
    
    5
    -import GHC.Unit.Module.ModIface (ModIface)
    
    5
    +import GHC.Unit.Module.ModIface (RetainedModIface)
    
    6 6
     import GHC.Utils.Outputable (SDoc)
    
    7 7
     
    
    8
    -loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
    8
    +loadSysInterface :: SDoc -> Module -> IfM lcl RetainedModIface

  • compiler/GHC/Iface/Recomp.hs
    ... ... @@ -707,7 +707,7 @@ checkDependencies hsc_env summary iface
    707 707
             return $ needsRecompileBecause $ ModulePackageChanged new_name
    
    708 708
     
    
    709 709
     
    
    710
    -needInterface :: Module -> (ModIface -> IO RecompileRequired)
    
    710
    +needInterface :: Module -> (RetainedModIface -> IO RecompileRequired)
    
    711 711
                  -> IfG RecompileRequired
    
    712 712
     needInterface mod continue
    
    713 713
       = do
    
    ... ... @@ -727,7 +727,7 @@ needBytecode mod continue
    727 727
             Nothing -> return $ NeedsRecompile MustCompile
    
    728 728
             Just mbc -> liftIO $ continue mbc
    
    729 729
     
    
    730
    -tryGetModIface :: String -> Module -> IfG (Maybe ModIface)
    
    730
    +tryGetModIface :: String -> Module -> IfG (Maybe RetainedModIface)
    
    731 731
     tryGetModIface doc_msg mod
    
    732 732
       = do  -- Load the imported interface if possible
    
    733 733
         logger <- getLogger
    
    ... ... @@ -779,7 +779,7 @@ checkModUsage _ UsagePackageModule{
    779 779
       logger <- getLogger
    
    780 780
       needInterface mod $ \iface -> do
    
    781 781
         let reason = ModuleChanged (moduleName mod)
    
    782
    -    checkModuleFingerprint logger reason old_mod_hash (mi_mod_hash iface)
    
    782
    +    checkModuleFingerprint logger reason old_mod_hash (mi_abi_mod_hash (mi_abi_hashes iface))
    
    783 783
             -- We only track the ABI hash of package modules, rather than
    
    784 784
             -- individual entity usages, so if the ABI hash changes we must
    
    785 785
             -- recompile.  This is safe but may entail more recompilation when
    
    ... ... @@ -789,7 +789,7 @@ checkModUsage _ UsageMergedRequirement{ usg_mod = mod, usg_mod_hash = old_mod_ha
    789 789
       logger <- getLogger
    
    790 790
       needInterface mod $ \iface -> do
    
    791 791
         let reason = ModuleChangedRaw (moduleName mod)
    
    792
    -    checkModuleFingerprint logger reason old_mod_hash (mi_mod_hash iface)
    
    792
    +    checkModuleFingerprint logger reason old_mod_hash (mi_abi_mod_hash (mi_abi_hashes iface))
    
    793 793
     checkModUsage _  UsageHomeModuleBytecode{ usg_mod_name = mod_name
    
    794 794
                                                      , usg_unit_id = uid
    
    795 795
                                                      , usg_bytecode_hash = old_bytecode_hash } = do
    
    ... ... @@ -810,7 +810,7 @@ checkModUsage _ UsageHomeModule{
    810 810
         logger <- getLogger
    
    811 811
         needInterface mod $ \iface -> do
    
    812 812
          let
    
    813
    -         new_mod_hash    = mi_mod_hash iface
    
    813
    +         new_mod_hash    = mi_abi_mod_hash (mi_abi_hashes iface)
    
    814 814
              new_decl_hash   = mi_hash_fn  iface
    
    815 815
              reason = ModuleChanged (moduleName mod)
    
    816 816
     
    
    ... ... @@ -864,7 +864,7 @@ checkModUsage fc UsageDirectory{ usg_dir_path = dir,
    864 864
     -- Does this require recompilation?
    
    865 865
     --
    
    866 866
     -- See Note [When to recompile when export lists change?]
    
    867
    -checkHomeModImport :: Logger -> RecompReason -> Maybe HomeModImport -> ModIface -> IO RecompileRequired
    
    867
    +checkHomeModImport :: Logger -> RecompReason -> Maybe HomeModImport -> RetainedModIface -> IO RecompileRequired
    
    868 868
     checkHomeModImport _ _ Nothing _ = return UpToDate
    
    869 869
     checkHomeModImport logger reason
    
    870 870
       (Just (HomeModImport old_orphan_like_hash old_avails))
    
    ... ... @@ -901,8 +901,8 @@ checkHomeModImport logger reason
    901 901
                           2 (ppr changes)
    
    902 902
                      return $ needsRecompileBecause reason
    
    903 903
       where
    
    904
    -    new_orphan_like_hash = mi_orphan_like_hash iface
    
    905
    -    new_avails_hash      = mi_export_avails_hash iface
    
    904
    +    new_orphan_like_hash = mi_abi_orphan_like_hash (mi_abi_hashes iface)
    
    905
    +    new_avails_hash      = mi_abi_export_avails_hash (mi_abi_hashes iface)
    
    906 906
         new_exports          = mi_exports iface
    
    907 907
     
    
    908 908
     -- | The exported avails of a module have changed. Should this cause recompilation
    
    ... ... @@ -1617,7 +1617,7 @@ getOrphanHashes hsc_env mods = do
    1617 1617
         get_orph_hash mod = do
    
    1618 1618
               iface <- initIfaceLoad hsc_env . withIfaceErr ctx
    
    1619 1619
                                 $ loadInterface (text "getOrphanHashes") mod ImportBySystem
    
    1620
    -          return (mi_orphan_hash iface)
    
    1620
    +          return (mi_abi_orphan_hash (mi_abi_hashes iface))
    
    1621 1621
     
    
    1622 1622
       mapM get_orph_hash mods
    
    1623 1623
     
    

  • compiler/GHC/Rename/Names.hs
    ... ... @@ -517,7 +517,7 @@ renamePkgQual unit_env mn mb_pkg = case mb_pkg of
    517 517
     -- interface, but without 'imp_mods'.
    
    518 518
     calculateAvails :: HomeUnit
    
    519 519
                     -> S.Set UnitId
    
    520
    -                -> ModIface
    
    520
    +                -> RetainedModIface
    
    521 521
                     -> IsSafeImport
    
    522 522
                     -> IsBootInterface
    
    523 523
                     -> ImportedBy
    
    ... ... @@ -525,8 +525,8 @@ calculateAvails :: HomeUnit
    525 525
     calculateAvails home_unit other_home_units iface mod_safe' want_boot imported_by =
    
    526 526
       let imp_mod    = mi_module iface
    
    527 527
           imp_sem_mod= mi_semantic_module iface
    
    528
    -      orph_iface = mi_orphan iface
    
    529
    -      has_finsts = mi_finsts iface
    
    528
    +      orph_iface = mi_abi_orphan (mi_abi_hashes iface)
    
    529
    +      has_finsts = mi_abi_finsts (mi_abi_hashes iface)
    
    530 530
           deps       = mi_deps iface
    
    531 531
           trust      = getSafeMode $ mi_trust iface
    
    532 532
           trust_pkg  = mi_trust_pkg iface
    
    ... ... @@ -1209,7 +1209,7 @@ gresFromAvail hsc_env prov avail =
    1209 1209
     gresFromAvails :: HscEnv -> Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt]
    
    1210 1210
     gresFromAvails hsc_env prov = concatMap (gresFromAvail hsc_env prov)
    
    1211 1211
     
    
    1212
    -importsFromIface :: HscEnv -> ModIface -> ImpDeclSpec -> Maybe NameSet -> GlobalRdrEnv
    
    1212
    +importsFromIface :: HscEnv -> RetainedModIface -> ImpDeclSpec -> Maybe NameSet -> GlobalRdrEnv
    
    1213 1213
     importsFromIface hsc_env iface decl_spec hidden = mkGlobalRdrEnv $ case hidden of
    
    1214 1214
         Nothing -> all_gres
    
    1215 1215
         Just hidden_names -> filter (not . (`elemNameSet` hidden_names) . greName) all_gres
    
    ... ... @@ -1225,7 +1225,7 @@ rnNamespaceSpecifier (DataNamespaceSpecifier x) = DataNamespaceSpecifier x
    1225 1225
     filterImports
    
    1226 1226
         :: HasDebugCallStack
    
    1227 1227
         => HscEnv
    
    1228
    -    -> ModIface
    
    1228
    +    -> RetainedModIface
    
    1229 1229
         -> ImpDeclSpec
    
    1230 1230
              -- ^ Import spec
    
    1231 1231
         -> Maybe (ImportListInterpretation, [LIE GhcPs])
    
    ... ... @@ -2327,7 +2327,7 @@ getMinimalImports ie_decls
    2327 2327
           where
    
    2328 2328
             doc = text "Compute minimal imports for" <+> ppr decl
    
    2329 2329
     
    
    2330
    -    to_ie :: GlobalRdrEnv -> ModIface -> AvailInfo -> RnM [IE GhcRn]
    
    2330
    +    to_ie :: GlobalRdrEnv -> RetainedModIface -> AvailInfo -> RnM [IE GhcRn]
    
    2331 2331
         -- The main trick here is that if we're importing all the constructors
    
    2332 2332
         -- we want to say "T(..)", but if we're importing only a subset we want
    
    2333 2333
         -- to say "T(A,B,C)".  So we have to find out what the module exports.
    
    ... ... @@ -2529,7 +2529,7 @@ DRFPatSynExport for a test of this.
    2529 2529
     -}
    
    2530 2530
     
    
    2531 2531
     badImportItemErr
    
    2532
    -  :: ModIface -> ImpDeclSpec -> IE GhcPs
    
    2532
    +  :: RetainedModIface -> ImpDeclSpec -> IE GhcPs
    
    2533 2533
       -> IsSubordinateError
    
    2534 2534
       -> [AvailInfo]
    
    2535 2535
       -> TcRn (NonEmpty ImportLookupReason)
    

  • compiler/GHC/Rename/Utils.hs
    ... ... @@ -534,7 +534,7 @@ warnIfDeclDeprecated gre@(GRE { gre_imp = iss })
    534 534
         definedMod = moduleName $ assertPpr (isExternalName name) (ppr name) (nameModule name)
    
    535 535
         doc = text "The name" <+> quotes (ppr occ) <+> text "is mentioned explicitly"
    
    536 536
     
    
    537
    -lookupImpDeclDeprec :: ModIface -> GlobalRdrElt -> Maybe (WarningTxt GhcRn)
    
    537
    +lookupImpDeclDeprec :: RetainedModIface -> GlobalRdrElt -> Maybe (WarningTxt GhcRn)
    
    538 538
     lookupImpDeclDeprec iface gre
    
    539 539
       -- Bleat if the thing, or its parent, is warn'd
    
    540 540
       = mi_decl_warn_fn iface (greOccName gre) `mplus`
    

  • compiler/GHC/Runtime/Loader.hs
    ... ... @@ -190,7 +190,7 @@ checkExternalInterpreter hsc_env = case interpInstance <$> hsc_interp hsc_env of
    190 190
         -> throwIO (InstallationError "Plugins require -fno-external-interpreter")
    
    191 191
       _ -> pure ()
    
    192 192
     
    
    193
    -loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, ModIface, [LinkableUsage], PkgsLoaded)
    
    193
    +loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, RetainedModIface, [LinkableUsage], PkgsLoaded)
    
    194 194
     loadPlugin' occ_name plugin_name hsc_env mod_name
    
    195 195
       = do { let plugin_rdr_name = mkRdrQual mod_name occ_name
    
    196 196
                  dflags = hsc_dflags hsc_env
    
    ... ... @@ -341,7 +341,7 @@ lessUnsafeCoerce logger context what = do
    341 341
     -- Need the module as well to record information in the interface file
    
    342 342
     lookupRdrNameInModuleForPlugins :: HasDebugCallStack
    
    343 343
                                     => HscEnv -> ModuleName -> RdrName
    
    344
    -                                -> IO (Maybe (Name, ModIface))
    
    344
    +                                -> IO (Maybe (Name, RetainedModIface))
    
    345 345
     lookupRdrNameInModuleForPlugins hsc_env mod_name rdr_name = do
    
    346 346
         let dflags     = hsc_dflags hsc_env
    
    347 347
         -- First find the unit the module resides in by searching exposed units and home modules
    

  • compiler/GHC/Tc/Errors/Ppr.hs
    ... ... @@ -6386,7 +6386,7 @@ pprImportLookup :: ImportLookupReason -> SDoc
    6386 6386
     pprImportLookup = \case
    
    6387 6387
       ImportLookupBad k iface decl_spec ie _exts ->
    
    6388 6388
         let
    
    6389
    -      pprImpDeclSpec :: ModIface -> ImpDeclSpec -> SDoc
    
    6389
    +      pprImpDeclSpec :: RetainedModIface -> ImpDeclSpec -> SDoc
    
    6390 6390
           pprImpDeclSpec iface decl_spec =
    
    6391 6391
             quotes (ppr (moduleName $ is_mod decl_spec)) <+> case mi_boot iface of
    
    6392 6392
                 IsBoot  -> text "(hi-boot interface)"
    

  • compiler/GHC/Tc/Errors/Types.hs
    ... ... @@ -215,7 +215,7 @@ import GHC.Types.DefaultEnv (ClassDefaults)
    215 215
     
    
    216 216
     import GHC.Unit.Types (Module)
    
    217 217
     import GHC.Unit.State (UnitState)
    
    218
    -import GHC.Unit.Module.ModIface (ModIface)
    
    218
    +import GHC.Unit.Module.ModIface (RetainedModIface)
    
    219 219
     
    
    220 220
     import GHC.Utils.Outputable
    
    221 221
     
    
    ... ... @@ -6635,7 +6635,7 @@ data ImportLookupReason where
    6635 6635
           T9006, T11071, T9905fail2, T5385, T10668
    
    6636 6636
       -}
    
    6637 6637
       ImportLookupBad :: BadImportKind
    
    6638
    -                  -> ModIface
    
    6638
    +                  -> RetainedModIface
    
    6639 6639
                       -> ImpDeclSpec
    
    6640 6640
                       -> IE GhcPs
    
    6641 6641
                       -> ImportLookupExtensions
    

  • compiler/GHC/Tc/Gen/Splice.hs
    ... ... @@ -1693,7 +1693,7 @@ lookupArgDoc i nm = do
    1693 1693
             _ -> pure Nothing
    
    1694 1694
     
    
    1695 1695
     -- | Returns the module a Name belongs to, if it is isn't local.
    
    1696
    -getExternalModIface :: Name -> TcM (Maybe ModIface)
    
    1696
    +getExternalModIface :: Name -> TcM (Maybe RetainedModIface)
    
    1697 1697
     getExternalModIface nm = do
    
    1698 1698
       isLocal <- nameIsLocalOrFrom <$> getModule <*> pure nm
    
    1699 1699
       if isLocal
    

  • compiler/GHC/Tc/Instance/Family.hs
    ... ... @@ -308,7 +308,7 @@ checkFamInstConsistency directlyImpMods
    308 308
                      ifc <- modIface mod
    
    309 309
                      deps <- dep_finsts . mi_deps <$> modIface mod
    
    310 310
                      pure $
    
    311
    -                   if mi_finsts ifc
    
    311
    +                   if mi_abi_finsts (mi_abi_hashes ifc)
    
    312 312
                           then mod:deps
    
    313 313
                           else deps
    
    314 314
     
    

  • compiler/GHC/Tc/Module.hs
    ... ... @@ -2964,7 +2964,7 @@ externaliseAndTidyId this_mod id
    2964 2964
     -- a package module with an interface on disk.  If neither of these is
    
    2965 2965
     -- true, then the result will be an error indicating the interface
    
    2966 2966
     -- could not be found.
    
    2967
    -getModuleInterface :: HscEnv -> Module -> IO (Messages TcRnMessage, Maybe ModIface)
    
    2967
    +getModuleInterface :: HscEnv -> Module -> IO (Messages TcRnMessage, Maybe RetainedModIface)
    
    2968 2968
     getModuleInterface hsc_env mod
    
    2969 2969
       = runTcInteractive NoTcMPlugins hsc_env $
    
    2970 2970
         loadModuleInterface (text "getModuleInterface") mod
    

  • compiler/GHC/Unit/External.hs
    ... ... @@ -49,7 +49,7 @@ type PackageAnnEnv = AnnEnv
    49 49
     type PackageCompleteMatches  = CompleteMatches
    
    50 50
     
    
    51 51
     -- | Helps us find information about modules in the imported packages
    
    52
    -type PackageIfaceTable = ModuleEnv ModIface
    
    52
    +type PackageIfaceTable = ModuleEnv RetainedModIface
    
    53 53
             -- Domain = modules in the imported packages
    
    54 54
     
    
    55 55
     -- | Constructs an empty PackageIfaceTable
    

  • compiler/GHC/Unit/Module/ModIface.hs
    ... ... @@ -2,6 +2,7 @@
    2 2
     {-# LANGUAGE UndecidableInstances #-}
    
    3 3
     {-# LANGUAGE PatternSynonyms #-}
    
    4 4
     {-# LANGUAGE DeriveAnyClass #-}
    
    5
    +{-# LANGUAGE RecordWildCards #-}
    
    5 6
     
    
    6 7
     module GHC.Unit.Module.ModIface
    
    7 8
        ( ModIface
    
    ... ... @@ -68,6 +69,7 @@ module GHC.Unit.Module.ModIface
    68 69
        , set_mi_fix_fn
    
    69 70
        , set_mi_hash_fn
    
    70 71
        , completePartialModIface
    
    72
    +   , shrinkModIface
    
    71 73
        , IfaceBinHandle(..)
    
    72 74
        , PartialModIface
    
    73 75
        , RetainedModIface
    
    ... ... @@ -82,8 +84,6 @@ module GHC.Unit.Module.ModIface
    82 84
        , IfaceAnnotationsData
    
    83 85
        , IfaceDeclsData
    
    84 86
        , IfaceDefaultsData
    
    85
    -   , IfaceClsInstsData
    
    86
    -   , IfaceFamInstsData
    
    87 87
        , IfaceRulesData
    
    88 88
        , IfaceCompleteMatchesData
    
    89 89
        , IfaceAbiHashesData
    
    ... ... @@ -268,23 +268,13 @@ type family IfaceAnnotationsData (phase :: ModIfacePhase) where
    268 268
     type family IfaceDeclsData (phase :: ModIfacePhase) where
    
    269 269
       IfaceDeclsData 'ModIfaceCore     = [IfaceDecl]
    
    270 270
       IfaceDeclsData 'ModIfaceFinal    = [(Fingerprint, IfaceDecl)]
    
    271
    -  IfaceDeclsData 'ModIfaceRetained = ()
    
    271
    +  IfaceDeclsData 'ModIfaceRetained = [IfaceDecl]
    
    272 272
     
    
    273 273
     type family IfaceDefaultsData (phase :: ModIfacePhase) where
    
    274 274
       IfaceDefaultsData 'ModIfaceCore     = [IfaceDefault]
    
    275 275
       IfaceDefaultsData 'ModIfaceFinal    = [IfaceDefault]
    
    276 276
       IfaceDefaultsData 'ModIfaceRetained = ()
    
    277 277
     
    
    278
    -type family IfaceClsInstsData (phase :: ModIfacePhase) where
    
    279
    -  IfaceClsInstsData 'ModIfaceCore     = [IfaceClsInst]
    
    280
    -  IfaceClsInstsData 'ModIfaceFinal    = [IfaceClsInst]
    
    281
    -  IfaceClsInstsData 'ModIfaceRetained = ()
    
    282
    -
    
    283
    -type family IfaceFamInstsData (phase :: ModIfacePhase) where
    
    284
    -  IfaceFamInstsData 'ModIfaceCore     = [IfaceFamInst]
    
    285
    -  IfaceFamInstsData 'ModIfaceFinal    = [IfaceFamInst]
    
    286
    -  IfaceFamInstsData 'ModIfaceRetained = ()
    
    287
    -
    
    288 278
     type family IfaceRulesData (phase :: ModIfacePhase) where
    
    289 279
       IfaceRulesData 'ModIfaceCore     = [IfaceRule]
    
    290 280
       IfaceRulesData 'ModIfaceFinal    = [IfaceRule]
    
    ... ... @@ -413,9 +403,9 @@ data IfacePublic_ phase = IfacePublic {
    413 403
     
    
    414 404
     
    
    415 405
                     -- Instance declarations and rules
    
    416
    -        mi_insts_       :: IfaceClsInstsData phase, -- ^ Sorted class instance
    
    417
    -        mi_fam_insts_   :: IfaceFamInstsData phase, -- ^ Sorted family instances
    
    418
    -        mi_rules_       :: IfaceRulesData phase,    -- ^ Sorted rules
    
    406
    +        mi_insts_       :: [IfaceClsInst],       -- ^ Sorted class instance
    
    407
    +        mi_fam_insts_   :: [IfaceFamInst],       -- ^ Sorted family instances
    
    408
    +        mi_rules_       :: IfaceRulesData phase, -- ^ Sorted rules
    
    419 409
     
    
    420 410
     
    
    421 411
             mi_trust_     :: IfaceTrustInfo,
    
    ... ... @@ -608,7 +598,7 @@ mi_orphan_hash iface = mi_abi_orphan_hash (mi_abi_hashes iface)
    608 598
     
    
    609 599
     -- | Old-style accessor for whether or not the ModIface came from an hs-boot
    
    610 600
     -- file.
    
    611
    -mi_boot :: ModIface -> IsBootInterface
    
    601
    +mi_boot :: ModIface_ phase -> IsBootInterface
    
    612 602
     mi_boot iface = if mi_hsc_src iface == HsBootFile
    
    613 603
         then IsBoot
    
    614 604
         else NotBoot
    
    ... ... @@ -618,7 +608,7 @@ mi_mnwib iface = GWIB (moduleName $ mi_module iface) (mi_boot iface)
    618 608
     
    
    619 609
     -- | Lookups up a (possibly cached) fixity from a 'ModIface'. If one cannot be
    
    620 610
     -- found, 'defaultFixity' is returned instead.
    
    621
    -mi_fix :: ModIface -> OccName -> Fixity
    
    611
    +mi_fix :: ModIface_ phase -> OccName -> Fixity
    
    622 612
     mi_fix iface name = mi_fix_fn iface name `orElse` defaultFixity
    
    623 613
     
    
    624 614
     -- | The semantic module for this interface; e.g., if it's a interface
    
    ... ... @@ -634,7 +624,7 @@ mi_semantic_module iface = mi_mod_info_semantic_module (mi_mod_info iface)
    634 624
     
    
    635 625
     -- | The "precise" free holes, e.g., the signatures that this
    
    636 626
     -- 'ModIface' depends on.
    
    637
    -mi_free_holes :: ModIface -> UniqDSet ModuleName
    
    627
    +mi_free_holes :: ModIface_ phase -> UniqDSet ModuleName
    
    638 628
     mi_free_holes iface =
    
    639 629
       case getModuleInstantiation (mi_module iface) of
    
    640 630
         (_, Just indef)
    
    ... ... @@ -851,8 +841,8 @@ emptyIfaceModInfo mod = IfaceModInfo
    851 841
     emptyPublicModIface :: IfaceAnnotationsData phase
    
    852 842
                         -> IfaceDeclsData phase
    
    853 843
                         -> IfaceDefaultsData phase
    
    854
    -                    -> IfaceClsInstsData phase
    
    855
    -                    -> IfaceFamInstsData phase
    
    844
    +                    -> [IfaceClsInst]
    
    845
    +                    -> [IfaceFamInst]
    
    856 846
                         -> IfaceRulesData phase
    
    857 847
                         -> IfaceCompleteMatchesData phase
    
    858 848
                         -> IfaceAbiHashesData phase
    
    ... ... @@ -930,8 +920,6 @@ instance ( NFData (IfaceSelfRecompData phase)
    930 920
              , NFData (IfaceAnnotationsData phase)
    
    931 921
              , NFData (IfaceDeclsData phase)
    
    932 922
              , NFData (IfaceDefaultsData phase)
    
    933
    -         , NFData (IfaceClsInstsData phase)
    
    934
    -         , NFData (IfaceFamInstsData phase)
    
    935 923
              , NFData (IfaceRulesData phase)
    
    936 924
              , NFData (IfaceCompleteMatchesData phase)
    
    937 925
              , NFData (IfaceAbiHashesData phase)
    
    ... ... @@ -970,8 +958,6 @@ instance NFData IfaceAbiHashes where
    970 958
     instance ( NFData (IfaceAnnotationsData phase)
    
    971 959
              , NFData (IfaceDeclsData phase)
    
    972 960
              , NFData (IfaceDefaultsData phase)
    
    973
    -         , NFData (IfaceClsInstsData phase)
    
    974
    -         , NFData (IfaceFamInstsData phase)
    
    975 961
              , NFData (IfaceRulesData phase)
    
    976 962
              , NFData (IfaceCompleteMatchesData phase)
    
    977 963
              , NFData (IfaceAbiHashesData phase)
    
    ... ... @@ -1051,7 +1037,6 @@ completePartialModIface partial iface_hash decls extra_decls final_exts cache =
    1051 1037
       , mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
    
    1052 1038
       , mi_iface_hash_ = iface_hash
    
    1053 1039
       }
    
    1054
    -  where
    
    1055 1040
     
    
    1056 1041
     -- | Given a 'PartialIfacePublic', turn it into an 'IfacePublic' by completing
    
    1057 1042
     -- missing fields.
    
    ... ... @@ -1066,6 +1051,30 @@ completePublicModIface decls abi_hashes cache partial = partial
    1066 1051
       , mi_caches_ = cache
    
    1067 1052
       }
    
    1068 1053
     
    
    1054
    +shrinkModIface :: ModIface -> RetainedModIface
    
    1055
    +shrinkModIface PrivateModIface {..}
    
    1056
    +  = PrivateModIface
    
    1057
    +    {
    
    1058
    +      mi_hi_bytes_        = RetainedIfaceBinHandle,
    
    1059
    +      mi_public_          = shrinkIfacePublic mi_public_,
    
    1060
    +      mi_self_recomp_     = (),
    
    1061
    +      mi_simplified_core_ = (),
    
    1062
    +      mi_ext_fields_      = (),
    
    1063
    +      ..
    
    1064
    +    }
    
    1065
    +
    
    1066
    +shrinkIfacePublic :: IfacePublic -> RetainedIfacePublic
    
    1067
    +shrinkIfacePublic IfacePublic {..}
    
    1068
    +  = IfacePublic
    
    1069
    +    {
    
    1070
    +      mi_anns_             = (),
    
    1071
    +      mi_decls_            = map snd mi_decls_,
    
    1072
    +      mi_defaults_         = (),
    
    1073
    +      mi_rules_            = (),
    
    1074
    +      mi_complete_matches_ = (),
    
    1075
    +      ..
    
    1076
    +    }
    
    1077
    +
    
    1069 1078
     set_mi_mod_info :: IfaceModInfo -> ModIface_ phase -> ModIface_ phase
    
    1070 1079
     set_mi_mod_info val iface = clear_mi_hi_bytes $ iface { mi_mod_info_ = val }
    
    1071 1080
     
    
    ... ... @@ -1107,10 +1116,10 @@ set_mi_warns val = set_mi_public (\iface -> iface { mi_warns_ = val })
    1107 1116
     set_mi_anns :: IfaceAnnotationsData phase -> ModIface_ phase -> ModIface_ phase
    
    1108 1117
     set_mi_anns val = set_mi_public (\iface -> iface { mi_anns_ = val })
    
    1109 1118
     
    
    1110
    -set_mi_insts :: IfaceClsInstsData phase -> ModIface_ phase -> ModIface_ phase
    
    1119
    +set_mi_insts :: [IfaceClsInst] -> ModIface_ phase -> ModIface_ phase
    
    1111 1120
     set_mi_insts val = set_mi_public (\iface -> iface { mi_insts_ = val })
    
    1112 1121
     
    
    1113
    -set_mi_fam_insts :: IfaceFamInstsData phase -> ModIface_ phase -> ModIface_ phase
    
    1122
    +set_mi_fam_insts :: [IfaceFamInst] -> ModIface_ phase -> ModIface_ phase
    
    1114 1123
     set_mi_fam_insts val = set_mi_public (\iface -> iface { mi_fam_insts_ = val })
    
    1115 1124
     
    
    1116 1125
     set_mi_rules :: IfaceRulesData phase -> ModIface_ phase -> ModIface_ phase
    
    ... ... @@ -1282,8 +1291,8 @@ pattern ModIface ::
    1282 1291
       -> IfaceSimplifiedCoreData phase
    
    1283 1292
       -> IfaceDefaultsData phase
    
    1284 1293
       -> IfaceTopEnv
    
    1285
    -  -> IfaceClsInstsData phase
    
    1286
    -  -> IfaceFamInstsData phase
    
    1294
    +  -> [IfaceClsInst]
    
    1295
    +  -> [IfaceFamInst]
    
    1287 1296
       -> IfaceRulesData phase
    
    1288 1297
       -> IfaceTrustInfo
    
    1289 1298
       -> Bool
    

  • ghc/Main.hs
    ... ... @@ -515,7 +515,7 @@ abiHash strs = do
    515 515
       put_ bh hiVersion
    
    516 516
         -- package hashes change when the compiler version changes (for now)
    
    517 517
         -- see #5328
    
    518
    -  mapM_ (put_ bh . mi_mod_hash) ifaces
    
    518
    +  mapM_ (put_ bh . mi_abi_mod_hash . mi_abi_hashes) ifaces
    
    519 519
       f <- fingerprintBinMem bh
    
    520 520
     
    
    521 521
       putStrLn (showPpr dflags f)
    

  • utils/haddock/haddock-api/src/Haddock/Interface.hs
    ... ... @@ -74,7 +74,7 @@ import GHC.Unit.Home.ModInfo
    74 74
     import GHC.Unit.Home.PackageTable
    
    75 75
     import GHC.Unit.Module.Graph (ModuleGraphNode (..), ModuleNodeInfo(..))
    
    76 76
     import GHC.Unit.Module.ModDetails
    
    77
    -import GHC.Unit.Module.ModIface (mi_semantic_module, mi_boot)
    
    77
    +import GHC.Unit.Module.ModIface (RetainedModIface, shrinkModIface, mi_semantic_module, mi_boot)
    
    78 78
     import GHC.Unit.Module.ModSummary (isBootSummary)
    
    79 79
     import GHC.Utils.Outputable (Outputable, (<+>), pprModuleName, text)
    
    80 80
     import GHC.Utils.Error (withTiming)
    
    ... ... @@ -254,7 +254,7 @@ dropErr :: MaybeErr e a -> Maybe a
    254 254
     dropErr (Succeeded a) = Just a
    
    255 255
     dropErr (Failed _) = Nothing
    
    256 256
     
    
    257
    -loadHiFile :: HscEnv -> Outputable.SDoc -> Module -> IO (ModIface, ([ClsInst], [FamInst]))
    
    257
    +loadHiFile :: HscEnv -> Outputable.SDoc -> Module -> IO (RetainedModIface, ([ClsInst], [FamInst]))
    
    258 258
     loadHiFile hsc_env doc theModule = initIfaceLoad hsc_env $ do
    
    259 259
     
    
    260 260
       mod_iface <- loadSysInterface doc theModule
    
    ... ... @@ -288,7 +288,7 @@ processModule verbosity modSummary flags ifaceMap instIfaceMap warningMap = do
    288 288
           let cls_insts = instEnvElts . md_insts $ hm_details hmi
    
    289 289
               fam_insts = md_fam_insts $ hm_details hmi
    
    290 290
     
    
    291
    -      pure (hm_iface hmi, (cls_insts, fam_insts))
    
    291
    +      pure (shrinkModIface (hm_iface hmi), (cls_insts, fam_insts))
    
    292 292
     
    
    293 293
       !interface <- do
    
    294 294
         logger <- getLogger
    

  • utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
    ... ... @@ -81,7 +81,7 @@ createInterface1
    81 81
       => [Flag]
    
    82 82
       -> UnitState
    
    83 83
       -> ModSummary
    
    84
    -  -> ModIface
    
    84
    +  -> RetainedModIface
    
    85 85
       -> IfaceMap
    
    86 86
       -> InstIfaceMap
    
    87 87
       -> ([ClsInst], [FamInst])
    
    ... ... @@ -105,7 +105,7 @@ createInterface1'
    105 105
       -> UnitState
    
    106 106
       -> DynFlags
    
    107 107
       -> FilePath
    
    108
    -  -> ModIface
    
    108
    +  -> RetainedModIface
    
    109 109
       -> IfaceMap
    
    110 110
       -> InstIfaceMap
    
    111 111
       -> ([ClsInst], [FamInst])
    
    ... ... @@ -150,7 +150,7 @@ createInterface1' flags unit_state dflags hie_file mod_iface ifaces inst_ifaces
    150 150
         def_meths_env = mkOccEnv def_meths
    
    151 151
         def_meths =
    
    152 152
           [ (nameOccName nm, nm)
    
    153
    -      | (_, IfaceId{ifName = nm}) <- mi_decls mod_iface
    
    153
    +      | IfaceId{ifName = nm} <- mi_decls mod_iface
    
    154 154
           , let occ = nameOccName nm
    
    155 155
           , isDefaultMethodOcc occ
    
    156 156
           ]