[Git][ghc/ghc][wip/torsten.schmits/parallel-depanal-downsweep] Make addToFinderCache monotonic

Sjoerd Visscher (@trac-sjoerd_visscher) gitlab at gitlab.haskell.org
Tue Aug 27 12:16:11 UTC 2024



Sjoerd Visscher pushed to branch wip/torsten.schmits/parallel-depanal-downsweep at Glasgow Haskell Compiler / GHC


Commits:
11ce0336 by Sjoerd Visscher at 2024-08-27T14:16:04+02:00
Make addToFinderCache monotonic

- - - - -


1 changed file:

- compiler/GHC/Unit/Finder.hs


Changes:

=====================================
compiler/GHC/Unit/Finder.hs
=====================================
@@ -106,7 +106,11 @@ flushFinderCaches (FinderCache ref file_ref) ue = do
 
 addToFinderCache :: FinderCache -> InstalledModule -> InstalledFindResult -> IO ()
 addToFinderCache (FinderCache ref _) key val =
-  atomicModifyIORef' ref $ \c -> (extendInstalledModuleEnv c key val, ())
+  atomicModifyIORef' ref $ \c ->
+    case (lookupInstalledModuleEnv c key, val) of
+      -- Don't overwrite an InstalledFound with an InstalledNotFound
+      (Just InstalledFound{}, InstalledNotFound{}) -> (c, ())
+      _ -> (extendInstalledModuleEnv c key val, ())
 
 removeFromFinderCache :: FinderCache -> InstalledModule -> IO ()
 removeFromFinderCache (FinderCache ref _) key =



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/11ce033694f86e62cb34664db1add86b503abcfd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/11ce033694f86e62cb34664db1add86b503abcfd
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240827/e998c51b/attachment-0001.html>


More information about the ghc-commits mailing list