summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/Finder
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-06-08 20:49:49 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-06-08 20:49:49 +0100
commitb95ccfb24d5b51a68ee173e04564e98d6a8f6180 (patch)
treeec1ccfcddfe2f98c37dac3bbc6b4ab30b2b44d8f /compiler/GHC/Unit/Finder
parent9e724f6e5bcb31abd270ea44fb01b1edb18f626f (diff)
downloadhaskell-wip/hash-file-cache.tar.gz
FinderCache: Also cache file hashing in interface file checkswip/hash-file-cache
Now that we hash object files to decide when to recompile due to TH, this can make a big difference as each interface file in a project will contain reference to the object files of all package dependencies. Especially when these are statically linked, hashing them can add up. The cache is invalidated when `depanalPartial` is called, like the normal finder cache.
Diffstat (limited to 'compiler/GHC/Unit/Finder')
-rw-r--r--compiler/GHC/Unit/Finder/Types.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Unit/Finder/Types.hs b/compiler/GHC/Unit/Finder/Types.hs
index 06f4ea8aae..c48b7d9789 100644
--- a/compiler/GHC/Unit/Finder/Types.hs
+++ b/compiler/GHC/Unit/Finder/Types.hs
@@ -9,6 +9,8 @@ where
import GHC.Prelude
import GHC.Unit
import GHC.Unit.State
+import qualified Data.Map as M
+import GHC.Fingerprint
import Data.IORef
@@ -18,7 +20,10 @@ import Data.IORef
-- contents of this cache.
--
type FinderCacheState = InstalledModuleEnv InstalledFindResult
-newtype FinderCache = FinderCache (IORef FinderCacheState)
+type FileCacheState = M.Map FilePath Fingerprint
+data FinderCache = FinderCache { fcModuleCache :: (IORef FinderCacheState)
+ , fcFileCache :: (IORef FileCacheState)
+ }
data InstalledFindResult
= InstalledFound ModLocation InstalledModule