[Git][ghc/ghc][wip/haanss/depdir] Added cases for UsageDirectory in the functions rnf, put_ and get

Hassan Al-Awwadi pushed to branch wip/haanss/depdir at Glasgow Haskell Compiler / GHC Commits: e4016a66 by Hassan Al-Awwadi at 2025-07-05T13:25:30+02:00 Added cases for UsageDirectory in the functions rnf, put_ and get - - - - - 2 changed files: - compiler/GHC/Unit/Finder.hs - compiler/GHC/Unit/Module/Deps.hs Changes: ===================================== compiler/GHC/Unit/Finder.hs ===================================== @@ -151,7 +151,7 @@ initFinderCache = do hash <- getDirHash key atomicModifyIORef' dir_cache $ \c -> (M.insert key hash c, ()) return hash - Just fp -> return fp + Just fp -> return fp return FinderCache{..} -- | This function computes a shallow hash of a directory, so really just what files and directories are directly inside it. ===================================== compiler/GHC/Unit/Module/Deps.hs ===================================== @@ -412,6 +412,7 @@ instance NFData Usage where rnf (UsagePackageModule mod hash safe) = rnf mod `seq` rnf hash `seq` rnf safe `seq` () rnf (UsageHomeModule mod uid hash entities exports safe) = rnf mod `seq` rnf uid `seq` rnf hash `seq` rnf entities `seq` rnf exports `seq` rnf safe `seq` () rnf (UsageFile file hash label) = rnf file `seq` rnf hash `seq` rnf label `seq` () + rnf (UsageDirectory dir hash label) = rnf dir `seq` rnf hash `seq` rnf label `seq` () rnf (UsageMergedRequirement mod hash) = rnf mod `seq` rnf hash `seq` () rnf (UsageHomeModuleInterface mod uid hash) = rnf mod `seq` rnf uid `seq` rnf hash `seq` () @@ -448,6 +449,12 @@ instance Binary Usage where put_ bh (usg_unit_id usg) put_ bh (usg_iface_hash usg) + put_ bh usg@UsageDirectory{} = do + putByte bh 5 + put_ bh (usg_dir_path usg) + put_ bh (usg_dir_hash usg) + put_ bh (usg_dir_label usg) + get bh = do h <- getByte bh case h of @@ -479,6 +486,12 @@ instance Binary Usage where uid <- get bh hash <- get bh return UsageHomeModuleInterface { usg_mod_name = mod, usg_unit_id = uid, usg_iface_hash = hash } + 5 -> do + dp <- get bh + hash <- get bh + label <- get bh + return UsageDirectory { usg_dir_path = fp, usg_dir_hash = hash, usg_dir_label = label } + i -> error ("Binary.get(Usage): " ++ show i) -- | Records the imports that we depend on from a home module, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e4016a66aa751eeb863b6a01680647e6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e4016a66aa751eeb863b6a01680647e6... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Hassan Al-Awwadi (@hassan.awwadi)