diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2018-12-07 23:19:36 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-12-07 23:19:38 -0500 |
commit | 665f8b0c778b3a5dac4696f81da0cea88b101ea9 (patch) | |
tree | 1e31d663b6de8468cd064e798efb13d32f5d45a2 /hadrian/src/Rules.hs | |
parent | cb882fc993b4972f7f212b291229ef9e9ade0af9 (diff) | |
download | haskell-665f8b0c778b3a5dac4696f81da0cea88b101ea9.tar.gz |
hadrian: eliminate most of the remaining big rule enumerations
Following what was done to Rules.Library some time ago and to
Rules.Compile recently (D5412), this patch moves more rules away from
the "enumerate a lot of contexts and generate one rule for each" style
and instead uses the "parse data from file path to recover context"
approach. In fact, the only rules left to convert seem to be the ones
from Rules.Generate.
This effectively decreases the pauses described in #15938 further as
well as the amount of allocations and GC that we do, unsurprisingly.
Nowhere as drastically as D5412, though.
Test Plan: perform full build and generate docs
Reviewers: snowleopard, bgamari
Reviewed By: snowleopard
Subscribers: rwbarton, carter
GHC Trac Issues: #15938
Differential Revision: https://phabricator.haskell.org/D5422
Diffstat (limited to 'hadrian/src/Rules.hs')
-rw-r--r-- | hadrian/src/Rules.hs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/hadrian/src/Rules.hs b/hadrian/src/Rules.hs index 0e55087b7d..69a151c206 100644 --- a/hadrian/src/Rules.hs +++ b/hadrian/src/Rules.hs @@ -95,15 +95,12 @@ packageRules = do writePackageDb = [(packageDb, maxConcurrentReaders)] Rules.Compile.compilePackage readPackageDb + Rules.Dependencies.buildPackageDependencies readPackageDb + Rules.Documentation.buildPackageDocumentation + Rules.Program.buildProgramRules readPackageDb + Rules.Register.configurePackageRules - Rules.Program.buildProgram readPackageDb - - forM_ [Stage0 .. ] $ \stage -> - -- we create a dummy context, that has the correct state, but contains - -- @dummyPackage@ as a... dummy package. The package isn't accessed but the record - -- need to be set properly. @undefined@ is not an option as it ends up - -- being forced. - Rules.Register.registerPackage writePackageDb (Context stage dummyPackage vanilla) + forM_ [Stage0, Stage1] (Rules.Register.registerPackageRules writePackageDb) -- TODO: Can we get rid of this enumeration of contexts? Since we iterate -- over it to generate all 4 types of rules below, all the time, we @@ -111,11 +108,7 @@ packageRules = do -- Rules.Compile and Rules.Library could save us some time there. let vanillaContexts = liftM2 vanillaContext allStages knownPackages - forM_ vanillaContexts $ mconcat - [ Rules.Register.configurePackage - , Rules.Dependencies.buildPackageDependencies readPackageDb - , Rules.Documentation.buildPackageDocumentation - , Rules.Generate.generatePackageCode ] + forM_ vanillaContexts Rules.Generate.generatePackageCode buildRules :: Rules () buildRules = do |