diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-04-11 13:23:22 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-04-25 12:20:20 -0400 |
commit | 43291dceef71e25d72e4c34a18c5ed1e8707a444 (patch) | |
tree | 5637cf9f6cc7a0cfd24db9be50b3bcb397b66d1a /compiler | |
parent | 22ff0787c04a24072ade75ce0675c1c7b7c2db4f (diff) | |
download | haskell-wip/T18948.tar.gz |
Enable eventlog support in all ways by defaultwip/T18948
Here we deprecate the eventlogging RTS ways and instead enable eventlog
support in the remaining ways. This simplifies packaging and reduces GHC
compilation times (as we can eliminate two whole compilations of the RTS)
while simplifying the end-user story. The trade-off is a small increase
in binary sizes in the case that the user does not want eventlogging
support, but we think that this is a fine trade-off.
This also revealed a latent RTS bug: some files which included `Cmm.h`
also assumed that it defined various macros which were in fact defined
by `Config.h`, which `Cmm.h` did not include. Fixing this in turn
revealed that `StgMiscClosures.cmm` failed to import various spinlock
statistics counters, as evidenced by the failed unregisterised build.
Closes #18948.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Platform/Ways.hs | 10 | ||||
-rw-r--r-- | compiler/GHC/Unit/Info.hs | 10 | ||||
-rw-r--r-- | compiler/GHC/Utils/Error.hs | 12 |
4 files changed, 8 insertions, 29 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 00e7c726dd..c42256b4a2 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -2066,7 +2066,10 @@ dynamic_flags_deps = [ ------- ways --------------------------------------------------------------- , make_ord_flag defGhcFlag "prof" (NoArg (addWayDynP WayProf)) - , make_ord_flag defGhcFlag "eventlog" (NoArg (addWayDynP WayTracing)) + , (Deprecated, defFlag "eventlog" + $ noArgM $ \d -> do + deprecate "the eventlog is now enabled in all runtime system ways" + return d) , make_ord_flag defGhcFlag "debug" (NoArg (addWayDynP WayDebug)) , make_ord_flag defGhcFlag "threaded" (NoArg (addWayDynP WayThreaded)) diff --git a/compiler/GHC/Platform/Ways.hs b/compiler/GHC/Platform/Ways.hs index 6bb8aed87f..955a9bcea0 100644 --- a/compiler/GHC/Platform/Ways.hs +++ b/compiler/GHC/Platform/Ways.hs @@ -68,7 +68,6 @@ data Way | WayThreaded -- ^ (RTS only) Multithreaded runtime system | WayDebug -- ^ Debugging, enable trace messages and extra checks | WayProf -- ^ Profiling, enable cost-centre stacks and profiling reports - | WayTracing -- ^ (RTS only) enable event logging (tracing) | WayDyn -- ^ Dynamic linking deriving (Eq, Ord, Show, Read) @@ -118,7 +117,6 @@ wayTag WayThreaded = "thr" wayTag WayDebug = "debug" wayTag WayDyn = "dyn" wayTag WayProf = "p" -wayTag WayTracing = "l" -- "l" for "logging" -- | Return true for ways that only impact the RTS, not the generated code wayRTSOnly :: Way -> Bool @@ -127,7 +125,6 @@ wayRTSOnly WayDyn = False wayRTSOnly WayProf = False wayRTSOnly WayThreaded = True wayRTSOnly WayDebug = True -wayRTSOnly WayTracing = True -- | Filter ways that have an impact on compilation fullWays :: Ways -> Ways @@ -143,7 +140,6 @@ wayDesc WayThreaded = "Threaded" wayDesc WayDebug = "Debug" wayDesc WayDyn = "Dynamic" wayDesc WayProf = "Profiling" -wayDesc WayTracing = "Tracing" -- | Turn these flags on when enabling this way wayGeneralFlags :: Platform -> Way -> [GeneralFlag] @@ -159,7 +155,6 @@ wayGeneralFlags _ WayDyn = [Opt_PIC, Opt_ExternalDynamicRefs] -- PIC objects can be linked into a .so, we have to compile even -- modules of the main program with -fPIC when using -dynamic. wayGeneralFlags _ WayProf = [] -wayGeneralFlags _ WayTracing = [] -- | Turn these flags off when enabling this way wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag] @@ -170,7 +165,6 @@ wayUnsetGeneralFlags _ WayDyn = [Opt_SplitSections] -- There's no point splitting when we're going to be dynamically linking. -- Plus it breaks compilation on OSX x86. wayUnsetGeneralFlags _ WayProf = [] -wayUnsetGeneralFlags _ WayTracing = [] -- | Pass these options to the C compiler when enabling this way wayOptc :: Platform -> Way -> [String] @@ -182,7 +176,6 @@ wayOptc platform WayThreaded = case platformOS platform of wayOptc _ WayDebug = [] wayOptc _ WayDyn = [] wayOptc _ WayProf = ["-DPROFILING"] -wayOptc _ WayTracing = ["-DTRACING"] -- | Pass these options to linker when enabling this way wayOptl :: Platform -> Way -> [String] @@ -198,7 +191,6 @@ wayOptl platform WayThreaded = wayOptl _ WayDebug = [] wayOptl _ WayDyn = [] wayOptl _ WayProf = [] -wayOptl _ WayTracing = [] -- | Pass these options to the preprocessor when enabling this way wayOptP :: Platform -> Way -> [String] @@ -207,7 +199,6 @@ wayOptP _ WayThreaded = [] wayOptP _ WayDebug = [] wayOptP _ WayDyn = [] wayOptP _ WayProf = ["-DPROFILING"] -wayOptP _ WayTracing = ["-DTRACING"] -- | Consult the RTS to find whether it has been built with profiling enabled. @@ -268,7 +259,6 @@ hostWays = Set.unions , if hostIsProfiled then Set.singleton WayProf else Set.empty , if hostIsThreaded then Set.singleton WayThreaded else Set.empty , if hostIsDebugged then Set.singleton WayDebug else Set.empty - , if hostIsTracing then Set.singleton WayTracing else Set.empty ] -- | Host "full" ways (i.e. ways that have an impact on the compilation, diff --git a/compiler/GHC/Unit/Info.hs b/compiler/GHC/Unit/Info.hs index db00a9b91a..41142f653f 100644 --- a/compiler/GHC/Unit/Info.hs +++ b/compiler/GHC/Unit/Info.hs @@ -211,14 +211,8 @@ unitHsLibs namever ways0 p = map (mkDynName . addSuffix . ST.unpack) (unitLibrar -- the name of a shared library is libHSfoo-ghc<version>.so -- we leave out the _dyn, because it is superfluous - -- debug and profiled RTSs include support for -eventlog - ways2 | ways1 `hasWay` WayDebug || ways1 `hasWay` WayProf - = removeWay WayTracing ways1 - | otherwise - = ways1 - - tag = waysTag (fullWays ways2) - rts_tag = waysTag ways2 + tag = waysTag (fullWays ways1) + rts_tag = waysTag ways1 mkDynName x | not (ways0 `hasWay` WayDyn) = x diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs index db8107a65f..ef6dd4f07d 100644 --- a/compiler/GHC/Utils/Error.hs +++ b/compiler/GHC/Utils/Error.hs @@ -521,16 +521,8 @@ easily compute totals with tools like ghc-events-analyze (see below). Producing an eventlog for GHC ----------------------------- -To actually produce the eventlog, you need an eventlog-capable GHC build: - - With Hadrian: - $ hadrian/build -j "stage1.ghc-bin.ghc.link.opts += -eventlog" - - With Make: - $ make -j GhcStage2HcOpts+=-eventlog - -You can then produce an eventlog when compiling say hello.hs by simply -doing: +You can produce an eventlog when compiling, for instance, hello.hs by simply +running: If GHC was built by Hadrian: $ _build/stage1/bin/ghc -ddump-timings hello.hs -o hello +RTS -l |