Matthew Pickering pushed to branch wip/gdc-files at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/HsToCore/Usage.hs
    ... ... @@ -187,9 +187,7 @@ mkObjectUsage pit plugins fc hug th_links_needed th_pkgs_needed = do
    187 187
               -- home package ifaces in the PIT.
    
    188 188
               miface <- lookupIfaceByModule hug pit m
    
    189 189
               case miface of
    
    190
    -            -- TODO: MP: This is wrong, a placeholder for now.
    
    191
    -            -- We need to work out what to do for bytecode linkables which are not loaded into HPT
    
    192
    -            Nothing -> return $ UsageHomeModuleInterface (moduleName m) (toUnitId $ moduleUnit m) fingerprint0
    
    190
    +            Nothing -> pprPanic "linkableToUsage" (ppr m)
    
    193 191
                 Just iface ->
    
    194 192
                   return $ UsageHomeModuleInterface (moduleName m) (toUnitId $ moduleUnit m) (mi_iface_hash iface)
    
    195 193
     
    

  • compiler/GHC/Linker/Loader.hs
    ... ... @@ -647,12 +647,17 @@ findWholeCoreBindings hsc_env mod = do
    647 647
     
    
    648 648
     
    
    649 649
     findBytecodeLinkableMaybe :: HscEnv -> Module -> ModLocation -> IO (Maybe Linkable)
    
    650
    -findBytecodeLinkableMaybe hsc_env _mod locn = do
    
    650
    +findBytecodeLinkableMaybe hsc_env mod locn = do
    
    651 651
       let bytecode_fn = ml_bytecode_file locn
    
    652 652
       maybe_bytecode_time <- modificationTimeIfExists bytecode_fn
    
    653 653
       case maybe_bytecode_time of
    
    654 654
         Nothing -> return Nothing
    
    655 655
         Just bytecode_time -> do
    
    656
    +      -- Also load the interface, for reasons to do with recompilation avoidance.
    
    657
    +      -- See Note [Recompilation avoidance with bytecode objects]
    
    658
    +      _ <- initIfaceLoad hsc_env $
    
    659
    +             loadInterface (text "get_reachable_nodes" <+> parens (ppr mod))
    
    660
    +                 mod ImportBySystem
    
    656 661
           bco <- readBinByteCode hsc_env bytecode_fn
    
    657 662
           Just <$> loadByteCodeObjectLinkable hsc_env bytecode_time locn bco
    
    658 663