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

Commits:

22 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,19 +69,31 @@ 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
    
    75
    +   , RetainedModIface
    
    73 76
        , IfaceAbiHashes (..)
    
    74 77
        , IfaceSelfRecomp (..)
    
    75 78
        , IfaceCache (..)
    
    76 79
        , IfaceSimplifiedCore (..)
    
    77 80
        , withSelfRecomp
    
    78
    -   , IfaceDeclExts
    
    79
    -   , IfaceAbiHashesExts
    
    81
    +   , IfaceSelfRecompData
    
    82
    +   , IfaceSimplifiedCoreData
    
    83
    +   , ExtensibleFieldsData
    
    84
    +   , IfaceAnnotationsData
    
    85
    +   , IfaceDeclsData
    
    86
    +   , IfaceDefaultsData
    
    87
    +   , IfaceClsInstsData
    
    88
    +   , IfaceFamInstsData
    
    89
    +   , IfaceRulesData
    
    90
    +   , IfaceCompleteMatchesData
    
    91
    +   , IfaceAbiHashesData
    
    80 92
        , IfaceExport
    
    81 93
        , IfacePublic_(..)
    
    82 94
        , IfacePublic
    
    83 95
        , PartialIfacePublic
    
    96
    +   , RetainedIfacePublic
    
    84 97
        , IfaceModInfo(..)
    
    85 98
        , WhetherHasOrphans
    
    86 99
        , WhetherHasFamInst
    
    ... ... @@ -167,9 +180,11 @@ We can build a full interface file two ways:
    167 180
     
    
    168 181
     type PartialModIface = ModIface_ 'ModIfaceCore
    
    169 182
     type ModIface = ModIface_ 'ModIfaceFinal
    
    183
    +type RetainedModIface = ModIface_ 'ModIfaceRetained
    
    170 184
     
    
    171 185
     type PartialIfacePublic = IfacePublic_ 'ModIfaceCore
    
    172 186
     type IfacePublic = IfacePublic_ 'ModIfaceFinal
    
    187
    +type RetainedIfacePublic = IfacePublic_ 'ModIfaceRetained
    
    173 188
     
    
    174 189
     -- | Extends a PartialModIface with hashes of the ABI.
    
    175 190
     --
    
    ... ... @@ -212,19 +227,11 @@ data IfaceCache = IfaceCache
    212 227
     
    
    213 228
     data ModIfacePhase
    
    214 229
       = ModIfaceCore
    
    215
    -  -- ^ Partial interface built based on output of core pipeline.
    
    230
    +    -- ^ Partial interface built from the output of the core pipeline
    
    216 231
       | ModIfaceFinal
    
    217
    -
    
    218
    --- | Selects a IfaceDecl representation.
    
    219
    --- For fully instantiated interfaces we also maintain
    
    220
    --- a fingerprint, which is used for recompilation checks.
    
    221
    -type family IfaceDeclExts (phase :: ModIfacePhase) = decl | decl -> phase where
    
    222
    -  IfaceDeclExts 'ModIfaceCore = IfaceDecl
    
    223
    -  IfaceDeclExts 'ModIfaceFinal = (Fingerprint, IfaceDecl)
    
    224
    -
    
    225
    -type family IfaceAbiHashesExts (phase :: ModIfacePhase) = bk | bk -> phase where
    
    226
    -  IfaceAbiHashesExts 'ModIfaceCore = ()
    
    227
    -  IfaceAbiHashesExts 'ModIfaceFinal = IfaceAbiHashes
    
    232
    +    -- ^ Complete interface
    
    233
    +  | ModIfaceRetained
    
    234
    +    -- ^ Interface shrunk to the parts that may be retained
    
    228 235
     
    
    229 236
     -- | In-memory byte array representation of a 'ModIface'.
    
    230 237
     --
    
    ... ... @@ -237,9 +244,66 @@ data IfaceBinHandle (phase :: ModIfacePhase) where
    237 244
       -- See Note [Private fields in ModIface] for when this fields needs to be cleared
    
    238 245
       -- (e.g., set to 'Nothing').
    
    239 246
       FullIfaceBinHandle :: !(Strict.Maybe FullBinData) -> IfaceBinHandle 'ModIfaceFinal
    
    240
    -
    
    241
    -
    
    242
    -withSelfRecomp :: ModIface_ phase -> r -> (IfaceSelfRecomp -> r) -> r
    
    247
    +  RetainedIfaceBinHandle :: IfaceBinHandle 'ModIfaceRetained
    
    248
    +
    
    249
    +type family IfaceSelfRecompData (phase :: ModIfacePhase) where
    
    250
    +  IfaceSelfRecompData 'ModIfaceCore     = Maybe IfaceSelfRecomp
    
    251
    +  IfaceSelfRecompData 'ModIfaceFinal    = Maybe IfaceSelfRecomp
    
    252
    +  IfaceSelfRecompData 'ModIfaceRetained = ()
    
    253
    +
    
    254
    +type family IfaceSimplifiedCoreData (phase :: ModIfacePhase) where
    
    255
    +  IfaceSimplifiedCoreData 'ModIfaceCore     = Maybe IfaceSimplifiedCore
    
    256
    +  IfaceSimplifiedCoreData 'ModIfaceFinal    = Maybe IfaceSimplifiedCore
    
    257
    +  IfaceSimplifiedCoreData 'ModIfaceRetained = ()
    
    258
    +
    
    259
    +type family ExtensibleFieldsData (phase :: ModIfacePhase) where
    
    260
    +  ExtensibleFieldsData 'ModIfaceCore     = ExtensibleFields
    
    261
    +  ExtensibleFieldsData 'ModIfaceFinal    = ExtensibleFields
    
    262
    +  ExtensibleFieldsData 'ModIfaceRetained = ()
    
    263
    +
    
    264
    +type family IfaceAnnotationsData (phase :: ModIfacePhase) where
    
    265
    +  IfaceAnnotationsData 'ModIfaceCore     = [IfaceAnnotation]
    
    266
    +  IfaceAnnotationsData 'ModIfaceFinal    = [IfaceAnnotation]
    
    267
    +  IfaceAnnotationsData 'ModIfaceRetained = ()
    
    268
    +
    
    269
    +-- | The fingerprint in the 'ModIfaceFinal' case is used for recompilation
    
    270
    +--   checks.
    
    271
    +type family IfaceDeclsData (phase :: ModIfacePhase) where
    
    272
    +  IfaceDeclsData 'ModIfaceCore     = [IfaceDecl]
    
    273
    +  IfaceDeclsData 'ModIfaceFinal    = [(Fingerprint, IfaceDecl)]
    
    274
    +  IfaceDeclsData 'ModIfaceRetained = ()
    
    275
    +
    
    276
    +type family IfaceDefaultsData (phase :: ModIfacePhase) where
    
    277
    +  IfaceDefaultsData 'ModIfaceCore     = [IfaceDefault]
    
    278
    +  IfaceDefaultsData 'ModIfaceFinal    = [IfaceDefault]
    
    279
    +  IfaceDefaultsData 'ModIfaceRetained = ()
    
    280
    +
    
    281
    +type family IfaceClsInstsData (phase :: ModIfacePhase) where
    
    282
    +  IfaceClsInstsData 'ModIfaceCore     = [IfaceClsInst]
    
    283
    +  IfaceClsInstsData 'ModIfaceFinal    = [IfaceClsInst]
    
    284
    +  IfaceClsInstsData 'ModIfaceRetained = ()
    
    285
    +
    
    286
    +type family IfaceFamInstsData (phase :: ModIfacePhase) where
    
    287
    +  IfaceFamInstsData 'ModIfaceCore     = [IfaceFamInst]
    
    288
    +  IfaceFamInstsData 'ModIfaceFinal    = [IfaceFamInst]
    
    289
    +  IfaceFamInstsData 'ModIfaceRetained = ()
    
    290
    +
    
    291
    +type family IfaceRulesData (phase :: ModIfacePhase) where
    
    292
    +  IfaceRulesData 'ModIfaceCore     = [IfaceRule]
    
    293
    +  IfaceRulesData 'ModIfaceFinal    = [IfaceRule]
    
    294
    +  IfaceRulesData 'ModIfaceRetained = ()
    
    295
    +
    
    296
    +type family IfaceCompleteMatchesData (phase :: ModIfacePhase) where
    
    297
    +  IfaceCompleteMatchesData 'ModIfaceCore     = [IfaceCompleteMatch]
    
    298
    +  IfaceCompleteMatchesData 'ModIfaceFinal    = [IfaceCompleteMatch]
    
    299
    +  IfaceCompleteMatchesData 'ModIfaceRetained = ()
    
    300
    +
    
    301
    +type family IfaceAbiHashesData (phase :: ModIfacePhase) where
    
    302
    +  IfaceAbiHashesData 'ModIfaceCore     = ()
    
    303
    +  IfaceAbiHashesData 'ModIfaceFinal    = IfaceAbiHashes
    
    304
    +  IfaceAbiHashesData 'ModIfaceRetained = IfaceAbiHashes
    
    305
    +
    
    306
    +withSelfRecomp :: ModIface -> r -> (IfaceSelfRecomp -> r) -> r
    
    243 307
     withSelfRecomp iface nk jk =
    
    244 308
       case mi_self_recomp_info iface of
    
    245 309
         Nothing -> nk
    
    ... ... @@ -279,11 +343,11 @@ data ModIface_ (phase :: ModIfacePhase)
    279 343
                     -- importing this module. The main, original part of an interface.
    
    280 344
     
    
    281 345
     
    
    282
    -        mi_self_recomp_ :: Maybe IfaceSelfRecomp,
    
    346
    +        mi_self_recomp_ :: IfaceSelfRecompData phase,
    
    283 347
                     -- ^ Information needed for checking self-recompilation.
    
    284 348
                     -- See Note [Self recompilation information in interface files]
    
    285 349
     
    
    286
    -        mi_simplified_core_ :: Maybe IfaceSimplifiedCore,
    
    350
    +        mi_simplified_core_ :: IfaceSimplifiedCoreData phase,
    
    287 351
                     -- ^ The part of the interface written when `-fwrite-if-simplified-core` is enabled.
    
    288 352
                     -- These parts are used to restart bytecode generation.
    
    289 353
     
    
    ... ... @@ -301,7 +365,7 @@ data ModIface_ (phase :: ModIfacePhase)
    301 365
                     -- defined by the user).  Used for GHCi and for inspecting
    
    302 366
                     -- the contents of modules via the GHC API only.
    
    303 367
     
    
    304
    -        mi_ext_fields_ :: ExtensibleFields
    
    368
    +        mi_ext_fields_ :: ExtensibleFieldsData phase
    
    305 369
                     -- ^ Additional optional fields, where the Map key represents
    
    306 370
                     -- the field name, resulting in a (size, serialized data) pair.
    
    307 371
                     -- Because the data is intended to be serialized through the
    
    ... ... @@ -334,12 +398,12 @@ data IfacePublic_ phase = IfacePublic {
    334 398
                     -- ^ Warnings
    
    335 399
                     -- NOT STRICT!  we read this field lazily from the interface file
    
    336 400
     
    
    337
    -        mi_anns_     :: [IfaceAnnotation],
    
    401
    +        mi_anns_     :: IfaceAnnotationsData phase,
    
    338 402
                     -- ^ Annotations
    
    339 403
                     -- NOT STRICT!  we read this field lazily from the interface file
    
    340 404
     
    
    341 405
     
    
    342
    -        mi_decls_    :: [IfaceDeclExts phase],
    
    406
    +        mi_decls_    :: IfaceDeclsData phase,
    
    343 407
                     -- ^ Type, class and variable declarations
    
    344 408
                     -- The hash of an Id changes if its fixity or deprecations change
    
    345 409
                     --      (as well as its type of course)
    
    ... ... @@ -347,14 +411,14 @@ data IfacePublic_ phase = IfacePublic {
    347 411
                     -- the hash of the parent class/tycon changes
    
    348 412
     
    
    349 413
     
    
    350
    -        mi_defaults_ :: [IfaceDefault],
    
    414
    +        mi_defaults_ :: IfaceDefaultsData phase,
    
    351 415
                     -- ^ default declarations exported by the module
    
    352 416
     
    
    353 417
     
    
    354 418
                     -- Instance declarations and rules
    
    355
    -        mi_insts_       :: [IfaceClsInst],     -- ^ Sorted class instance
    
    356
    -        mi_fam_insts_   :: [IfaceFamInst],  -- ^ Sorted family instances
    
    357
    -        mi_rules_       :: [IfaceRule],     -- ^ Sorted rules
    
    419
    +        mi_insts_       :: IfaceClsInstsData phase, -- ^ Sorted class instance
    
    420
    +        mi_fam_insts_   :: IfaceFamInstsData phase, -- ^ Sorted family instances
    
    421
    +        mi_rules_       :: IfaceRulesData phase,    -- ^ Sorted rules
    
    358 422
     
    
    359 423
     
    
    360 424
             mi_trust_     :: IfaceTrustInfo,
    
    ... ... @@ -367,20 +431,20 @@ data IfacePublic_ phase = IfacePublic {
    367 431
                     -- itself) but imports some trustworthy modules from its own
    
    368 432
                     -- package (which does require its own package be trusted).
    
    369 433
                     -- See Note [Trust Own Package] in GHC.Rename.Names
    
    370
    -        mi_complete_matches_ :: [IfaceCompleteMatch],
    
    434
    +        mi_complete_matches_ :: IfaceCompleteMatchesData phase,
    
    371 435
                     -- ^ {-# COMPLETE #-} declarations
    
    372 436
     
    
    373 437
             mi_caches_ :: IfaceCache,
    
    374 438
                     -- ^ Cached lookups of some parts of mi_public
    
    375 439
     
    
    376
    -        mi_abi_hashes_ :: (IfaceAbiHashesExts phase)
    
    440
    +        mi_abi_hashes_ :: IfaceAbiHashesData phase
    
    377 441
                     -- ^ Either `()` or `IfaceAbiHashes` for
    
    378 442
                     -- a fully instantiated interface.
    
    379 443
                     -- These fields are hashes of different parts of the public interface.
    
    380 444
     }
    
    381 445
     
    
    382 446
     mkIfacePublic :: [IfaceExport]
    
    383
    -                  -> [IfaceDeclExts 'ModIfaceFinal]
    
    447
    +                  -> [(Fingerprint, IfaceDecl)]
    
    384 448
                       -> [(OccName, Fixity)]
    
    385 449
                       -> IfaceWarnings
    
    386 450
                       -> [IfaceAnnotation]
    
    ... ... @@ -501,22 +565,22 @@ That's why in GHC.Driver.Main.hscMaybeWriteIface there is the call to
    501 565
     forceModIface.
    
    502 566
     -}
    
    503 567
     
    
    504
    -mi_flag_hash :: ModIface_ phase -> Maybe (FingerprintWithValue IfaceDynFlags)
    
    568
    +mi_flag_hash :: ModIface -> Maybe (FingerprintWithValue IfaceDynFlags)
    
    505 569
     mi_flag_hash = fmap mi_sr_flag_hash . mi_self_recomp_
    
    506 570
     
    
    507
    -mi_opt_hash :: ModIface_ phase -> Maybe Fingerprint
    
    571
    +mi_opt_hash :: ModIface -> Maybe Fingerprint
    
    508 572
     mi_opt_hash = fmap mi_sr_opt_hash . mi_self_recomp_
    
    509 573
     
    
    510
    -mi_hpc_hash :: ModIface_ phase -> Maybe Fingerprint
    
    574
    +mi_hpc_hash :: ModIface -> Maybe Fingerprint
    
    511 575
     mi_hpc_hash = fmap mi_sr_hpc_hash . mi_self_recomp_
    
    512 576
     
    
    513
    -mi_src_hash :: ModIface_ phase -> Maybe Fingerprint
    
    577
    +mi_src_hash :: ModIface -> Maybe Fingerprint
    
    514 578
     mi_src_hash = fmap mi_sr_src_hash . mi_self_recomp_
    
    515 579
     
    
    516
    -mi_usages :: ModIface_ phase -> Maybe [Usage]
    
    580
    +mi_usages :: ModIface -> Maybe [Usage]
    
    517 581
     mi_usages = fmap mi_sr_usages . mi_self_recomp_
    
    518 582
     
    
    519
    -mi_plugin_hash :: ModIface_ phase -> Maybe Fingerprint
    
    583
    +mi_plugin_hash :: ModIface -> Maybe Fingerprint
    
    520 584
     mi_plugin_hash = fmap mi_sr_plugin_hash . mi_self_recomp_
    
    521 585
     
    
    522 586
     -- | Accessor for the module hash of the ABI from a ModIface.
    
    ... ... @@ -547,7 +611,7 @@ mi_orphan_hash iface = mi_abi_orphan_hash (mi_abi_hashes iface)
    547 611
     
    
    548 612
     -- | Old-style accessor for whether or not the ModIface came from an hs-boot
    
    549 613
     -- file.
    
    550
    -mi_boot :: ModIface -> IsBootInterface
    
    614
    +mi_boot :: ModIface_ phase -> IsBootInterface
    
    551 615
     mi_boot iface = if mi_hsc_src iface == HsBootFile
    
    552 616
         then IsBoot
    
    553 617
         else NotBoot
    
    ... ... @@ -557,7 +621,7 @@ mi_mnwib iface = GWIB (moduleName $ mi_module iface) (mi_boot iface)
    557 621
     
    
    558 622
     -- | Lookups up a (possibly cached) fixity from a 'ModIface'. If one cannot be
    
    559 623
     -- found, 'defaultFixity' is returned instead.
    
    560
    -mi_fix :: ModIface -> OccName -> Fixity
    
    624
    +mi_fix :: ModIface_ phase -> OccName -> Fixity
    
    561 625
     mi_fix iface name = mi_fix_fn iface name `orElse` defaultFixity
    
    562 626
     
    
    563 627
     -- | The semantic module for this interface; e.g., if it's a interface
    
    ... ... @@ -573,7 +637,7 @@ mi_semantic_module iface = mi_mod_info_semantic_module (mi_mod_info iface)
    573 637
     
    
    574 638
     -- | The "precise" free holes, e.g., the signatures that this
    
    575 639
     -- 'ModIface' depends on.
    
    576
    -mi_free_holes :: ModIface -> UniqDSet ModuleName
    
    640
    +mi_free_holes :: ModIface_ phase -> UniqDSet ModuleName
    
    577 641
     mi_free_holes iface =
    
    578 642
       case getModuleInstantiation (mi_module iface) of
    
    579 643
         (_, Just indef)
    
    ... ... @@ -771,7 +835,7 @@ emptyPartialModIface mod
    771 835
             mi_iface_hash_  = fingerprint0,
    
    772 836
             mi_hi_bytes_    = PartialIfaceBinHandle,
    
    773 837
             mi_deps_        = noDependencies,
    
    774
    -        mi_public_      = emptyPublicModIface (),
    
    838
    +        mi_public_      = emptyPublicModIface [] [] [] [] [] [] [] (),
    
    775 839
             mi_simplified_core_ = Nothing,
    
    776 840
             mi_top_env_     = IfaceTopEnv emptyDetOrdAvails [] ,
    
    777 841
             mi_docs_        = Nothing,
    
    ... ... @@ -787,24 +851,39 @@ emptyIfaceModInfo mod = IfaceModInfo
    787 851
       , mi_mod_info_hsc_src = HsSrcFile
    
    788 852
       }
    
    789 853
     
    
    790
    -
    
    791
    -emptyPublicModIface :: IfaceAbiHashesExts phase -> IfacePublic_ phase
    
    792
    -emptyPublicModIface abi_hashes = IfacePublic
    
    793
    -  { mi_exports_ = []
    
    794
    -  , mi_decls_ = []
    
    795
    -  , mi_fixities_ = []
    
    796
    -  , mi_warns_ = IfWarnSome [] []
    
    797
    -  , mi_anns_ = []
    
    798
    -  , mi_defaults_ = []
    
    799
    -  , mi_insts_ = []
    
    800
    -  , mi_fam_insts_ = []
    
    801
    -  , mi_rules_ = []
    
    802
    -  , mi_abi_hashes_ = abi_hashes
    
    803
    -  , mi_trust_ = noIfaceTrustInfo
    
    804
    -  , mi_trust_pkg_ = False
    
    805
    -  , mi_caches_ = emptyModIfaceCache
    
    806
    -  , mi_complete_matches_ = []
    
    807
    -  }
    
    854
    +emptyPublicModIface :: IfaceAnnotationsData phase
    
    855
    +                    -> IfaceDeclsData phase
    
    856
    +                    -> IfaceDefaultsData phase
    
    857
    +                    -> IfaceClsInstsData phase
    
    858
    +                    -> IfaceFamInstsData phase
    
    859
    +                    -> IfaceRulesData phase
    
    860
    +                    -> IfaceCompleteMatchesData phase
    
    861
    +                    -> IfaceAbiHashesData phase
    
    862
    +                    -> IfacePublic_ phase
    
    863
    +emptyPublicModIface anns
    
    864
    +                    decls
    
    865
    +                    defaults
    
    866
    +                    insts
    
    867
    +                    fam_insts
    
    868
    +                    rules
    
    869
    +                    complete_matches
    
    870
    +                    abi_hashes
    
    871
    +  = IfacePublic
    
    872
    +    { mi_exports_ = []
    
    873
    +    , mi_fixities_ = []
    
    874
    +    , mi_warns_ = IfWarnSome [] []
    
    875
    +    , mi_anns_ = anns
    
    876
    +    , mi_decls_ = decls
    
    877
    +    , mi_defaults_ = defaults
    
    878
    +    , mi_insts_ = insts
    
    879
    +    , mi_fam_insts_ = fam_insts
    
    880
    +    , mi_rules_ = rules
    
    881
    +    , mi_trust_ = noIfaceTrustInfo
    
    882
    +    , mi_trust_pkg_ = False
    
    883
    +    , mi_complete_matches_ = complete_matches
    
    884
    +    , mi_caches_ = emptyModIfaceCache
    
    885
    +    , mi_abi_hashes_ = abi_hashes
    
    886
    +    }
    
    808 887
     
    
    809 888
     emptyModIfaceCache :: IfaceCache
    
    810 889
     emptyModIfaceCache = IfaceCache {
    
    ... ... @@ -827,7 +906,7 @@ emptyIfaceBackend = IfaceAbiHashes
    827 906
     emptyFullModIface :: Module -> ModIface
    
    828 907
     emptyFullModIface mod =
    
    829 908
         (emptyPartialModIface mod)
    
    830
    -      { mi_public_ = emptyPublicModIface emptyIfaceBackend
    
    909
    +      { mi_public_ = emptyPublicModIface [] [] [] [] [] [] [] emptyIfaceBackend
    
    831 910
           , mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
    
    832 911
           }
    
    833 912
     
    
    ... ... @@ -848,8 +927,17 @@ emptyIfaceHashCache _occ = Nothing
    848 927
     
    
    849 928
     -- ModIface is completely forced since it will live in memory for a long time.
    
    850 929
     -- If forcing it uses a lot of memory, then store less things in ModIface.
    
    851
    -instance ( NFData (IfaceAbiHashesExts (phase :: ModIfacePhase))
    
    852
    -         , NFData (IfaceDeclExts (phase :: ModIfacePhase))
    
    930
    +instance ( NFData (IfaceSelfRecompData phase)
    
    931
    +         , NFData (IfaceSimplifiedCoreData phase)
    
    932
    +         , NFData (ExtensibleFieldsData phase)
    
    933
    +         , NFData (IfaceAnnotationsData phase)
    
    934
    +         , NFData (IfaceDeclsData phase)
    
    935
    +         , NFData (IfaceDefaultsData phase)
    
    936
    +         , NFData (IfaceClsInstsData phase)
    
    937
    +         , NFData (IfaceFamInstsData phase)
    
    938
    +         , NFData (IfaceRulesData phase)
    
    939
    +         , NFData (IfaceCompleteMatchesData phase)
    
    940
    +         , NFData (IfaceAbiHashesData phase)
    
    853 941
              ) => NFData (ModIface_ phase) where
    
    854 942
       rnf (PrivateModIface a1 a2 a3 a4 a5 a6 a7 a8 a9 a10)
    
    855 943
         = (a1 :: IfaceBinHandle phase)
    
    ... ... @@ -882,7 +970,15 @@ instance NFData IfaceAbiHashes where
    882 970
         `seq` rnf a5
    
    883 971
         `seq` rnf a6
    
    884 972
     
    
    885
    -instance (NFData (IfaceAbiHashesExts phase), NFData (IfaceDeclExts phase)) => NFData (IfacePublic_ phase) where
    
    973
    +instance ( NFData (IfaceAnnotationsData phase)
    
    974
    +         , NFData (IfaceDeclsData phase)
    
    975
    +         , NFData (IfaceDefaultsData phase)
    
    976
    +         , NFData (IfaceClsInstsData phase)
    
    977
    +         , NFData (IfaceFamInstsData phase)
    
    978
    +         , NFData (IfaceRulesData phase)
    
    979
    +         , NFData (IfaceCompleteMatchesData phase)
    
    980
    +         , NFData (IfaceAbiHashesData phase)
    
    981
    +         ) => NFData (IfacePublic_ phase) where
    
    886 982
       rnf (IfacePublic a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14)
    
    887 983
         =  rnf a1
    
    888 984
         `seq` rnf a2
    
    ... ... @@ -958,7 +1054,6 @@ completePartialModIface partial iface_hash decls extra_decls final_exts cache =
    958 1054
       , mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
    
    959 1055
       , mi_iface_hash_ = iface_hash
    
    960 1056
       }
    
    961
    -  where
    
    962 1057
     
    
    963 1058
     -- | Given a 'PartialIfacePublic', turn it into an 'IfacePublic' by completing
    
    964 1059
     -- missing fields.
    
    ... ... @@ -973,10 +1068,36 @@ completePublicModIface decls abi_hashes cache partial = partial
    973 1068
       , mi_caches_ = cache
    
    974 1069
       }
    
    975 1070
     
    
    1071
    +shrinkModIface :: ModIface -> RetainedModIface
    
    1072
    +shrinkModIface PrivateModIface {..}
    
    1073
    +  = PrivateModIface
    
    1074
    +    {
    
    1075
    +      mi_hi_bytes_        = RetainedIfaceBinHandle,
    
    1076
    +      mi_public_          = shrinkIfacePublic mi_public_,
    
    1077
    +      mi_self_recomp_     = (),
    
    1078
    +      mi_simplified_core_ = (),
    
    1079
    +      mi_ext_fields_      = (),
    
    1080
    +      ..
    
    1081
    +    }
    
    1082
    +
    
    1083
    +shrinkIfacePublic :: IfacePublic -> RetainedIfacePublic
    
    1084
    +shrinkIfacePublic IfacePublic {..}
    
    1085
    +  = IfacePublic
    
    1086
    +    {
    
    1087
    +      mi_anns_             = (),
    
    1088
    +      mi_decls_            = (),
    
    1089
    +      mi_defaults_         = (),
    
    1090
    +      mi_insts_            = (),
    
    1091
    +      mi_fam_insts_        = (),
    
    1092
    +      mi_rules_            = (),
    
    1093
    +      mi_complete_matches_ = (),
    
    1094
    +      ..
    
    1095
    +    }
    
    1096
    +
    
    976 1097
     set_mi_mod_info :: IfaceModInfo -> ModIface_ phase -> ModIface_ phase
    
    977 1098
     set_mi_mod_info val iface = clear_mi_hi_bytes $ iface { mi_mod_info_ = val }
    
    978 1099
     
    
    979
    -set_mi_self_recomp :: Maybe IfaceSelfRecomp-> ModIface_ phase -> ModIface_ phase
    
    1100
    +set_mi_self_recomp :: IfaceSelfRecompData phase -> ModIface_ phase -> ModIface_ phase
    
    980 1101
     set_mi_self_recomp val iface = clear_mi_hi_bytes $ iface { mi_self_recomp_ = val }
    
    981 1102
     
    
    982 1103
     set_mi_hi_bytes :: IfaceBinHandle phase -> ModIface_ phase -> ModIface_ phase
    
    ... ... @@ -988,7 +1109,7 @@ set_mi_deps val iface = clear_mi_hi_bytes $ iface { mi_deps_ = val }
    988 1109
     set_mi_public :: (IfacePublic_ phase -> IfacePublic_ phase) -> ModIface_ phase -> ModIface_ phase
    
    989 1110
     set_mi_public f iface = clear_mi_hi_bytes $ iface { mi_public_ = f (mi_public_ iface) }
    
    990 1111
     
    
    991
    -set_mi_simplified_core :: Maybe IfaceSimplifiedCore -> ModIface_ phase -> ModIface_ phase
    
    1112
    +set_mi_simplified_core :: IfaceSimplifiedCoreData phase -> ModIface_ phase -> ModIface_ phase
    
    992 1113
     set_mi_simplified_core val iface = clear_mi_hi_bytes $ iface { mi_simplified_core_ = val }
    
    993 1114
     
    
    994 1115
     set_mi_top_env :: IfaceTopEnv -> ModIface_ phase -> ModIface_ phase
    
    ... ... @@ -997,7 +1118,7 @@ set_mi_top_env val iface = clear_mi_hi_bytes $ iface { mi_top_env_ = val }
    997 1118
     set_mi_docs :: Maybe Docs -> ModIface_ phase -> ModIface_ phase
    
    998 1119
     set_mi_docs val iface = clear_mi_hi_bytes $  iface { mi_docs_ = val }
    
    999 1120
     
    
    1000
    -set_mi_ext_fields :: ExtensibleFields -> ModIface_ phase -> ModIface_ phase
    
    1121
    +set_mi_ext_fields :: ExtensibleFieldsData phase -> ModIface_ phase -> ModIface_ phase
    
    1001 1122
     set_mi_ext_fields val iface = clear_mi_hi_bytes $ iface { mi_ext_fields_ = val }
    
    1002 1123
     
    
    1003 1124
     {- Settings for mi_public interface fields -}
    
    ... ... @@ -1011,22 +1132,22 @@ set_mi_fixities val = set_mi_public (\iface -> iface { mi_fixities_ = val })
    1011 1132
     set_mi_warns :: IfaceWarnings -> ModIface_ phase -> ModIface_ phase
    
    1012 1133
     set_mi_warns val = set_mi_public (\iface -> iface { mi_warns_ = val })
    
    1013 1134
     
    
    1014
    -set_mi_anns :: [IfaceAnnotation] -> ModIface_ phase -> ModIface_ phase
    
    1135
    +set_mi_anns :: IfaceAnnotationsData phase -> ModIface_ phase -> ModIface_ phase
    
    1015 1136
     set_mi_anns val = set_mi_public (\iface -> iface { mi_anns_ = val })
    
    1016 1137
     
    
    1017
    -set_mi_insts :: [IfaceClsInst] -> ModIface_ phase -> ModIface_ phase
    
    1138
    +set_mi_insts :: IfaceClsInstsData phase -> ModIface_ phase -> ModIface_ phase
    
    1018 1139
     set_mi_insts val = set_mi_public (\iface -> iface { mi_insts_ = val })
    
    1019 1140
     
    
    1020
    -set_mi_fam_insts :: [IfaceFamInst] -> ModIface_ phase -> ModIface_ phase
    
    1141
    +set_mi_fam_insts :: IfaceFamInstsData phase -> ModIface_ phase -> ModIface_ phase
    
    1021 1142
     set_mi_fam_insts val = set_mi_public (\iface -> iface { mi_fam_insts_ = val })
    
    1022 1143
     
    
    1023
    -set_mi_rules :: [IfaceRule] -> ModIface_ phase -> ModIface_ phase
    
    1144
    +set_mi_rules :: IfaceRulesData phase -> ModIface_ phase -> ModIface_ phase
    
    1024 1145
     set_mi_rules val = set_mi_public (\iface -> iface { mi_rules_ = val })
    
    1025 1146
     
    
    1026
    -set_mi_decls :: [IfaceDeclExts phase] -> ModIface_ phase -> ModIface_ phase
    
    1147
    +set_mi_decls :: IfaceDeclsData phase -> ModIface_ phase -> ModIface_ phase
    
    1027 1148
     set_mi_decls val = set_mi_public (\iface -> iface { mi_decls_ = val })
    
    1028 1149
     
    
    1029
    -set_mi_defaults :: [IfaceDefault] -> ModIface_ phase -> ModIface_ phase
    
    1150
    +set_mi_defaults :: IfaceDefaultsData phase -> ModIface_ phase -> ModIface_ phase
    
    1030 1151
     set_mi_defaults val = set_mi_public (\iface -> iface { mi_defaults_ = val })
    
    1031 1152
     
    
    1032 1153
     set_mi_trust :: IfaceTrustInfo -> ModIface_ phase -> ModIface_ phase
    
    ... ... @@ -1035,10 +1156,10 @@ set_mi_trust val = set_mi_public (\iface -> iface { mi_trust_ = val })
    1035 1156
     set_mi_trust_pkg :: Bool -> ModIface_ phase -> ModIface_ phase
    
    1036 1157
     set_mi_trust_pkg val = set_mi_public (\iface -> iface { mi_trust_pkg_ = val })
    
    1037 1158
     
    
    1038
    -set_mi_complete_matches :: [IfaceCompleteMatch] -> ModIface_ phase -> ModIface_ phase
    
    1159
    +set_mi_complete_matches :: IfaceCompleteMatchesData phase -> ModIface_ phase -> ModIface_ phase
    
    1039 1160
     set_mi_complete_matches val = set_mi_public (\iface -> iface { mi_complete_matches_ = val })
    
    1040 1161
     
    
    1041
    -set_mi_abi_hashes :: IfaceAbiHashesExts phase -> ModIface_ phase -> ModIface_ phase
    
    1162
    +set_mi_abi_hashes :: IfaceAbiHashesData phase -> ModIface_ phase -> ModIface_ phase
    
    1042 1163
     set_mi_abi_hashes val = set_mi_public (\iface -> iface { mi_abi_hashes_ = val })
    
    1043 1164
     
    
    1044 1165
     {- Setters for mi_caches interface fields -}
    
    ... ... @@ -1084,8 +1205,9 @@ set_mi_mod_info_field f iface = clear_mi_hi_bytes $ iface { mi_mod_info_ = f (mi
    1084 1205
     clear_mi_hi_bytes :: ModIface_ phase -> ModIface_ phase
    
    1085 1206
     clear_mi_hi_bytes iface = iface
    
    1086 1207
       { mi_hi_bytes_ = case mi_hi_bytes iface of
    
    1087
    -      PartialIfaceBinHandle -> PartialIfaceBinHandle
    
    1088
    -      FullIfaceBinHandle _ -> FullIfaceBinHandle Strict.Nothing
    
    1208
    +      PartialIfaceBinHandle  -> PartialIfaceBinHandle
    
    1209
    +      FullIfaceBinHandle _   -> FullIfaceBinHandle Strict.Nothing
    
    1210
    +      RetainedIfaceBinHandle -> RetainedIfaceBinHandle
    
    1089 1211
       }
    
    1090 1212
     
    
    1091 1213
     -- ----------------------------------------------------------------------------
    
    ... ... @@ -1183,22 +1305,22 @@ pattern ModIface ::
    1183 1305
       -> [IfaceExport]
    
    1184 1306
       -> [(OccName, Fixity)]
    
    1185 1307
       -> IfaceWarnings
    
    1186
    -  -> [IfaceAnnotation]
    
    1187
    -  -> [IfaceDeclExts phase]
    
    1188
    -  -> Maybe IfaceSimplifiedCore
    
    1189
    -  -> [IfaceDefault]
    
    1308
    +  -> IfaceAnnotationsData phase
    
    1309
    +  -> IfaceDeclsData phase
    
    1310
    +  -> IfaceSimplifiedCoreData phase
    
    1311
    +  -> IfaceDefaultsData phase
    
    1190 1312
       -> IfaceTopEnv
    
    1191
    -  -> [IfaceClsInst]
    
    1192
    -  -> [IfaceFamInst]
    
    1193
    -  -> [IfaceRule]
    
    1313
    +  -> IfaceClsInstsData phase
    
    1314
    +  -> IfaceFamInstsData phase
    
    1315
    +  -> IfaceRulesData phase
    
    1194 1316
       -> IfaceTrustInfo
    
    1195 1317
       -> Bool
    
    1196
    -  -> [IfaceCompleteMatch]
    
    1318
    +  -> IfaceCompleteMatchesData phase
    
    1197 1319
       -> Maybe Docs
    
    1198
    -  -> IfaceAbiHashesExts phase
    
    1199
    -  -> ExtensibleFields
    
    1320
    +  -> IfaceAbiHashesData phase
    
    1321
    +  -> ExtensibleFieldsData phase
    
    1200 1322
       -> IfaceBinHandle phase
    
    1201
    -  -> Maybe IfaceSelfRecomp
    
    1323
    +  -> IfaceSelfRecompData phase
    
    1202 1324
       -> (OccName -> Maybe Fixity)
    
    1203 1325
       -> (OccName -> Maybe (OccName, Fingerprint))
    
    1204 1326
       -> (OccName -> Maybe (WarningTxt GhcRn))
    

  • 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/count-deps/Main.hs
    ... ... @@ -79,5 +79,5 @@ calcDeps modName libdir =
    79 79
         mkModule :: String -> ModuleName -> Module
    
    80 80
         mkModule ghcUnitId = Module (stringToUnit ghcUnitId)
    
    81 81
     
    
    82
    -    modDeps :: ModIface -> [ModuleName]
    
    82
    +    modDeps :: RetainedModIface -> [ModuleName]
    
    83 83
         modDeps mi = map (gwib_mod . (\(_, _, mn) -> mn)) $ Set.toList $ dep_direct_mods (mi_deps mi)