[Git][ghc/ghc][wip/hadrian-with_profiled_libs] hadrian: add with_profiled_libs flavour transformer
Cheng Shao pushed to branch wip/hadrian-with_profiled_libs at Glasgow Haskell Compiler / GHC Commits: 27e796af by Cheng Shao at 2025-12-04T18:16:25+01:00 hadrian: add with_profiled_libs flavour transformer This patch adds a `with_profiled_libs` flavour transformer to hadrian which is the exact opposite of `no_profiled_libs`. It adds profiling ways to rts/library ways, and doesn't alter other flavour settings. It is useful when needing to test profiling logic locally with a quick flavour. - - - - - 2 changed files: - hadrian/doc/flavours.md - hadrian/src/Flavour.hs Changes: ===================================== hadrian/doc/flavours.md ===================================== @@ -270,6 +270,10 @@ The supported transformers are listed below: <td><code>text_simdutf</code></td> <td>Enable building the <code>text</code> package with <code>simdutf</code> support.</td> </tr> + <tr> + <td><code>with_profiled_libs</code></td> + <td>Enables building of libraries and the RTS in profiled build ways (the opposite of <code>no_profiled_libs</code>).</td> + </tr> <tr> <td><code>no_profiled_libs</code></td> <td>Disables building of libraries in profiled build ways.</td> ===================================== hadrian/src/Flavour.hs ===================================== @@ -14,6 +14,7 @@ module Flavour , enableProfiledGhc , disableDynamicGhcPrograms , disableDynamicLibs + , enableProfiledLibs , disableProfiledLibs , enableLinting , enableHaddock @@ -59,6 +60,7 @@ flavourTransformers = M.fromList , "no_dynamic_libs" =: disableDynamicLibs , "native_bignum" =: useNativeBignum , "text_simdutf" =: enableTextWithSIMDUTF + , "with_profiled_libs" =: enableProfiledLibs , "no_profiled_libs" =: disableProfiledLibs , "omit_pragmas" =: omitPragmas , "ipe" =: enableIPE @@ -301,6 +303,17 @@ disableDynamicLibs flavour = prune :: Ways -> Ways prune = fmap $ Set.filter (not . wayUnit Dynamic) +-- | Build libraries and the RTS in profiled ways (opposite of +-- 'disableProfiledLibs'). +enableProfiledLibs :: Flavour -> Flavour +enableProfiledLibs flavour = + flavour + { libraryWays = addProfilingWays $ libraryWays flavour + , rtsWays = addProfilingWays $ rtsWays flavour + } + where + addProfilingWays :: Ways -> Ways + addProfilingWays ways = fmap (\ws -> ws <> Set.map (<> profiling) ws) ways -- | Don't build libraries in profiled 'Way's. disableProfiledLibs :: Flavour -> Flavour View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/27e796af94cda5fa4aaac2156bd16f0d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/27e796af94cda5fa4aaac2156bd16f0d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Cheng Shao (@TerrorJack)