Wen Kokke pushed to branch wip/fendor/full-eventlog-live at Glasgow Haskell Compiler / GHC

Commits:

11 changed files:

Changes:

  • .gitmodules
    ... ... @@ -122,3 +122,18 @@
    122 122
     [submodule "libraries/libffi-clib"]
    
    123 123
     	path = libraries/libffi-clib
    
    124 124
     	url = https://gitlab.haskell.org/ghc/libffi-clib.git
    
    125
    +[submodule "eventlog-socket"]
    
    126
    +	path = eventlog-socket
    
    127
    +	url = https://github.com/well-typed/eventlog-socket.git
    
    128
    +[submodule "ghc-stack-profiler"]
    
    129
    +	path = ghc-stack-profiler
    
    130
    +	url = https://github.com/well-typed/ghc-stack-profiler
    
    131
    +[submodule "libraries/async"]
    
    132
    +	path = libraries/async
    
    133
    +	url = https://github.com/fendor/async.git
    
    134
    +[submodule "libraries/unordered-containers"]
    
    135
    +	path = libraries/unordered-containers
    
    136
    +	url = https://github.com/fendor/unordered-containers.git
    
    137
    +[submodule "libraries/hashable"]
    
    138
    +	path = libraries/hashable
    
    139
    +	url = https://github.com/fendor/hashable

  • eventlog-socket
    1
    +Subproject commit 57ca65170bf6d264a284a047f3cb350d498fc256

  • ghc-stack-profiler
    1
    +Subproject commit 389d886a1494cd019ee93c72c8f19cf7f9dc1664

  • ghc/Main.hs
    ... ... @@ -93,6 +93,28 @@ import Data.List ( isPrefixOf, partition, intercalate )
    93 93
     import Prelude
    
    94 94
     import qualified Data.List.NonEmpty as NE
    
    95 95
     
    
    96
    +#if defined(EVENTLOG_SOCKET)
    
    97
    +import qualified GHC.Eventlog.Socket
    
    98
    +#endif
    
    99
    +
    
    100
    +#if defined(GHC_STACK_PROFILER)
    
    101
    +import qualified GHC.Stack.Profiler
    
    102
    +#endif
    
    103
    +
    
    104
    +startEventlogSocketFromEnv :: IO ()
    
    105
    +#if defined(EVENTLOG_SOCKET)
    
    106
    +startEventlogSocketFromEnv = GHC.Eventlog.Socket.startFromEnv
    
    107
    +#else
    
    108
    +startEventlogSocketFromEnv = pure ()
    
    109
    +#endif
    
    110
    +
    
    111
    +startGhcStackProfilerFromEnv :: IO ()
    
    112
    +#if defined(GHC_STACK_PROFILER)
    
    113
    +startGhcStackProfilerFromEnv = void GHC.Stack.Profiler.startProfilerFromEnv
    
    114
    +#else
    
    115
    +startGhcStackProfilerFromEnv = pure ()
    
    116
    +#endif
    
    117
    +
    
    96 118
     -----------------------------------------------------------------------------
    
    97 119
     -- ToDo:
    
    98 120
     
    
    ... ... @@ -107,6 +129,9 @@ import qualified Data.List.NonEmpty as NE
    107 129
     
    
    108 130
     main :: IO ()
    
    109 131
     main = do
    
    132
    +   startEventlogSocketFromEnv
    
    133
    +   startGhcStackProfilerFromEnv
    
    134
    +
    
    110 135
        hSetBuffering stdout LineBuffering
    
    111 136
        hSetBuffering stderr LineBuffering
    
    112 137
     
    

  • ghc/ghc-bin.cabal.in
    ... ... @@ -27,11 +27,21 @@ Flag interpreter
    27 27
         Default: False
    
    28 28
         Manual: True
    
    29 29
     
    
    30
    +Flag eventlog-socket
    
    31
    +    Description: Build with support for eventlog-socket
    
    32
    +    Default: False
    
    33
    +    Manual: True
    
    34
    +
    
    30 35
     Flag threaded
    
    31 36
         Description: Link the ghc executable against the threaded RTS
    
    32 37
         Default: True
    
    33 38
         Manual: True
    
    34 39
     
    
    40
    +Flag ghc-stack-profiler
    
    41
    +    Description: Build with support for ghc-stack-profiler
    
    42
    +    Default: False
    
    43
    +    Manual: True
    
    44
    +
    
    35 45
     Executable ghc
    
    36 46
         Default-Language: GHC2024
    
    37 47
     
    
    ... ... @@ -93,6 +103,14 @@ Executable ghc
    93 103
         if flag(threaded)
    
    94 104
           ghc-options: -threaded
    
    95 105
     
    
    106
    +    if flag(eventlog-socket)
    
    107
    +        build-depends: eventlog-socket
    
    108
    +        CPP-OPTIONS: -DEVENTLOG_SOCKET
    
    109
    +
    
    110
    +    if flag(ghc-stack-profiler)
    
    111
    +        build-depends: ghc-stack-profiler
    
    112
    +        CPP-OPTIONS: -DGHC_STACK_PROFILER
    
    113
    +
    
    96 114
         Other-Extensions:
    
    97 115
             CPP
    
    98 116
             NondecreasingIndentation
    

  • hadrian/src/Packages.hs
    ... ... @@ -12,7 +12,9 @@ module Packages (
    12 12
         runGhc, semaphoreCompat, stm, templateHaskell, thLift, thQuasiquoter, terminfo, text, time, timeout,
    
    13 13
         transformers, unlit, unix, win32, xhtml,
    
    14 14
         lintersCommon, lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace,
    
    15
    +    eventlogSocket, eventlogSocketControl,
    
    15 16
         ghcPackages, isGhcPackage,
    
    17
    +    async, hashable, unorderedContainers, ghc_stack_profiler, ghc_stack_profiler_core,
    
    16 18
     
    
    17 19
         -- * Package information
    
    18 20
         crossPrefix, programBasename, programName, nonHsMainPackage, programPath, timeoutPath,
    
    ... ... @@ -41,8 +43,11 @@ ghcPackages =
    41 43
         , parsec, pretty, process, rts, runGhc, stm, semaphoreCompat, templateHaskell, thLift, thQuasiquoter
    
    42 44
         , terminfo, text, time, transformers, unlit, unix, win32, xhtml, fileio
    
    43 45
         , timeout
    
    46
    +    , eventlogSocketControl, eventlogSocket
    
    44 47
         , lintersCommon
    
    45
    -    , lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace ]
    
    48
    +    , lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace
    
    49
    +    , async, hashable, unorderedContainers, ghc_stack_profiler_core, ghc_stack_profiler
    
    50
    +    ]
    
    46 51
     
    
    47 52
     -- TODO: Optimise by switching to sets of packages.
    
    48 53
     isGhcPackage :: Package -> Bool
    
    ... ... @@ -58,7 +63,8 @@ array, base, binary, bytestring, cabalSyntax, cabal, changelogD, checkPpr, check
    58 63
       osString, parsec, pretty, primitive, process, rts, runGhc, semaphoreCompat, stm, templateHaskell, thLift, thQuasiquoter,
    
    59 64
       terminfo, text, time, transformers, unlit, unix, win32, xhtml,
    
    60 65
       timeout,
    
    61
    -  lintersCommon, lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace
    
    66
    +  lintersCommon, lintNotes, lintCodes, lintCommitMsg, lintSubmoduleRefs, lintWhitespace,
    
    67
    +  eventlogSocket, eventlogSocketControl
    
    62 68
         :: Package
    
    63 69
     array               = lib  "array"
    
    64 70
     base                = lib  "base"
    
    ... ... @@ -134,6 +140,13 @@ unlit = util "unlit"
    134 140
     unix                = lib  "unix"
    
    135 141
     win32               = lib  "Win32"
    
    136 142
     xhtml               = lib  "xhtml"
    
    143
    +eventlogSocket      = lib "eventlog-socket" `setPath` "eventlog-socket/eventlog-socket"
    
    144
    +eventlogSocketControl = lib "eventlog-socket-control" `setPath` "eventlog-socket/eventlog-socket-control"
    
    145
    +async               = lib "async"
    
    146
    +hashable            = lib "hashable"
    
    147
    +unorderedContainers = lib "unordered-containers"
    
    148
    +ghc_stack_profiler = lib "ghc-stack-profiler" `setPath` "ghc-stack-profiler/ghc-stack-profiler"
    
    149
    +ghc_stack_profiler_core = lib "ghc-stack-profiler-core" `setPath` "ghc-stack-profiler/ghc-stack-profiler-core"
    
    137 150
     
    
    138 151
     lintersCommon       = lib     "linters-common"      `setPath` "linters/linters-common"
    
    139 152
     lintNotes           = linter  "lint-notes"
    

  • hadrian/src/Settings/Default.hs
    ... ... @@ -110,6 +110,8 @@ stage0Packages = do
    110 110
                  , thQuasiquoter -- new library not yet present for boot compilers
    
    111 111
                  , unlit
    
    112 112
                  , xhtml -- new version is not backwards compat with latest
    
    113
    +             , eventlogSocket
    
    114
    +             , eventlogSocketControl
    
    113 115
                  , if windowsHost then win32 else unix
    
    114 116
                  -- We must use the in-tree `Win32` as the version
    
    115 117
                  -- bundled with GHC 9.6 is too old for `semaphore-compat`.
    
    ... ... @@ -190,6 +192,11 @@ stagedPackages stage = do
    190 192
             , hpcBin
    
    191 193
             , if winTarget then win32 else unix
    
    192 194
             , runGhc
    
    195
    +        , ghc_stack_profiler
    
    196
    +        , ghc_stack_profiler_core
    
    197
    +        , async
    
    198
    +        , hashable
    
    199
    +        , unorderedContainers
    
    193 200
             ]
    
    194 201
           , when (winTarget && not cross)
    
    195 202
             [ -- See Note [Hadrian's ghci-wrapper package]
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -105,6 +105,22 @@ packageArgs = do
    105 105
     
    
    106 106
               , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ]
    
    107 107
     
    
    108
    +        , package ghc_stack_profiler ? mconcat
    
    109
    +          [ builder (Cabal Flags) ? mconcat
    
    110
    +            [ arg "-use-ghc-trace-events"
    
    111
    +            -- Add support for eventlog-socket commands
    
    112
    +            , arg "+control"
    
    113
    +            ]
    
    114
    +          ]
    
    115
    +
    
    116
    +        , package eventlogSocket ? mconcat
    
    117
    +          [ builder (Cabal Flags) ? mconcat
    
    118
    +            [
    
    119
    +            -- Add support for eventlog-socket commands
    
    120
    +              arg "+control"
    
    121
    +            ]
    
    122
    +          ]
    
    123
    +
    
    108 124
             ---------------------------------- ghc ---------------------------------
    
    109 125
             , package ghc ? mconcat
    
    110 126
               [ builder Ghc ? mconcat
    
    ... ... @@ -114,6 +130,8 @@ packageArgs = do
    114 130
               , builder (Cabal Flags) ? mconcat
    
    115 131
                 [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter"
    
    116 132
                 , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter"
    
    133
    +            , notStage0 `cabalFlag` "eventlog-socket"
    
    134
    +            , notStage0 `cabalFlag` "sampleTracer"
    
    117 135
                 , ifM stage0
    
    118 136
                       -- We build a threaded stage 1 if the bootstrapping compiler
    
    119 137
                       -- supports it.
    

  • libraries/async
    1
    +Subproject commit 474fc7f612b74e73e24e91474fa75af18eede7b7

  • libraries/hashable
    1
    +Subproject commit d56d62eb2a9ff4376e7119d925ececa60959d9ec

  • libraries/unordered-containers
    1
    +Subproject commit 368ea40488bf3c644e9c36d996302029fb0fc227