summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-18 20:15:07 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-29 02:40:45 -0500
commit2e29edb7421c21902b47d130d45f60d3f584a0de (patch)
tree1b07c17f1c3a07fd84f6f421c836e29435e2bb15 /hadrian
parent6b0cea298f7ad222879fafd2905293ab939ff8b3 (diff)
downloadhaskell-2e29edb7421c21902b47d130d45f60d3f584a0de.tar.gz
rts: Refactor event types
Previously we would build the eventTypes array at runtime during RTS initialization. However, this is completely unnecessary; it is completely static data.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/Generate.hs11
-rw-r--r--hadrian/src/Rules/Register.hs2
2 files changed, 13 insertions, 0 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 19ff80f6ea..32a9248eff 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -43,6 +43,8 @@ rtsDependencies = do
let headers =
[ "ghcautoconf.h", "ghcplatform.h"
, "DerivedConstants.h"
+ , "rts" -/- "EventTypes.h"
+ , "rts" -/- "EventLogConstants.h"
]
++ libffiHeaderFiles
pure $ ((rtsPath -/- "include") -/-) <$> headers
@@ -133,6 +135,15 @@ generatePackageCode context@(Context stage pkg _) = do
root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> go generateGhcAutoconfH
root -/- "**" -/- dir -/- "include/ghcplatform.h" %> go generateGhcPlatformH
root -/- "**" -/- dir -/- "include/DerivedConstants.h" %> genPlatformConstantsHeader context
+ root -/- "**" -/- dir -/- "include/rts/EventLogConstants.h" %> genEventTypes "--event-types-defines"
+ root -/- "**" -/- dir -/- "include/rts/EventTypes.h" %> genEventTypes "--event-types-array"
+
+genEventTypes :: String -> FilePath -> Action ()
+genEventTypes flag file = do
+ need ["rts" -/- "gen_event_types.py"]
+ runBuilder Python
+ ["rts" -/- "gen_event_types.py", flag, file]
+ [] []
genPrimopCode :: Context -> FilePath -> Action ()
genPrimopCode context@(Context stage _pkg _) file = do
diff --git a/hadrian/src/Rules/Register.hs b/hadrian/src/Rules/Register.hs
index 89c0cadd84..c2091e0fda 100644
--- a/hadrian/src/Rules/Register.hs
+++ b/hadrian/src/Rules/Register.hs
@@ -128,6 +128,8 @@ buildConf _ context@Context {..} _conf = do
need [ path -/- "include/DerivedConstants.h"
, path -/- "include/ghcautoconf.h"
, path -/- "include/ghcplatform.h"
+ , path -/- "include/rts/EventLogConstants.h"
+ , path -/- "include/rts/EventTypes.h"
]
-- we need to generate this file for GMP