[Git][ghc/ghc][wip/js-staging] 3 commits: Hadrian: add no_dynamic_libs transformer
doyougnu (@doyougnu)
gitlab at gitlab.haskell.org
Tue Nov 1 19:54:06 UTC 2022
doyougnu pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
13ac3f69 by doyougnu at 2022-11-01T15:53:44-04:00
Hadrian: add no_dynamic_libs transformer
- - - - -
a274e077 by doyougnu at 2022-11-01T15:53:44-04:00
Hadrian: Add releaseJsFlavour
- - - - -
8f1832fb by doyougnu at 2022-11-01T15:53:44-04:00
Hadrian: Add enableO2Stage0 transformer
And update release-js build flavour
- - - - -
2 changed files:
- hadrian/src/Flavour.hs
- hadrian/src/Settings/Flavours/Release.hs
Changes:
=====================================
hadrian/src/Flavour.hs
=====================================
@@ -10,7 +10,9 @@ module Flavour
, enableDebugInfo, enableTickyGhc
, viaLlvmBackend
, enableProfiledGhc
+ , enableO2Stage0
, disableDynamicGhcPrograms
+ , disableDynamicLibs
, disableProfiledLibs
, enableLinting
, enableHaddock
@@ -38,26 +40,28 @@ import Oracles.Setting
flavourTransformers :: Map String (Flavour -> Flavour)
flavourTransformers = M.fromList
- [ "werror" =: werror
- , "debug_info" =: enableDebugInfo
- , "ticky_ghc" =: enableTickyGhc
- , "ticky_ghc0" =: enableTickyGhc0
- , "split_sections" =: splitSections
+ [ "werror" =: werror
+ , "debug_info" =: enableDebugInfo
+ , "ticky_ghc" =: enableTickyGhc
+ , "ticky_ghc0" =: enableTickyGhc0
+ , "optimize_stage0" =: enableO2Stage0
+ , "split_sections" =: splitSections
, "thread_sanitizer" =: enableThreadSanitizer
- , "llvm" =: viaLlvmBackend
- , "profiled_ghc" =: enableProfiledGhc
- , "no_dynamic_ghc" =: disableDynamicGhcPrograms
+ , "llvm" =: viaLlvmBackend
+ , "profiled_ghc" =: enableProfiledGhc
+ , "no_dynamic_ghc" =: disableDynamicGhcPrograms
+ , "no_dynamic_libs" =: disableDynamicLibs
, "no_profiled_libs" =: disableProfiledLibs
- , "omit_pragmas" =: omitPragmas
- , "ipe" =: enableIPE
- , "fully_static" =: fullyStatic
- , "collect_timings" =: collectTimings
- , "assertions" =: enableAssertions
- , "debug_ghc" =: debugGhc Stage1
+ , "omit_pragmas" =: omitPragmas
+ , "ipe" =: enableIPE
+ , "fully_static" =: fullyStatic
+ , "collect_timings" =: collectTimings
+ , "assertions" =: enableAssertions
+ , "debug_ghc" =: debugGhc Stage1
, "debug_stage1_ghc" =: debugGhc stage0InTree
- , "lint" =: enableLinting
- , "haddock" =: enableHaddock
- , "late_ccs" =: enableLateCCS
+ , "lint" =: enableLinting
+ , "haddock" =: enableHaddock
+ , "late_ccs" =: enableLateCCS
]
where (=:) = (,)
@@ -70,7 +74,7 @@ parseFlavour :: [Flavour] -- ^ base flavours
parseFlavour baseFlavours transformers str =
case P.runParser parser () "" str of
Left perr -> Left $ unlines $
- [ "error parsing flavour specifier: " ++ show perr
+ [ "error parsing flavour specifier: " ++ show perr
, ""
, "known flavours:"
] ++
@@ -106,6 +110,9 @@ parseFlavour baseFlavours transformers str =
addArgs :: Args -> Flavour -> Flavour
addArgs args' fl = fl { args = args fl <> args' }
+onArgs :: (Args -> Args) -> Flavour -> Flavour
+onArgs f fl = fl { args = f $ args fl}
+
-- | Turn on -Werror for packages built with the stage1 compiler.
-- It mimics the CI settings so is useful to turn on when developing.
werror :: Flavour -> Flavour
@@ -128,6 +135,11 @@ enableTickyGhc =
, builder (Ghc LinkHs) ? tickyArgs
]
+-- | Enable the ticky-ticky profiler in stage1 GHC
+enableO2Stage0 :: Flavour -> Flavour
+enableO2Stage0 fl = onArgs ensureO2 fl
+ where ensureO2 as = (builder Ghc ? stage0 ? arg "-O2") <> remove ["-O"] as
+
-- | Enable the ticky-ticky profiler in stage1 GHC
enableTickyGhc0 :: Flavour -> Flavour
enableTickyGhc0 =
@@ -222,6 +234,16 @@ enableProfiledGhc flavour =
disableDynamicGhcPrograms :: Flavour -> Flavour
disableDynamicGhcPrograms flavour = flavour { dynamicGhcPrograms = pure False }
+-- | Don't build libraries in profiled 'Way's.
+disableDynamicLibs :: Flavour -> Flavour
+disableDynamicLibs flavour =
+ flavour { libraryWays = prune $ libraryWays flavour
+ }
+ where
+ prune :: Ways -> Ways
+ prune = fmap $ Set.filter (not . wayUnit Dynamic)
+
+
-- | Don't build libraries in profiled 'Way's.
disableProfiledLibs :: Flavour -> Flavour
disableProfiledLibs flavour =
=====================================
hadrian/src/Settings/Flavours/Release.hs
=====================================
@@ -5,3 +5,10 @@ import Flavour
releaseFlavour :: Flavour
releaseFlavour = enableHaddock performanceFlavour { name = "release" }
+
+releaseJsFlavour :: Flavour
+releaseJsFlavour = disableDynamicLibs
+ . disableDynamicGhcPrograms
+ . disableProfiledLibs
+ . enableO2Stage0
+ $ performanceFlavour { name = "release-js" }
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/74f184ebc16c2bace9baeb5e3d8a4f90150ffec3...8f1832fb8ed32e66a83fb9604b28220874dfec5c
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/74f184ebc16c2bace9baeb5e3d8a4f90150ffec3...8f1832fb8ed32e66a83fb9604b28220874dfec5c
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/20221101/12b54320/attachment-0001.html>
More information about the ghc-commits
mailing list