Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Driver/Downsweep.hs
    ... ... @@ -56,7 +56,7 @@ import GHC.Data.Graph.Directed
    56 56
     import GHC.Data.FastString
    
    57 57
     import GHC.Data.Maybe      ( expectJust )
    
    58 58
     import qualified GHC.Data.Maybe as M
    
    59
    -import GHC.Data.OsPath     ( unsafeEncodeUtf )
    
    59
    +import GHC.Data.OsPath     ( OsPath, unsafeEncodeUtf )
    
    60 60
     import GHC.Data.StringBuffer
    
    61 61
     import GHC.Data.Graph.Directed.Reachability
    
    62 62
     import qualified GHC.LanguageExtensions as LangExt
    
    ... ... @@ -216,9 +216,9 @@ downsweep hsc_env diag_wrapper msg old_summaries excl_mods allow_dup_roots = do
    216 216
         -- file was used in.
    
    217 217
         -- Reuse these if we can because the most expensive part of downsweep is
    
    218 218
         -- reading the headers.
    
    219
    -    old_summary_map :: M.Map (UnitId, FilePath) ModSummary
    
    219
    +    old_summary_map :: M.Map (UnitId, OsPath) ModSummary
    
    220 220
         old_summary_map =
    
    221
    -      M.fromList [((ms_unitid ms, msHsFilePath ms), ms) | ms <- old_summaries]
    
    221
    +      M.fromList [((ms_unitid ms, msHsFileOsPath ms), ms) | ms <- old_summaries]
    
    222 222
     
    
    223 223
         -- Dependencies arising on a unit (backpack and module linking deps)
    
    224 224
         unitModuleNodes :: [ModuleGraphNode] -> UnitId -> HomeUnitEnv -> [Either (Messages DriverMessage) ModuleGraphNode]
    
    ... ... @@ -384,7 +384,7 @@ data DownsweepMode = DownsweepUseCompile | DownsweepUseFixed
    384 384
     -- This function will start at the given roots, and traverse downwards to find
    
    385 385
     -- all the dependencies, all the way to the leaf units.
    
    386 386
     downsweepFromRootNodes :: HscEnv
    
    387
    -                  -> M.Map (UnitId, FilePath) ModSummary
    
    387
    +                  -> M.Map (UnitId, OsPath) ModSummary
    
    388 388
                       -> [ModuleName]
    
    389 389
                       -> Bool
    
    390 390
                       -> DownsweepMode -- ^ Whether to create fixed or compile nodes for dependencies
    
    ... ... @@ -442,7 +442,7 @@ type DownsweepM a = ReaderT DownsweepEnv IO a
    442 442
     data DownsweepEnv = DownsweepEnv {
    
    443 443
           downsweep_hsc_env :: HscEnv
    
    444 444
         , _downsweep_mode :: DownsweepMode
    
    445
    -    , _downsweep_old_summaries :: M.Map (UnitId, FilePath) ModSummary
    
    445
    +    , _downsweep_old_summaries :: M.Map (UnitId, OsPath) ModSummary
    
    446 446
         , _downsweep_excl_mods :: [ModuleName]
    
    447 447
     }
    
    448 448
     
    
    ... ... @@ -715,7 +715,7 @@ linkNodes summaries uid hue =
    715 715
     
    
    716 716
     getRootSummary ::
    
    717 717
       [ModuleName] ->
    
    718
    -  M.Map (UnitId, FilePath) ModSummary ->
    
    718
    +  M.Map (UnitId, OsPath) ModSummary ->
    
    719 719
       HscEnv ->
    
    720 720
       Target ->
    
    721 721
       IO (Either DriverMessages ModSummary)
    
    ... ... @@ -1183,7 +1183,7 @@ mkRootMap summaries = Map.fromListWith (flip (++))
    1183 1183
     summariseFile
    
    1184 1184
             :: HscEnv
    
    1185 1185
             -> HomeUnit
    
    1186
    -        -> M.Map (UnitId, FilePath) ModSummary    -- old summaries
    
    1186
    +        -> M.Map (UnitId, OsPath) ModSummary    -- old summaries
    
    1187 1187
             -> FilePath                     -- source file name
    
    1188 1188
             -> Maybe Phase                  -- start phase
    
    1189 1189
             -> Maybe (StringBuffer,UTCTime)
    
    ... ... @@ -1192,7 +1192,7 @@ summariseFile
    1192 1192
     summariseFile hsc_env' home_unit old_summaries src_fn mb_phase maybe_buf
    
    1193 1193
             -- we can use a cached summary if one is available and the
    
    1194 1194
             -- source file hasn't changed,
    
    1195
    -   | Just old_summary <- M.lookup (homeUnitId home_unit, src_fn) old_summaries
    
    1195
    +   | Just old_summary <- M.lookup (homeUnitId home_unit, src_fn_os) old_summaries
    
    1196 1196
        = do
    
    1197 1197
             let location = ms_location $ old_summary
    
    1198 1198
     
    
    ... ... @@ -1213,6 +1213,7 @@ summariseFile hsc_env' home_unit old_summaries src_fn mb_phase maybe_buf
    1213 1213
       where
    
    1214 1214
         -- change the main active unit so all operations happen relative to the given unit
    
    1215 1215
         hsc_env = hscSetActiveHomeUnit home_unit hsc_env'
    
    1216
    +    src_fn_os = unsafeEncodeUtf src_fn
    
    1216 1217
         -- src_fn does not necessarily exist on the filesystem, so we need to
    
    1217 1218
         -- check what kind of target we are dealing with
    
    1218 1219
         get_src_hash = case maybe_buf of
    
    ... ... @@ -1302,7 +1303,7 @@ data SummariseResult =
    1302 1303
     -- --make mode.
    
    1303 1304
     summariseModule :: HscEnv
    
    1304 1305
                     -> HomeUnit
    
    1305
    -                -> M.Map (UnitId, FilePath) ModSummary
    
    1306
    +                -> M.Map (UnitId, OsPath) ModSummary
    
    1306 1307
                     -> IsBootInterface
    
    1307 1308
                     -> Located ModuleName
    
    1308 1309
                     -> PkgQual
    
    ... ... @@ -1382,7 +1383,7 @@ summariseModuleDispatch k hsc_env' home_unit is_boot (L _ wanted_mod) mb_pkg exc
    1382 1383
     -- for it and potentially compile it.
    
    1383 1384
     summariseModuleWithSource
    
    1384 1385
               :: HomeUnit
    
    1385
    -          -> M.Map (UnitId, FilePath) ModSummary
    
    1386
    +          -> M.Map (UnitId, OsPath) ModSummary
    
    1386 1387
               -- ^ Map of old summaries
    
    1387 1388
               -> IsBootInterface    -- True <=> a {-# SOURCE #-} import
    
    1388 1389
               -> Maybe (StringBuffer, UTCTime)
    
    ... ... @@ -1411,7 +1412,7 @@ summariseModuleWithSource home_unit old_summary_map is_boot maybe_buf hsc_env lo
    1411 1412
       where
    
    1412 1413
         dflags    = hsc_dflags hsc_env
    
    1413 1414
         new_summary_cache_check loc mod src_fn h
    
    1414
    -      | Just old_summary <- Map.lookup ((toUnitId (moduleUnit mod), src_fn)) old_summary_map =
    
    1415
    +      | Just old_summary <- Map.lookup ((toUnitId (moduleUnit mod), src_fn_os)) old_summary_map =
    
    1415 1416
     
    
    1416 1417
              -- check the hash on the source file, and
    
    1417 1418
              -- return the cached summary if it hasn't changed.  If the
    
    ... ... @@ -1422,6 +1423,8 @@ summariseModuleWithSource home_unit old_summary_map is_boot maybe_buf hsc_env lo
    1422 1423
                Nothing    ->
    
    1423 1424
                    checkSummaryHash hsc_env (new_summary loc mod src_fn) old_summary loc h
    
    1424 1425
           | otherwise = new_summary loc mod src_fn h
    
    1426
    +      where
    
    1427
    +        src_fn_os = unsafeEncodeUtf src_fn
    
    1425 1428
     
    
    1426 1429
         new_summary :: ModLocation
    
    1427 1430
                       -> Module