Patrick pushed to branch wip/T26118-remove-hptallfaminstances-usage-during-upsweep at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Driver/Env.hs
    ... ... @@ -266,6 +266,9 @@ hugInstancesBelow hsc_env uid mnwib = do
    266 266
                               mnwib
    
    267 267
      return (foldl' unionInstEnv emptyInstEnv insts, concat famInsts)
    
    268 268
     
    
    269
    +-- | Get things from modules in the transitive closure of the given module.
    
    270
    +--
    
    271
    +-- Note: Don't expose this function. This is a footgun if exposed!
    
    269 272
     hugSomeThingsBelowUs' :: (HomeModInfo -> a -> a) -> a -> Bool -> HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO a
    
    270 273
     hugSomeThingsBelowUs' _ acc _ hsc_env _ _ | isOneShot (ghcMode (hsc_dflags hsc_env)) = return acc
    
    271 274
     -- An explicit check to see if we are in one-shot mode to avoid poking the ModuleGraph thunk
    

  • compiler/GHC/Tc/Instance/Family.hs
    ... ... @@ -25,6 +25,7 @@ import GHC.Core.TyCo.Rep
    25 25
     import GHC.Core.TyCo.FVs
    
    26 26
     
    
    27 27
     import GHC.Iface.Load
    
    28
    +import GHC.IO (unsafeInterleaveIO)
    
    28 29
     
    
    29 30
     import GHC.Tc.Errors.Types
    
    30 31
     import GHC.Tc.Types.Evidence
    
    ... ... @@ -317,7 +318,7 @@ checkFamInstConsistency directlyImpMods hsc_env unitId mnwib
    317 318
                  -- See Note [Order of type family consistency checks]
    
    318 319
                  }
    
    319 320
     
    
    320
    -       ; hpt_fam_insts <- liftIO $ hugFamInstancesBelow hsc_env unitId mnwib
    
    321
    +       ; hpt_fam_insts <- liftIO $ unsafeInterleaveIO $ hugFamInstancesBelow hsc_env unitId mnwib
    
    321 322
            ; debug_consistent_set <- mapM (\x -> (\y -> (x, length y)) <$> modConsistent x) directlyImpMods
    
    322 323
            ; traceTc "init_consistent_set" (ppr debug_consistent_set)
    
    323 324
            ; let init_consistent_set = map fst (reverse (sortOn snd debug_consistent_set))