Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for GHC < 8 #89

Merged
merged 6 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.13.20211116
# version: 0.15.20220620
#
# REGENDATA ("0.13.20211116",["github","ghc-events.cabal"])
# REGENDATA ("0.15.20220620",["github","ghc-events.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -19,7 +19,7 @@ on:
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
timeout-minutes:
60
container:
Expand Down Expand Up @@ -68,11 +68,6 @@ jobs:
compilerVersion: 8.0.2
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.10.3
compilerKind: ghc
compilerVersion: 7.10.3
setup-method: hvr-ppa
allow-failure: false
fail-fast: false
steps:
- name: apt
Expand All @@ -81,18 +76,18 @@ jobs:
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
else
apt-add-repository -y 'ppa:hvr/ghc'
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
env:
HCKIND: ${{ matrix.compilerKind }}
Expand Down Expand Up @@ -235,7 +230,7 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
$CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
Expand Down
3 changes: 1 addition & 2 deletions ghc-events.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ author: Donnie Jones <[email protected]>,
maintainer: Simon Marlow <[email protected]>
bug-reports: https://github.com/haskell/ghc-events/issues
build-type: Simple
tested-with: GHC == 7.10.3
GHC == 8.0.2
tested-with: GHC == 8.0.2
GHC == 8.2.2
GHC == 8.4.4
GHC == 8.6.5
Expand Down
5 changes: 0 additions & 5 deletions include/EventLogFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,6 @@


/* DEPRECATED EVENTS: */
/* These two are deprecated because we don't need to record the thread, it's
implicit. We have to keep these #defines because for tiresome reasons we
still need to parse them, see GHC.RTS.Events.ghc6Parsers for details. */
#define EVENT_RUN_SPARK 5 /* (thread) */
#define EVENT_STEAL_SPARK 6 /* (thread, victim_cap) */
/* shutdown replaced by EVENT_CAP_DELETE */
#define EVENT_SHUTDOWN 7 /* () */
#if 0
Expand Down
162 changes: 2 additions & 160 deletions src/GHC/RTS/Events/Binary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ module GHC.RTS.Events.Binary
getHeader
, getEvent
, standardParsers
, ghc6Parsers
, ghc7Parsers
, mercuryParsers
, perfParsers
, heapProfParsers
, timeProfParsers
, pre77StopParsers
, ghc782StopParser
, post782StopParser
, parRTSParsers
, binaryEventParsers
, tickyParsers
Expand Down Expand Up @@ -127,10 +122,6 @@ standardParsers = [
}
)),

-- EVENT_SHUTDOWN is replaced by EVENT_CAP_DELETE and GHC 7.6+
-- no longer generate the event; should be removed at some point
(simpleEvent EVENT_SHUTDOWN Shutdown),

(simpleEvent EVENT_REQUEST_SEQ_GC RequestSeqGC),

(simpleEvent EVENT_REQUEST_PAR_GC RequestParGC),
Expand Down Expand Up @@ -357,12 +348,8 @@ standardParsers = [
nonmovingCensusFilledSegs <- get :: Get Word32
nonmovingCensusLiveBlocks <- get :: Get Word32
return NonmovingHeapCensus{..}
))
]
)),

-- Parsers valid for GHC7 but not GHC6.
ghc7Parsers :: [EventParser EventInfo]
ghc7Parsers = [
(FixedSizeParser EVENT_CREATE_THREAD sz_tid (do -- (thread)
t <- get
return CreateThread{thread=t}
Expand All @@ -384,20 +371,6 @@ ghc7Parsers = [
return MigrateThread{thread=t,newCap=fromIntegral nc}
)),

-- Yes, EVENT_RUN/STEAL_SPARK are deprecated, but see the explanation in the
-- 'ghc6Parsers' section below. Since we're parsing them anyway, we might
-- as well convert them to the new SparkRun/SparkSteal events.
(FixedSizeParser EVENT_RUN_SPARK sz_tid (do -- (thread)
_ <- get :: Get ThreadId
return SparkRun
)),

(FixedSizeParser EVENT_STEAL_SPARK (sz_tid + sz_cap) (do -- (thread, victimCap)
_ <- get :: Get ThreadId
vc <- get :: Get CapNo
return SparkSteal{victimCap=fromIntegral vc}
)),

(FixedSizeParser EVENT_CREATE_SPARK_THREAD sz_tid (do -- (sparkThread)
st <- get :: Get ThreadId
return CreateSparkThread{sparkThread=st}
Expand Down Expand Up @@ -452,66 +425,8 @@ ghc7Parsers = [
t <- get
oc <- get :: Get CapNo
return WakeupThread{thread=t,otherCap=fromIntegral oc}
))
]

-- special thread stop event parsers for GHC version 7.8.2
-- see [Stop status in GHC-7.8.2] in EventTypes.hs
ghc782StopParser :: EventParser EventInfo
ghc782StopParser =
(FixedSizeParser EVENT_STOP_THREAD (sz_tid + sz_th_stop_status + sz_tid) (do
-- (thread, status, info)
t <- get
s <- get :: Get RawThreadStopStatus
i <- get :: Get ThreadId
return StopThread{thread = t,
status = case () of
_ | s > maxThreadStopStatus782
-> NoStatus
| s == 9 {- XXX yeuch -}
-- GHC-7.8.2: 9 == BlockedOnBlackHole
-> BlockedOnBlackHoleOwnedBy i
| otherwise
-> mkStopStatus782 s}
))

-- parsers for GHC < 7.8.2. Older versions do not use block info
-- (different length). See [Stop status in GHC-7.8.2] in
-- EventTypes.hs
pre77StopParsers :: [EventParser EventInfo]
pre77StopParsers = [
(FixedSizeParser EVENT_STOP_THREAD (sz_tid + sz_th_stop_status) (do
-- (thread, status)
t <- get
s <- get :: Get RawThreadStopStatus
return StopThread{thread=t, status = if s > maxThreadStopStatusPre77
then NoStatus
else mkStopStatus s}
-- older version of the event, no block info
)),

(FixedSizeParser EVENT_STOP_THREAD (sz_tid + sz_th_stop_status + sz_tid)
(do
-- (thread, status, info)
t <- get
s <- get :: Get RawThreadStopStatus
i <- get :: Get ThreadId
return StopThread{thread = t,
status = case () of
_ | s > maxThreadStopStatusPre77
-> NoStatus
| s == 8 {- XXX yeuch -}
-- pre-7.7: 8==BlockedOnBlackhole
-> BlockedOnBlackHoleOwnedBy i
| otherwise
-> mkStopStatus s}
))
]

-- parsers for GHC >= 7.8.3, always using block info field parser.
-- See [Stop status in GHC-7.8.2] in EventTypes.hs
post782StopParser :: EventParser EventInfo
post782StopParser =
(FixedSizeParser EVENT_STOP_THREAD (sz_tid + sz_th_stop_status + sz_tid)
(do
-- (thread, status, info)
Expand All @@ -528,82 +443,9 @@ post782StopParser =
| otherwise
-> mkStopStatus s}
))

-----------------------
-- GHC 6.12 compat: GHC 6.12 reported the wrong sizes for some events,
-- so we have to recognise those wrong sizes here for backwards
-- compatibility.
ghc6Parsers :: [EventParser EventInfo]
ghc6Parsers = [
(FixedSizeParser EVENT_STARTUP 0 (do
-- BUG in GHC 6.12: the startup event was incorrectly
-- declared as size 0, so we accept it here.
c <- get :: Get CapNo
return Startup{ n_caps = fromIntegral c }
)),

(FixedSizeParser EVENT_CREATE_THREAD sz_old_tid (do -- (thread)
t <- get
return CreateThread{thread=t}
)),

(FixedSizeParser EVENT_RUN_THREAD sz_old_tid (do -- (thread)
t <- get
return RunThread{thread=t}
)),

(FixedSizeParser EVENT_STOP_THREAD (sz_old_tid + 2) (do -- (thread, status)
t <- get
s <- get :: Get RawThreadStopStatus
return StopThread{thread=t, status = if s > maxThreadStopStatusPre77
then NoStatus
else mkStopStatus s}
-- older version of the event uses pre-77 encoding
-- (actually, it only uses encodings 0 to 5)
-- see [Stop status in GHC-7.8.2] in EventTypes.hs
)),

(FixedSizeParser EVENT_THREAD_RUNNABLE sz_old_tid (do -- (thread)
t <- get
return ThreadRunnable{thread=t}
)),

(FixedSizeParser EVENT_MIGRATE_THREAD (sz_old_tid + sz_cap) (do -- (thread, newCap)
t <- get
nc <- get :: Get CapNo
return MigrateThread{thread=t,newCap=fromIntegral nc}
)),

-- Note: it is vital that these two (EVENT_RUN/STEAL_SPARK) remain here (at
-- least in the ghc6Parsers section) even though both events are deprecated.
-- The reason is that .eventlog files created by the buggy GHC-6.12
-- mis-declare the size of these two events. So we have to handle them
-- specially here otherwise we'll get the wrong size, leading to us getting
-- out of sync and eventual parse failure. Since we're parsing them anyway,
-- we might as well convert them to the new SparkRun/SparkSteal events.
(FixedSizeParser EVENT_RUN_SPARK sz_old_tid (do -- (thread)
_ <- get :: Get ThreadId
return SparkRun
)),

(FixedSizeParser EVENT_STEAL_SPARK (sz_old_tid + sz_cap) (do -- (thread, victimCap)
_ <- get :: Get ThreadId
vc <- get :: Get CapNo
return SparkSteal{victimCap=fromIntegral vc}
)),

(FixedSizeParser EVENT_CREATE_SPARK_THREAD sz_old_tid (do -- (sparkThread)
st <- get :: Get ThreadId
return CreateSparkThread{sparkThread=st}
)),

(FixedSizeParser EVENT_THREAD_WAKEUP (sz_old_tid + sz_cap) (do -- (thread, other_cap)
t <- get
oc <- get :: Get CapNo
return WakeupThread{thread=t,otherCap=fromIntegral oc}
))
]


-- Parsers for parallel events. Parameter is the thread_id size, to create
-- ghc6-parsers (using the wrong size) where necessary.
parRTSParsers :: EventTypeSize -> [EventParser EventInfo]
Expand Down
40 changes: 2 additions & 38 deletions src/GHC/RTS/Events/Incremental.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,45 +183,9 @@ mkEventDecoder :: Header -> G.Decoder (Maybe Event)
mkEventDecoder header = G.runGetIncremental $ getEvent parsers
where
imap = IM.fromList [(fromIntegral (num t), t) | t <- eventTypes header]
-- This test is complete, no-one has extended this event yet and all future
-- extensions will use newly allocated event IDs.
is_ghc_6 = Just sz_old_tid == do
create_et <- IM.lookup EVENT_CREATE_THREAD imap
size create_et
-- GHC6 writes an invalid header, we handle it here by using a
-- different set of event parsers. Note that the ghc7 event parsers
-- are standard events, and can be used by other runtime systems that
-- make use of threadscope.

-- GHC-7.8.2 uses a different thread block status encoding,
-- and therefore requires a different parser for the stop
-- event. Later, in GHC-7.8.3, the old encoding was restored.
-- GHC-7.8.2 can be recognised by presence and absence of
-- events in the header:
-- * User markers were added in GHC-7.8
-- * an empty event HACK_BUG_T9003 was added in GHC-7.8.3
-- This fix breaks software which uses ghc-events and combines
-- user markers with the older stop status encoding. We don't
-- know of any such software, though.
is_pre77 = IM.notMember EVENT_USER_MARKER imap
is_ghc782 = IM.member EVENT_USER_MARKER imap
&& IM.notMember EVENT_HACK_BUG_T9003 imap

stopParsers
| is_pre77 = pre77StopParsers
| is_ghc782 = [ghc782StopParser]
| otherwise = [post782StopParser]

event_parsers
| is_ghc_6 = concat
[ standardParsers
, ghc6Parsers
, parRTSParsers sz_old_tid
]
| otherwise = concat

event_parsers = concat
[ standardParsers
, ghc7Parsers
, stopParsers
, parRTSParsers sz_tid
, mercuryParsers
, perfParsers
Expand Down
Binary file removed test/782stop.eventlog
Binary file not shown.
Loading