[Git][ghc/ghc][wip/dcoutts/posix-time] 48 commits: testsuite: add tests for the IO manager lock-up of #21969
by Duncan Coutts (@dcoutts) 12 Nov '26
by Duncan Coutts (@dcoutts) 12 Nov '26
12 Nov '26
Duncan Coutts pushed to branch wip/dcoutts/posix-time at Glasgow Haskell Compiler / GHC
Commits:
0423f413 by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
testsuite: add tests for the IO manager lock-up of #21969
T21969a 'closeFdWith' takes every 'EventManager''s 'callbackTableVar'
inside 'uninterruptibleMask_' and only puts them back on the paths
that do not throw, so a throw from 'closeFd_' leaves those MVars
empty for good. Afterwards every 'threadWaitRead' and
'closeFdWith' on an fd in the same bucket blocks forever.
T21969b 'closeFdWith' runs the fd's callbacks while asynchronous exceptions
are uninterruptibly masked, so a callback that blocks makes the
thread calling it permanently unkillable.
T21969c 'closeFd_' drops the registrations before telling the backend to
forget the fd, so when the backend throws the fd is never closed
and the threads waiting on it are never woken.
T21969d the cleanup handler of 'threadWait' calls 'unregisterFd_', which
throws on backend errors. It runs inside the handler for the
asynchronous exception being delivered, so its exception replaces
that one: 'killThread' returns but 'ThreadKilled' never arrives.
T21969e an exception from re-arming an fd escapes the poll loop, and 'loop'
turns it into 'cleanup mgr': the 'EventManager' of that capability
is shut down and every thread using it is left blocked. This is
the lock-up of #21969 itself.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
5c197e2e by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
Make the IO manager cope with errors from the polling backend (#21969)
Three changes in 'GHC.Internal.Event.Thread': 'closeFdWith' puts every
'callbackTableVar' back on the paths that throw too and no longer skips the
callbacks when 'close' fails, those callbacks now run under the 'mask_' of
'close_loop' rather than uninterruptibly masked, and the cleanup of
'threadWait' ignores a failure from 'unregisterFd_'.
This fixes T21969a, T21969b and T21969d, and clears their expect_broken.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
cb765ded by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
Do not let backend errors abandon the close of a file descriptor (#21969)
'closeFd_' and 'closeFd' now ignore errors from telling the backend to forget
the fd: the registration is being torn down and the error says it is already
gone. 'registerFd_' still reports them (!10643), where the caller has to
learn that the registration did not happen. Both also test
'I.elEvent oldEls /= mempty' rather than 'oldEls /= mempty'.
This fixes T21969c, and clears its expect_broken.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
9073bc43 by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
Do not let a backend error take down a capability's IO manager (#21969)
A failure to re-arm an fd in 'selectCallbacks' is now handled the way
'registerFd_' handles one (!10643): the registrations are taken back out of
the callback table and returned, so their callbacks run and the waiting
threads find out for themselves instead of hanging. Checked on aarch64 Linux
(epoll) and aarch64 macOS (kqueue), 10 runs each way.
This fixes T21969e, and clears its expect_broken.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
cdff4e76 by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
Do not let the deregistration of threadWaitSTM throw either (#21969)
'threadWaitReadSTM' and 'threadWaitWriteSTM' return the action that gives up
interest in the fd as the second component of their pair, and it was
return (waitAction, unregisterFd_ mgr reg >> return ())
'unregisterFd_' talks to the polling backend, which throws on errors such as
ENOENT and EBADF -- which is how a backend reports an fd it no longer knows,
once that fd has been closed without going through 'closeFdWith'.
That is the same shape as the cleanup of 'threadWait', which the rest of this
series made quiet, and it is the same on both counts. There is nothing to
decide: the registration is being abandoned, and "the backend does not know
this fd" is the state the action is trying to reach. And it does harm: the
action is what a caller uses from the cleanup of a 'bracket', where an
exception out of it replaces whatever was being propagated.
It now goes through 'quietUnregisterFd', as the cleanup of 'threadWait' does,
and that function's comment covers both callers.
T21969f covers it, and is deterministic on both backends: dropping the only
registration changes the event set, so 'unregisterFd_' always reaches the
backend.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
a7ed305b by Kazu Yamamoto at 2026-11-07T08:06:59+09:00
testsuite: let T21969 run on FreeBSD, and unmark it (#21969, #25512)
T21969 now carries the descriptor from 'createPipe' instead of recovering it
with 'handleToFd', which rejects the 'DuplexHandle' that FreeBSD's
bidirectional pipes become and killed the test in setup there (#25512). The
expect_broken goes with it: with the descriptor problem out of the way the
test times out on master, so it can only be unmarked on top of this series.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
3074ae61 by Sylvain Henry at 2026-11-08T10:21:50-05:00
rts: heap census counts every small pinned object
Blocks of small pinned objects carry BF_LARGE as well as BF_PINNED but
hold many objects. heapCensusChain treated every BF_LARGE block whose
first object is an ARR_WORDS as holding that single object, a workaround
for the slop left by shrinkMutableByteArray# (#11627). So every heap
profile mode under-reported pinned byte arrays, i.e. ByteString payloads.
Shrinking now writes a slop marker that skipSlop understands (#19048,
#27585), so the block walk is safe for large and pinned blocks alike.
The block that a capability fills with small pinned objects stays
attached to the capability until it is full (see allocatePinned), so it
is on no generation list and the census never saw its objects. heapCensus
now walks cap->pinned_object_block too.
A pinned block is kept or freed as a whole (#28005), so dead pinned
objects are counted until their block is freed. T7275 gains one sample in
which its dead small arrays still show. The user guide and changelog
document this.
T7257 retains most of its pinned blocks and takes a census at every GC
(+RTS -i0 -hT), so walking every pinned object made it 7x slower and it
hit the CI timeout. It now runs 1000000 iterations instead of 5000000.
Metric Decrease:
T7257
Fixes #28000
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
16fd075a by Sylvain Henry at 2026-11-08T10:22:39-05:00
rts: fix GC CPU time accounting with idle GC threads (#26169)
stat_endGC summed gc_end_cpu - gc_start_cpu over every GC thread, but
only the threads that take part in a collection set these fields, and
new_gc_thread did not initialise them. With -qn below the capability
count, the first collection after setNumCapabilities added garbage to
the GC CPU time.
Let each participating thread add its own CPU time to an accumulator
in stat_endGCWorker, and let stat_endGC take the total. This removes
the loop over gc_threads, the reset from #21082 and the gc_end_cpu
field. Also drop the unused gc_end_elapsed field.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
0ef732e2 by Sylvain Henry at 2026-11-08T10:23:30-05:00
Serialized: encode numbers with LEB128
serializeWithData used the Binary instances of Data.Binary for the
numbers in a ConstrRep. They have a fixed width: 8 bytes for the
constructor index (an Int) and 5 bytes for a small Integer. Each
element of a [Int] cost 15 bytes.
Now the constructor representation is one unsigned LEB128 number that
also contains the index of an algebraic constructor, and the payloads
(Integer, Rational, Char) are LEB128 encoded. Most constructors take
one byte, and small numbers two. See Note [Serialized encoding].
Sizes measured by the T16841 test:
[1..100] :: [Int] 1509 -> 338 bytes
"helloworld" 119 -> 31 bytes
2^100 :: Integer 24 -> 16 bytes
Just True 18 -> 2 bytes
3.25 :: Double 11 -> 3 bytes
42 :: Int 6 -> 2 bytes
A new test, SerializedRoundTrip, round-trips values at the boundaries
of the encoding (negative numbers, big Integers, Rationals, Chars).
Follow-up to !16841 (#28002).
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
22344fbc by Sylvain Henry at 2026-11-08T10:24:21-05:00
docs: fix duplicate label in qualified_strings.rst
The file started with the label "multiline-strings", copied from
multiline_strings.rst. Sphinx warned about the duplicate label on every
build. Use the label "qualified-strings" instead.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
b7022624 by Alan Zimmerman at 2026-11-08T10:25:02-05:00
EPA: Use LHsLocalBinds instead of HsLocalBinds
This reverses an earlier change, and brings processing of local binds
into alignement with the exact printing principle that the LocatedA
contents provide the location and extent of the enclosed item,
together with any comments or context-specific trailing items like
commas or semi colons.
The internal TTG extension points only carry exact print annotations
related to printing the item within its bounds.
This change brings back the problem of EmptyLocalBinds, which by
definition cannot have a location. These get a noSrcSpan location,
which is ignored in the exact printing process.
- - - - -
bc2fae45 by Rodrigo Mesquita at 2026-11-08T18:37:40-05:00
Build EvalOpts once per exec rather than per breakpoint stop
We were unnecessarily constructing `eval_opts` in `handleRunStatus`
(which is run many times in a loop until we hit a breakpoint we care
about, e.g. when :steplocal), despite the `eval_opts` being constant
across all these runs.
So, construct `eval_opts` outside `handleRunStatus` and share the value
in all loop calls. The loop always uses the same eval_opts, so no point
in constructing them inside `handleRunStatus` from scratch every time.
I found out about the significance of this re-construction of `EvalOpts`
when I added a record update of `eval_opts` *after* the construction
from scratch inside `handleRunStatus` that regressed allocations
significantly.
This improves the performance of `interpreter_steplocal` on my machine:
Baseline
Test Metric value New value Change
-------------------------------------------------------------------------
interpreter_steplocal(ghci) ghc/alloc 459,845,696 449,843,480 -2.2%
Fixes #28068
- - - - -
ba579288 by Rodrigo Mesquita at 2026-11-08T18:38:21-05:00
refactor: move and order helper functions in GHCi.Run
A small refactor to the order of top-level functions in GHCi.Run
- - - - -
24927752 by Luite Stegeman at 2026-11-09T09:21:24-05:00
rts: add missing nonmoving write barrier in out-of-line array copies
The out-of-line entries stg_copyArrayzh/stg_copyMutableArrayzh (taken
whenever the element count of copyArray#/copyMutableArray# is not a
compile-time constant) didn't push the overwritten elements to the
nonmoving collector's remembered set.
Fixes #27376
- - - - -
6dbcca65 by Rodrigo Mesquita at 2026-11-09T09:22:06-05:00
interp: Set per-thread break flags consistently on eval/resume
Currently, the per-thread flags are:
- Single-step: Stop at the immediate next breakpoint in this thread
- Step-out: Stop at the next continuation with a breakpoint this thread
returns to.
- Break-on-exception: Stop the next time a synchronous exception is
raised in this thread.
Originally, these flags were all set globally across all threads. More
recently, these flags are set per-thread when `resume`ing that thread,
but globally when starting the evaluation of a new expression
(`evalStmt`).
With this commit, we now use per-TSO flags in both scenarios evaluating
expressions in the interpreter (`evalStmt` and `resumeStmt`).
- In `resumeStmt` we set the `EvalOpts` specifically in the `ThreadId`
being resumed.
- In `evalStmt`, we set the `EvalOpts` exclusively on the sandbox thread
we fork to evaluate the given expression
- When not using the sandbox thread (i.e. -fno-ghci-sandbox), we
don't support the debugger anyway, so the break flags are
irrelevant.
We do this by consistently calling `setBreakFlags` when starting,
resuming, or killing the evaluation.
See Note [Always setBreakFlags on running thread].
This slightly changes the behavior of evaluating a new expression in
the debugger (resuming a thread behaves the same as before). Namely,
`:step <expr>`, where <expr> forks a thread, will stop at the immediate
next breakpoint in the <expr> main thread, not on a breakpoint of any
forked thread.
NB: the forked thread may still stop at breakpoint, if it is enabled by
index specifically, and then :step-ing from that thread's breakpoint
will toggle per-thread stepping for that forked thread.
We will want to control stepping in "all threads, regardless of whether
we control them or if they were spawned by the debuggee" separately from
the commands which trigger evaluation of just an expression. Namely,
we'll likely want a "break at the next immediate breakpoint hit on ANY
thread" command that the user can execute before launching a debuggee
which is multi-threaded. This may even be the default for GHCi.
Towards #26064
Fixes #28080
- - - - -
19ff36f2 by Simon Jakobi at 2026-11-09T09:22:47-05:00
testsuite: Mark T8209 fragile for the ghci ways on FreeBSD and darwin
A shutdown race in the I/O manager intermittently fails T8209(ghci) on
x86_64-freebsd14-validate and aarch64-darwin-validate, recently killing
several Marge batches. Mark it fragile there until the race is fixed.
See #27948.
Assisted-by: Claude Opus 5.5
- - - - -
212c292f by Rajkumar Natarajan at 2026-11-11T13:54:08-05:00
document what ->>> stands for in heap profile
updates the profiling section of the user's guide to explain how types
are approximated when using -hy. Also adds haddocks to getTyDescription
with the same information.
Fixes #26754
- - - - -
c64fc319 by Jonathan at 2026-11-11T13:54:55-05:00
Fix AArch64 veneer target for relocations with an addend
Fixes #27807
The RTS linker would construct invalid relocation veneers on AArch64 if
the addend was non-zero, which typically caused SIGILL crashes. This
could be triggered by evaluating Template Haskell in a package with a
large number of dependencies using a static build of GHC.
- - - - -
cd4dce19 by Kazu Yamamoto at 2026-11-11T13:55:45-05:00
testsuite: add a test for registerFd_ trusting the callback table (#27821)
registerFd001 shows a 'threadWaitRead' that never finishes after an fd is
closed with 'closeFd' rather than 'closeFdWith'. Darwin is the only platform
this reaches -- one-shot registrations are implemented but not used there
(#7651) -- so the test is expect_broken on Darwin only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
5ab442ee by Kazu Yamamoto at 2026-11-11T13:55:45-05:00
registerFd_: always tell the polling backend (#27821)
Where the backend has no one-shot registrations, 'registerFd_' now tells it
about every registration, rather than only when the events differ from the
ones the callback table records: the table alone cannot say whether the
backend still knows the fd. The 'modify' it returns is unchanged. See Note
[Do not trust the callback table].
This fixes registerFd001 and clears its expect_broken.
Changelog wording from Duncan Coutts in review.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
ab8b5b06 by Vladislav Zavialov at 2026-11-11T13:56:27-05:00
Curried contexts in prefix GADT constructors (#27424)
Prefix GADT constructor declarations now accept multiple consecutive
contexts, equivalent to a single conjoined context:
data G a where
MkCurried :: C a => (D a, E a) => G a
MkConjoined :: (C a, D a, E a) => G a
This is a step towards GHC Proposal #402 "Stable GADT constructor syntax".
To represent multiple contexts, the `con_mb_cxt` field of `ConDeclGADT` has
been replaced by `con_cxts`, which stores a list instead of a Maybe:
- con_mb_cxt :: Maybe (LHsContext pass)
+ con_cxts :: [LHsContext pass]
The rest of this patch follows from this change.
Note that in ConDeclH98, the optional context is still stored as a Maybe.
To accommodate this difference, a few helper functions were generalised over
a Foldable container `t`:
hsConDeclTheta :: Foldable t => t (LHsContext ...) -> [LHsType ...]
pprLHsContext :: (Foldable t, ...) => t (LHsContext ...) -> SDoc
repContexts :: Foldable t => t (LHsContext GhcRn) -> MetaM (Core (M TH.Cxt))
tcHsContext :: Foldable t => t (LHsContext GhcRn) -> TcM [PredType]
In practice, the instantiations of `t` are either `Maybe` or `[]`.
Record-style GADT constructors continue to accept at most one context.
`splitLHsGadtTy` accounts for this by splitting off only the first context
if it detects record syntax, leaving the offending part of the type in the
body for the renamer to reject later on.
Test cases: T12087a T27424a T27424b T27424c T27424d GadtConSigs_th_dump1
- - - - -
d2f135ff by Sylvain Henry at 2026-11-11T13:57:22-05:00
NCG: cache register usage in liveness annotations
regUsageOfInstr allocates fresh register lists on every call, and on the
linear allocator path it was called three times per instruction: in the
backward liveness pass, in the forward liveness pass and in the allocator
itself. Store the usage computed by the backward pass in the Liveness
annotation and reuse it in the other passes (and in the graph allocator's
spill passes). patchRegsLiveInstr recomputes it for the patched
instruction.
See Note [Cached register usage in liveness annotations].
Part of #28008.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
ff0a5d32 by Sylvain Henry at 2026-11-11T13:57:22-05:00
NCG: describe register usage with a small DSL
This new register usage DSL (see Note [Register usage DSL] in
GHC.CmmToAsm.RegUsage) reduces allocation compared to the previous
list-based approach.
Fixes #28008.
Metric Decrease:
ManyAlternatives
T12707
T13035
T13379
T13960
T18698b
T19695
T21839c
T3064
T3294
T4801
T5321FD
T5321Fun
T783
T9198
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
51f38f3a by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock-library: fix the build of the spec and fixtures test suites
The documentation pipeline moved from String to Text (commit 202ed264141)
but the two test suites of haddock-library were left behind and no
longer compiled. They are not run by GHC's CI (see #16206), so this went
unnoticed.
The fixtures suite still has four pre-existing failures (list-blocks1,
table1, table4, table5) that are not addressed here.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
394d9d6d by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock: parse backtick spans as monospaced text
A backtick span whose content is not a valid Haskell identifier, such as
`foo bar`, was rendered as plain text with literal backticks. It is now
parsed as monospaced text, like @foo bar@. A closed backtick span whose
whole content is one identifier keeps its meaning as a hyperlinked
identifier. A span such as `foldl' f z xs` is code: it is no longer read
as the identifier foldl between a backtick and a single quote. The
TeX-style form `foo' stays an identifier when no backtick closes the
span on the same line.
Code spans follow the CommonMark rules: a span opened by a run of N
backticks ends at the next run of exactly N backticks on the same line,
so ``x `plus` y`` is code "x `plus` y". One space is removed at each end
when both are present, and an unclosed opening run is plain text. The
content is literal: no markup is parsed and backslashes are kept, so
`\x -> x` renders as written.
See Note [Backtick code spans] in Documentation.Haddock.Parser.
Fixes #28090
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
7ae41c37 by Sylvain Henry at 2026-11-11T13:58:14-05:00
Use 'T' instead of `T' in Haddock comments next to backtick spans
With backtick code spans, a TeX-style quote `T' followed by a backtick on
the same line opens a code span up to that backtick. Use the 'T' form in
the Haddock comments where this happens.
See Note [Backtick code spans] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
ce96f0b6 by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock: do not parse backtick spans inside @...@
Text between @...@ is already code, so backtick code spans are no longer
parsed there. Thus in
@x <- f -- of type `M Bool`@
the backticks stay as text. Inline markup inside @...@, such as /.../,
passes this context down.
See Note [Backticks in code] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
744b3036 by Sylvain Henry at 2026-11-11T13:58:15-05:00
haddock: keep the backticks of infix identifiers inside @...@
A backticked identifier inside @...@ was always rendered without its
backticks, so @f `elem` xs@ rendered as "f elem xs". Now an identifier
in an infix application or an operator section, such as @f `elem` xs@
or @(`elem` xs)@, is parsed in infix form, as if written ``elem``, and
renders with its backticks and with elem linked. Elsewhere, as in
@`foldlM` :: ...@, the backticks still only mark the link.
See Note [Backticks in code] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
0d8e1f8d by Sylvain Henry at 2026-11-11T13:59:05-05:00
PPC NCG: print non-standard NaN literals in target byte order
The PowerPC NCG printed a non-standard NaN literal byte by byte with
floatToBytes/doubleToBytes, which use the byte order of the host. This
is wrong when the host and the target have a different endianness (e.g.
from x86_64 to big-endian PowerPC). Print the bits with `.long`/`.quad`
instead, so that the assembler uses the target byte order.
Also make `ppr_item` print its argument: some clauses printed the
literal of `pprDataItem` instead.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
5a9db1ed by Sylvain Henry at 2026-11-11T13:59:05-05:00
Print all NaN literals as integer bits (#28101)
The x86 and PowerPC NCGs printed the quiet NaNs 0x7fc00000 and
0x7ff8000000000000 as `.float NaN`/`.double NaN`. GNU as and clang
encode these with all mantissa bits set, so constant-folded bit casts
of these values gave 0x7fffffff/0x7fffffffffffffff. The C backend
printed every NaN as `NAN`, losing its sign and payload.
Now the NCGs print all NaNs with `.long`/`.quad` and the C backend with
hs_bitcastword2float/hs_bitcastword642double.
See Note [Printing NaN literals].
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
b4ceb6a9 by mangoiv at 2026-11-11T13:59:47-05:00
ci: fix ghcup nightly script misbehaviour
- download all jobs instead of just the first 100
- stop using a canary job to detect whether it's a nightly or release
pipeline
- - - - -
aefa0c1b by Alan Zimmerman at 2026-11-11T14:00:28-05:00
EPA: Use AnnList in HsMultiIf
It introduces layout, capture it
- - - - -
23c0aec5 by Duncan Coutts at 2026-11-12T20:28:58+00:00
Make clock_gettime required on posix platforms
It was defined in POSIX.1-2001 and has been manditory since
POSIX.1-2008. We will rely on CLOCK_MONOTONIC for the RTS-internal
monotonic time source.
On macOS it has been available since 10.12 released in 2016 (and EOL
2019). We already have 11.0 as our minimum version for which we build
binaries (MACOSX_DEPLOYMENT_TARGET=11.0).
Also we must now drop the workaround from #12858 that would make the CI
configuration invoke configure in a way that would always fail to detect
clock_gettime (since obviously now we must detect it). Re-generate the
gitlab jobs files for the benefit of CI.
- - - - -
cfa80fbe by Duncan Coutts at 2026-11-12T20:28:59+00:00
Simplify time code based on assuming defined(HAVE_CLOCK_GETTIME)
No need to fall back to gettimeofday or times
- - - - -
99765a6d by Duncan Coutts at 2026-11-12T20:28:59+00:00
Use clock_gettime CLOCK_REALTIME for getUnixEpochTime
- - - - -
5b4e7452 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Simplify getCurrentThreadCPUTime to use clock_gettime
except on Solaris where it doesn't work.
In particular, this means we now use it on macOS. It apparently works
there from 10.12 onwards.
We drop the check for clock_getcpuclockid which is linux-specific,
archaic, and in any case isn't necessarily fatal.
- - - - -
af0b550a by Duncan Coutts at 2026-11-12T20:28:59+00:00
Remove now-redundant darwin time code
- - - - -
d1ef2c35 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Simplify getProcessCPUTime to use clock_gettime CLOCK_PROCESS_CPUTIME_ID
It would be nice to check during startup using sysconf that this is
really available. Unfortunately this doesn't actually work on macOS: it
reports via sysconf that it is not available, when actually it is.
Great.
- - - - -
17f0f1e5 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Tidy up GetTime.c headers and Clock.h
No longer need to define CLOCK_ID. Do the same for HsBase.h, where
CLOCK_ID does not appear to be used at all.
- - - - -
4812c994 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Remove posix/Clock.h entirely
Not needed.
- - - - -
48c5a200 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Split getPageFaults out into OSStats.{h,c}
Strictly speaking it never had any business living with the time
functions. It was merely convenience. Moving it out allows the remainder
to use PosixSource.h (at least on posix).
- - - - -
bc394951 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Move getProcessTimes to its only use site
Historically getProcessTimes made sense, since the main way to get the
elapsed time would also get the cpu time as well. After recent time code
simplification on posix then in all platforms it is just the pair of
getProcessCPUTime and getProcessElapsedTime separarely. So we can remove
three identical implementations and move it to be a local function in
Stats.c where it is used.
- - - - -
f770746c by Duncan Coutts at 2026-11-12T20:28:59+00:00
Improve win32 implementation of getMonotonicNSec
We don't need the fallback GetTickCount method.
Fixes #14233
- - - - -
ac939c49 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Improve win32 implementation of getUnixEpochTime
We can now use GetSystemTimePreciseAsFileTime, which is supported from
Windows 8 onwards. This is the recommendation from MS.
- - - - -
bc471f90 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Remove initializeTimer
It is now a no-op on all platforms.
- - - - -
85ace935 by Duncan Coutts at 2026-11-12T20:28:59+00:00
Remove unused rtsSleep utility
- - - - -
82f7c16a by Duncan Coutts at 2026-11-12T20:28:59+00:00
Make the "get the time" functions more consistent
We had:
Time getProcessElapsedTime(void); // pulbic
StgWord64 getMonotonicNSec(void); // public
void getUnixEpochTime(StgWord64 *sec, StgWord32 *nsec); // internal
These don't follow any naming convention, nor any common type
convention.
Now we have:
Time getMonotonicTime(void); // internal
Time getWallClockTime(void); // internal
StgWord64 getMonotonicNSec(void); // public compat alias
Time getProcessElapsedTime(void); // public compat alias
Now the two main ones use a common representation: Time which is int64_t
nanoseconds since the epoch. And their names better reflect that they
use different clocks: a monotonic clock, or a real time / wall clock.
We keep getMonotonicNSec and getProcessElapsedTime as aliases for
getMonotonicTime(). They are still used in ghc-internal.
Future directions: export the new ones from ghc-internal and base, and
provide clock precision functions. Provide more clocks, like coarse
ones: faster but less precise.
- - - - -
b1e9cb81 by Duncan Coutts at 2026-11-12T21:39:42+00:00
Add a changelog entry for the clock_gettime changes
- - - - -
215 changed files:
- .gitlab-ci.yml
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- + changelog.d/21969
- + changelog.d/26169.md
- + changelog.d/27821
- + changelog.d/28002-leb128
- + changelog.d/28080
- + changelog.d/28101
- + changelog.d/T26754
- changelog.d/allow-gadt-prefix-con-parens
- + changelog.d/clock_gettime
- + changelog.d/fix-aarch64-veneer-target-16686
- + changelog.d/fix-copyarray-nonmoving-barrier-27376
- + changelog.d/fix-heap-census-pinned-blocks.md
- + changelog.d/gadt-curried-contexts-27424
- + changelog.d/ncg-reg-usage.md
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/LA64/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/RV64/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- + compiler/GHC/CmmToAsm/RegUsage.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Expr.hs-boot
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/Tc/Deriv/Functor.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Literal/Floating.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- compiler/Language/Haskell/Syntax/Type.hs
- compiler/ghc.cabal.in
- docs/users_guide/exts/gadt_syntax.rst
- docs/users_guide/exts/qualified_strings.rst
- docs/users_guide/profiling.rst
- ghc/GHCi/UI.hs
- libraries/base/src/Data/Foldable.hs
- libraries/ghc-boot/GHC/Serialized.hs
- libraries/ghc-internal/include/HsBase.h
- libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Manager.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Thread.hs
- libraries/ghci/GHCi/Run.hs
- + rts/GetTime.c
- rts/GetTime.h
- rts/posix/Clock.h → rts/OSStats.h
- rts/PrimOps.cmm
- rts/ProfHeap.c
- rts/RtsStartup.c
- rts/RtsUtils.c
- rts/Stats.c
- rts/Stats.h
- rts/configure.ac
- rts/eventlog/EventLog.c
- rts/include/Cmm.h
- rts/include/rts/GetTime.h
- rts/include/rts/Time.h
- rts/linker/elf_reloc_aarch64.c
- rts/posix/GetTime.c
- + rts/posix/OSStats.c
- rts/posix/Poll.c
- rts/posix/Select.c
- rts/posix/SelectBis.c
- rts/posix/Ticker.c
- rts/posix/Timeout.c
- rts/rts.cabal
- rts/sm/GC.c
- rts/sm/GCThread.h
- rts/sm/NonMovingMark.c
- rts/wasm/GetTime.c
- + rts/wasm/OSStats.c
- rts/win32/GetTime.c
- + rts/win32/OSStats.c
- + testsuite/tests/annotations/should_run/SerializedRoundTrip.hs
- + testsuite/tests/annotations/should_run/SerializedRoundTrip.stdout
- + testsuite/tests/annotations/should_run/SerializedRoundTrip.stdout-ws-32
- testsuite/tests/annotations/should_run/T16841.stdout
- testsuite/tests/annotations/should_run/all.T
- + testsuite/tests/cmm/should_run/T28101.hs
- + testsuite/tests/cmm/should_run/T28101.stdout
- + testsuite/tests/cmm/should_run/T28101_cmm.cmm
- testsuite/tests/cmm/should_run/all.T
- testsuite/tests/concurrent/should_run/T21969.hs
- + testsuite/tests/concurrent/should_run/T21969a.hs
- + testsuite/tests/concurrent/should_run/T21969a.stdout
- + testsuite/tests/concurrent/should_run/T21969b.hs
- + testsuite/tests/concurrent/should_run/T21969b.stdout
- + testsuite/tests/concurrent/should_run/T21969c.hs
- + testsuite/tests/concurrent/should_run/T21969c.stdout
- + testsuite/tests/concurrent/should_run/T21969d.hs
- + testsuite/tests/concurrent/should_run/T21969d.stdout
- + testsuite/tests/concurrent/should_run/T21969e.hs
- + testsuite/tests/concurrent/should_run/T21969e.stdout
- + testsuite/tests/concurrent/should_run/T21969f.hs
- + testsuite/tests/concurrent/should_run/T21969f.stdout
- testsuite/tests/concurrent/should_run/all.T
- + testsuite/tests/concurrent/should_run/registerFd001.hs
- + testsuite/tests/concurrent/should_run/registerFd001.stdout
- − testsuite/tests/gadt/T12087.stderr
- + testsuite/tests/gadt/T12087a.hs
- testsuite/tests/gadt/T12087.hs → testsuite/tests/gadt/T12087b.hs
- + testsuite/tests/gadt/T12087b.stderr
- + testsuite/tests/gadt/T27424a.hs
- + testsuite/tests/gadt/T27424b.hs
- + testsuite/tests/gadt/T27424b.stderr
- testsuite/tests/gadt/all.T
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/ghci.debugger/scripts/all.T
- + testsuite/tests/ghci.debugger/scripts/break037.hs
- + testsuite/tests/ghci.debugger/scripts/break037.script
- + testsuite/tests/ghci.debugger/scripts/break037.stdout
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/perf/compiler/hard_hole_fits.stderr
- testsuite/tests/perf/should_run/T7257.hs
- testsuite/tests/perf/should_run/T7257.stdout
- testsuite/tests/printer/Makefile
- testsuite/tests/printer/T18791.stderr
- + testsuite/tests/printer/T27424c.hs
- testsuite/tests/printer/Test20297.hs
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- testsuite/tests/printer/all.T
- testsuite/tests/profiling/should_run/T7275.stdout
- testsuite/tests/rts/Makefile
- + testsuite/tests/rts/T26169.hs
- + testsuite/tests/rts/T27376.hs
- + testsuite/tests/rts/T27376.stdout
- testsuite/tests/rts/TimeoutQueue.c
- testsuite/tests/rts/all.T
- + testsuite/tests/rts/census_pinned.hs
- + testsuite/tests/rts/census_pinned.stdout-ws-32
- + testsuite/tests/rts/census_pinned.stdout-ws-64
- + testsuite/tests/rts/census_pinned.stdout-ws-64-mingw32
- testsuite/tests/rts/linker/Makefile
- + testsuite/tests/rts/linker/T27807.s
- + testsuite/tests/rts/linker/T27807.stdout
- testsuite/tests/rts/linker/all.T
- testsuite/tests/th/GadtConSigs_th_dump1.hs
- testsuite/tests/th/GadtConSigs_th_dump1.stderr
- + testsuite/tests/th/T27424d.hs
- + testsuite/tests/th/T27424d.stderr
- testsuite/tests/th/all.T
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/haddock/CHANGES.md
- utils/haddock/doc/markup.rst
- utils/haddock/haddock-api/haddock-api.cabal
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-library/CHANGES.md
- utils/haddock/haddock-library/fixtures/Fixtures.hs
- + utils/haddock/haddock-library/fixtures/examples/codeBackticks.input
- + utils/haddock/haddock-library/fixtures/examples/codeBackticks.parsed
- + utils/haddock/haddock-library/fixtures/examples/codeDoubleBackticks.input
- + utils/haddock/haddock-library/fixtures/examples/codeDoubleBackticks.parsed
- utils/haddock/haddock-library/haddock-library.cabal
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Identifier.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d807650abccd34c76f8b875edb71f…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8d807650abccd34c76f8b875edb71f…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] testsuite/README: Don't append new tests at the end of all.T
by Marge Bot (@marge-bot) 12 Nov '26
by Marge Bot (@marge-bot) 12 Nov '26
12 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
1543f834 by Simon Jakobi at 2026-11-12T15:29:03-05:00
testsuite/README: Don't append new tests at the end of all.T
Patches that each add a test at the end of the same all.T conflict
with each other. Tests added elsewhere in the file usually merge cleanly.
Context: #26285
Assisted-by: Claude Opus 5.5
- - - - -
1 changed file:
- testsuite/README.md
Changes:
=====================================
testsuite/README.md
=====================================
@@ -31,6 +31,9 @@ The various ways that GHC supports are defined in `config/ghc`
## Adding Tests
+To reduce merge conflicts, add new tests in the middle of an `all.T` file
+(e.g. next to related tests) rather than at the end.
+
Please see the more extensive documentation [here][1].
[1]: https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1543f834476ca41338df87e74dfa347…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1543f834476ca41338df87e74dfa347…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] 2 commits: Make T2464 actually test #ifdef'd pragmas
by Marge Bot (@marge-bot) 12 Nov '26
by Marge Bot (@marge-bot) 12 Nov '26
12 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
82c34ccd by Simon Jakobi at 2026-11-12T15:27:40-05:00
Make T2464 actually test #ifdef'd pragmas
The test guarded a LANGUAGE EmptyDataDecls pragma behind #if, but
EmptyDataDecls is on by default since Haskell2010, so the module
compiled even when the guarded pragma was ignored. Guard MagicHash
instead, which is unlikely to be included in a future default language.
The test also checks that warnings from file-header pragmas are emitted
only once, even though the pragmas are parsed both before and after
CPP, using the -fffi deprecation warning as the canary. Use an
unrecognised warning flag instead, so the test no longer depends on a
deprecated flag that is about to be removed.
Context: #27939
Assisted-by: Claude Fable 5.1
- - - - -
419f2a12 by Simon Jakobi at 2026-11-12T15:27:40-05:00
Remove command-line flags deprecated in GHC 8.2 or earlier
Also remove the INCLUDE file-header pragma, which only expanded to
the now-removed -#include.
Closes #27939.
Assisted-by: Claude Fable 5.1
- - - - -
29 changed files:
- + changelog.d/remove-long-deprecated-flags.md
- compiler/GHC/CmmToC.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Errors/Types.hs
- compiler/GHC/Parser/Header.hs
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/Stg/Make.hs
- compiler/GHC/Types/Tickish.hs
- docs/users_guide/codegens.rst
- docs/users_guide/expected-undocumented-flags.txt
- docs/users_guide/exts/control.rst
- docs/users_guide/exts/ffi.rst
- docs/users_guide/exts/pragmas.rst
- docs/users_guide/ghc.rst
- docs/users_guide/profiling.rst
- − docs/users_guide/what_glasgow_exts_does.rst
- testsuite/tests/driver/Makefile
- testsuite/tests/driver/T2464.hs
- testsuite/tests/driver/T2464.stderr
- testsuite/tests/ffi/should_run/T2594.hs
- testsuite/tests/ffi/should_run/ffi015.hs
- testsuite/tests/ffi/should_run/fptr01.hs
- testsuite/tests/ffi/should_run/fptrfail01.hs
- testsuite/tests/indexed-types/should_compile/all.T
- testsuite/tests/indexed-types/should_fail/SkolemOccursLoop.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
Changes:
=====================================
changelog.d/remove-long-deprecated-flags.md
=====================================
@@ -0,0 +1,15 @@
+section: compiler
+synopsis: Remove command-line flags deprecated in GHC 8.2 or earlier
+issues: #27939
+mrs: !16801
+description: {
+ The following flags, deprecated in GHC 8.2 or earlier, are no longer
+ accepted: ``-n``, ``-Onot``, ``-recomp``, ``-syslib``, ``-package-conf``,
+ ``-no-user-package-conf``, ``-auto``, ``-auto-all``, ``-caf-all``,
+ ``-fglasgow-exts``, ``-frewrite-rules``, ``-fvia-C``, ``-fcontext-stack``,
+ ``-ftype-function-depth``, ``-#include``, the pre-``-X`` extension
+ spellings such as ``-fth`` and ``-fffi``, and their negations.
+
+ The ``INCLUDE`` file-header pragma, which only expanded to ``-#include``,
+ is no longer recognised either.
+}
=====================================
compiler/GHC/CmmToC.hs
=====================================
@@ -8,8 +8,6 @@
--
-- (c) The University of Glasgow 2004-2006
--
--- Print Cmm as real C, for -fvia-C
---
-- See wiki:commentary/compiler/backends/ppr-c
--
-- This is simpler than the old PprAbsC, because Cmm is "macro-expanded"
=====================================
compiler/GHC/CoreToStg.hs
=====================================
@@ -190,12 +190,12 @@ We now initialize these correctly. The initialization works like this:
- For top-level bindings, check if the binding is a CAF
- - CAF: If -fcaf-all is enabled, create a new CAF just for this CAF
+ - CAF: If -fprof-cafs is enabled, create a new CAF just for this CAF
and use it. Note that these new cost centres need to be
collected to be able to generate cost centre initialization
code, so `coreToTopStgRhs` now returns `CollectedCCs`.
- If -fcaf-all is not enabled, use "all CAFs" cost centre.
+ If -fprof-cafs is not enabled, use "all CAFs" cost centre.
- Non-CAF: Top-level (static) data is not counted in heap profiles; nor
do we set CCCS from it; so we just slam in
=====================================
compiler/GHC/Driver/Flags.hs
=====================================
@@ -35,7 +35,6 @@ module GHC.Driver.Flags
, validHoleFitsImpliedGFlags
, impliedGFlags
, impliedOffGFlags
- , glasgowExtsFlags
, ExtensionDeprecation(..)
, Deprecation(..)
@@ -403,41 +402,6 @@ impliedGFlags = [(Opt_DeferTypeErrors, turnOn, Opt_DeferTypedHoles)
impliedOffGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedOffGFlags = [(Opt_Strictness, turnOff, Opt_WorkerWrapper)]
--- Please keep @docs/users_guide/what_glasgow_exts_does.rst@ up to date with this list.
-glasgowExtsFlags :: [LangExt.Extension]
-glasgowExtsFlags = [
- LangExt.ConstrainedClassMethods
- , LangExt.DeriveDataTypeable
- , LangExt.DeriveFoldable
- , LangExt.DeriveFunctor
- , LangExt.DeriveGeneric
- , LangExt.DeriveTraversable
- , LangExt.EmptyDataDecls
- , LangExt.ExistentialQuantification
- , LangExt.ExplicitNamespaces
- , LangExt.FlexibleContexts
- , LangExt.FlexibleInstances
- , LangExt.ForeignFunctionInterface
- , LangExt.FunctionalDependencies
- , LangExt.GeneralizedNewtypeDeriving
- , LangExt.ImplicitParams
- , LangExt.KindSignatures
- , LangExt.LiberalTypeSynonyms
- , LangExt.MagicHash
- , LangExt.MultiParamTypeClasses
- , LangExt.ParallelListComp
- , LangExt.PatternGuards
- , LangExt.PostfixOperators
- , LangExt.RankNTypes
- , LangExt.RecursiveDo
- , LangExt.ScopedTypeVariables
- , LangExt.StandaloneDeriving
- , LangExt.TypeOperators
- , LangExt.TypeSynonymInstances
- , LangExt.UnboxedTuples
- , LangExt.UnicodeSyntax
- , LangExt.UnliftedFFITypes ]
-
-- | Debugging flags
data DumpFlag
-- See Note [Updating flag description in the User's Guide] in GHC.Driver.Session
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -21,7 +21,6 @@ module GHC.Driver.Session (
Language(..),
FatalMessager, FlushOut(..),
ProfAuto(..),
- glasgowExtsFlags,
hasPprDebug, hasNoDebugOutput, hasNoStateHack, hasNoOptCoercion,
dopt, dopt_set, dopt_unset,
gopt, gopt_set, gopt_unset, setGeneralFlag', unSetGeneralFlag',
@@ -55,7 +54,7 @@ module GHC.Driver.Session (
PackageDBFlag(..), PkgDbRef(..),
Option(..), showOpt,
DynLibLoader(..),
- fFlags, fLangFlags, xFlags,
+ fFlags, xFlags,
wWarningFlags,
makeDynFlagsConsistent,
positionIndependent,
@@ -1069,14 +1068,8 @@ add_dep_message (AnySuffix f) message =
-- See Note [Supporting CLI completion]
dynamic_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
dynamic_flags_deps = [
- make_dep_flag defFlag "n" (NoArg $ return ())
- "The -n flag is deprecated and no longer has any effect"
- , make_ord_flag defFlag "cpp" (NoArg (setExtensionFlag LangExt.Cpp))
+ make_ord_flag defFlag "cpp" (NoArg (setExtensionFlag LangExt.Cpp))
, make_ord_flag defFlag "F" (NoArg (setGeneralFlag Opt_Pp))
- , (Deprecated, defFlag "#include"
- (HasArg (\_s ->
- deprecate ("-#include and INCLUDE pragmas are " ++
- "deprecated: They no longer have any effect"))))
, make_ord_flag defFlag "v" (OptIntSuffix setVerbosity)
, make_ord_flag defGhcFlag "j" (OptIntSuffix
@@ -1393,13 +1386,6 @@ dynamic_flags_deps = [
(NoArg (setGeneralFlag Opt_Ticky_Dyn_Thunk))
, make_ord_flag defGhcFlag "ticky-tag-checks"
(NoArg (setGeneralFlag Opt_Ticky_Tag))
-
- ------- recompilation checker --------------------------------------
- , make_dep_flag defGhcFlag "recomp"
- (NoArg $ unSetGeneralFlag Opt_ForceRecomp)
- "Use -fno-force-recomp instead"
- , make_dep_flag defGhcFlag "no-recomp"
- (NoArg $ setGeneralFlag Opt_ForceRecomp) "Use -fforce-recomp instead"
, make_ord_flag defFlag "fmax-errors"
(intSuffix (\n d -> d { maxErrors = Just (max 1 n) }))
, make_ord_flag defFlag "fno-max-errors"
@@ -1723,8 +1709,6 @@ dynamic_flags_deps = [
, make_ord_flag defGhcFlag "fplugin-library" (hasArg addExternalPlugin)
------ Optimisation flags ------------------------------------------
- , make_dep_flag defGhcFlag "Onot" (noArgM $ setOptLevel 0 )
- "Use -O0 instead"
, make_ord_flag defGhcFlag "O" (optIntSuffixM (\mb_n ->
setOptLevel (mb_n `orElse` 1)))
-- If the number is missing, use 1
@@ -1801,14 +1785,6 @@ dynamic_flags_deps = [
(intSuffix (\n d -> d { wantedsFuel = n }))
, make_ord_flag defFlag "fqcs-expansion-fuel"
(intSuffix (\n d -> d { qcsFuel = n }))
- , (Deprecated, defFlag "fcontext-stack"
- (intSuffixM (\n d ->
- do { deprecate $ "use -freduction-depth=" ++ show n ++ " instead"
- ; return $ d { reductionDepth = treatZeroAsInf n } })))
- , (Deprecated, defFlag "ftype-function-depth"
- (intSuffixM (\n d ->
- do { deprecate $ "use -freduction-depth=" ++ show n ++ " instead"
- ; return $ d { reductionDepth = treatZeroAsInf n } })))
, make_ord_flag defFlag "fstrictness-before"
(intSuffix (\n d -> d { strictnessBefore = n : strictnessBefore d }))
, make_ord_flag defFlag "ffloat-lam-args"
@@ -1887,28 +1863,6 @@ dynamic_flags_deps = [
(intSuffix (\n d -> d { uniqueIncrement = n }))
------ Profiling ----------------------------------------------------
-
- -- OLD profiling flags
- , make_dep_flag defGhcFlag "auto-all"
- (noArg (\d -> d { profAuto = ProfAutoAll } ))
- "Use -fprof-auto instead"
- , make_dep_flag defGhcFlag "no-auto-all"
- (noArg (\d -> d { profAuto = NoProfAuto } ))
- "Use -fno-prof-auto instead"
- , make_dep_flag defGhcFlag "auto"
- (noArg (\d -> d { profAuto = ProfAutoExports } ))
- "Use -fprof-auto-exported instead"
- , make_dep_flag defGhcFlag "no-auto"
- (noArg (\d -> d { profAuto = NoProfAuto } ))
- "Use -fno-prof-auto instead"
- , make_dep_flag defGhcFlag "caf-all"
- (NoArg (setGeneralFlag Opt_AutoSccsOnIndividualCafs))
- "Use -fprof-cafs instead"
- , make_dep_flag defGhcFlag "no-caf-all"
- (NoArg (unSetGeneralFlag Opt_AutoSccsOnIndividualCafs))
- "Use -fno-prof-cafs instead"
-
- -- NEW profiling flags
, make_ord_flag defGhcFlag "fprof-auto"
(noArg (\d -> d { profAuto = ProfAutoAll } ))
, make_ord_flag defGhcFlag "fprof-auto-top"
@@ -1933,12 +1887,6 @@ dynamic_flags_deps = [
------ Compiler flags -----------------------------------------------
, make_ord_flag defGhcFlag "fasm" (NoArg (setObjBackend ncgBackend))
- , make_ord_flag defGhcFlag "fvia-c" (NoArg
- (deprecate $ "The -fvia-c flag does nothing; " ++
- "it will be removed in a future GHC release"))
- , make_ord_flag defGhcFlag "fvia-C" (NoArg
- (deprecate $ "The -fvia-C flag does nothing; " ++
- "it will be removed in a future GHC release"))
, make_ord_flag defGhcFlag "fllvm" (NoArg (setObjBackend llvmBackend))
, make_ord_flag defFlag "fno-code" (NoArg ((upd $ \d ->
@@ -1952,11 +1900,6 @@ dynamic_flags_deps = [
dflags' <- liftEwM getCmdLineState
pure $ gopt_unset dflags' Opt_ByteCodeAndObjectCode
- , make_dep_flag defFlag "fglasgow-exts"
- (NoArg enableGlasgowExts) "Use individual extensions instead"
- , make_dep_flag defFlag "fno-glasgow-exts"
- (NoArg disableGlasgowExts) "Use individual extensions instead"
-
------ Safe Haskell flags -------------------------------------------
, make_ord_flag defFlag "fpackage-trust" (NoArg setPackageTrust)
, make_ord_flag defFlag "fno-safe-infer" (noArg (\d ->
@@ -2023,8 +1966,6 @@ dynamic_flags_deps = [
]
------ Language flags -------------------------------------------------
- ++ map (mkFlag turnOn "f" setExtensionFlag ) fLangFlagsDeps
- ++ map (mkFlag turnOff "fno-" unSetExtensionFlag) fLangFlagsDeps
++ map (mkFlag turnOn "X" setExtensionFlag ) xFlagsDeps
++ map (mkFlag turnOff "XNo" unSetExtensionFlag) xFlagsDeps
++ map (mkFlag turnOn "X" setLanguage ) languageFlagsDeps
@@ -2098,11 +2039,6 @@ package_flags_deps = [
(NoArg (addPkgDbRef GlobalPkgDb))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgDbRef UserPkgDb))
- -- backwards compat with GHC<=7.4 :
- , make_dep_flag defFlag "package-conf"
- (HasArg $ addPkgDbRef . PkgDbPath . OsPath.unsafeEncodeUtf) "Use -package-db instead"
- , make_dep_flag defFlag "no-user-package-conf"
- (NoArg removeUserPkgDb) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name ->
upd (setUnitId name))
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
@@ -2123,7 +2059,6 @@ package_flags_deps = [
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
- , make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
@@ -2602,8 +2537,6 @@ fFlagsDeps = [
flagSpec "prof-late-inline" Opt_ProfLateInlineCcs,
flagSpec "regs-graph" Opt_RegsGraph,
flagSpec "regs-iterative" Opt_RegsIterative,
- depFlagSpec' "rewrite-rules" Opt_EnableRewriteRules
- (useInstead "-f" "enable-rewrite-rules"),
flagSpec "shared-implib" Opt_SharedImplib,
flagSpec "spec-constr" Opt_SpecConstr,
flagSpec "spec-constr-keen" Opt_SpecConstrKeen,
@@ -2698,43 +2631,6 @@ fHoleFlags = [
flagSpec "unclutter-valid-hole-fits" Opt_UnclutterValidHoleFits
]
--- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
-fLangFlags :: [FlagSpec LangExt.Extension]
-fLangFlags = map snd fLangFlagsDeps
-
-fLangFlagsDeps :: [(Deprecation, FlagSpec LangExt.Extension)]
-fLangFlagsDeps = [
--- See Note [Updating flag description in the User's Guide]
--- See Note [Supporting CLI completion]
- depFlagSpecOp' "th" LangExt.TemplateHaskell
- checkTemplateHaskellOk
- (deprecatedForExtension "TemplateHaskell"),
- depFlagSpec' "fi" LangExt.ForeignFunctionInterface
- (deprecatedForExtension "ForeignFunctionInterface"),
- depFlagSpec' "ffi" LangExt.ForeignFunctionInterface
- (deprecatedForExtension "ForeignFunctionInterface"),
- depFlagSpec' "arrows" LangExt.Arrows
- (deprecatedForExtension "Arrows"),
- depFlagSpec' "implicit-prelude" LangExt.ImplicitPrelude
- (deprecatedForExtension "ImplicitPrelude"),
- depFlagSpec' "bang-patterns" LangExt.BangPatterns
- (deprecatedForExtension "BangPatterns"),
- depFlagSpec' "monomorphism-restriction" LangExt.MonomorphismRestriction
- (deprecatedForExtension "MonomorphismRestriction"),
- depFlagSpec' "extended-default-rules" LangExt.ExtendedDefaultRules
- (deprecatedForExtension "ExtendedDefaultRules"),
- depFlagSpec' "implicit-params" LangExt.ImplicitParams
- (deprecatedForExtension "ImplicitParams"),
- depFlagSpec' "scoped-type-variables" LangExt.ScopedTypeVariables
- (deprecatedForExtension "ScopedTypeVariables"),
- depFlagSpec' "allow-overlapping-instances" LangExt.OverlappingInstances
- (deprecatedForExtension "OverlappingInstances"),
- depFlagSpec' "allow-undecidable-instances" LangExt.UndecidableInstances
- (deprecatedForExtension "UndecidableInstances"),
- depFlagSpec' "allow-incoherent-instances" LangExt.IncoherentInstances
- (deprecatedForExtension "IncoherentInstances")
- ]
-
supportedLanguages :: [String]
supportedLanguages = map (flagSpecName . snd) languageFlagsDeps
@@ -2835,15 +2731,6 @@ enableDLint = do
, Opt_LlvmFillUndefWithGarbage
]
-enableGlasgowExts :: DynP ()
-enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls
- mapM_ setExtensionFlag glasgowExtsFlags
-
-disableGlasgowExts :: DynP ()
-disableGlasgowExts = do unSetGeneralFlag Opt_PrintExplicitForalls
- mapM_ unSetExtensionFlag glasgowExtsFlags
-
-
setWarnSafe :: Bool -> DynP ()
setWarnSafe True = getCurLoc >>= \l -> upd (\d -> d { warnSafeOnLoc = l })
setWarnSafe False = return ()
@@ -3063,7 +2950,6 @@ setExtensionFlag' f dflags = foldr ($) (xopt_set dflags f) deps
unSetExtensionFlag' f dflags = xopt_unset dflags f
-- When you un-set f, however, we don't un-set the things it implies
- -- (except for -fno-glasgow-exts, which is treated specially)
--------------------------
=====================================
compiler/GHC/Parser/Errors/Ppr.hs
=====================================
@@ -971,6 +971,5 @@ forallSym False = text "forall"
pprFileHeaderPragmaType :: FileHeaderPragmaType -> SDoc
pprFileHeaderPragmaType OptionsPrag = text "OPTIONS"
-pprFileHeaderPragmaType IncludePrag = text "INCLUDE"
pprFileHeaderPragmaType LanguagePrag = text "LANGUAGE"
pprFileHeaderPragmaType DocOptionsPrag = text "OPTIONS_HADDOCK"
=====================================
compiler/GHC/Parser/Errors/Types.hs
=====================================
@@ -650,7 +650,6 @@ data TransLayoutReason
data FileHeaderPragmaType
= OptionsPrag
- | IncludePrag
| LanguagePrag
| DocOptionsPrag
=====================================
compiler/GHC/Parser/Header.hs
=====================================
@@ -323,11 +323,6 @@ getOptions' opts sec supported toks
src_span = getLoc open
real_src_span = expectJust (srcSpanToRealSrcSpan src_span)
starting_loc = realSrcSpanStart real_src_span
- parseToks (open:close:xs)
- | ITinclude_prag str <- unLoc open
- , ITclose_prag <- unLoc close
- = fmap (map (L (getLoc open)) ["-#include",removeSpaces str] ++)
- (parseToks xs)
parseToks (open:close:xs)
| ITdocOptions str _ <- unLoc open
, ITclose_prag <- unLoc close
@@ -359,8 +354,6 @@ getOptions' opts sec supported toks
mkMessage (L loc token)
| IToptions_prag _ <- token
= Just (singleMessage $ mkPlainMsgEnvelope diag_opts loc (PsWarnMisplacedPragma OptionsPrag))
- | ITinclude_prag _ <- token
- = Just (singleMessage $ mkPlainMsgEnvelope diag_opts loc (PsWarnMisplacedPragma IncludePrag))
| ITdocOptions _ _ <- token
= Just (singleMessage $ mkPlainMsgEnvelope diag_opts loc (PsWarnMisplacedPragma DocOptionsPrag))
| ITlanguage_prag <- token
=====================================
compiler/GHC/Parser/Lexer.x
=====================================
@@ -857,7 +857,6 @@ data Token
| ITcomplete_prag SourceText
| ITclose_prag
| IToptions_prag String
- | ITinclude_prag String
| ITlanguage_prag
| ITminimal_prag SourceText
| IToverlappable_prag SourceText -- instance overlap mode
@@ -3507,8 +3506,7 @@ linePrags = Map.singleton "line" linePrag
fileHeaderPrags = Map.fromList([("options", lex_string_prag IToptions_prag),
("options_ghc", lex_string_prag IToptions_prag),
("options_haddock", lex_string_prag_comment ITdocOptions),
- ("language", token ITlanguage_prag),
- ("include", lex_string_prag ITinclude_prag)])
+ ("language", token ITlanguage_prag)])
ignoredPrags = Map.fromList (map ignored pragmas)
where ignored opt = (opt, nested_comment)
=====================================
compiler/GHC/Stg/Make.hs
=====================================
@@ -67,7 +67,7 @@ mkTopStgRhs allow_toplevel_con_app opt_AutoSccsOnIndividualCafs this_mod ccs bnd
upd_flag | isAtMostOnceDmd (idDemandInfo bndr) = SingleEntry
| otherwise = Updatable
- -- CAF cost centres generated for -fcaf-all
+ -- CAF cost centres generated for -fprof-cafs
caf_cc = mkAutoCC bndr modl
caf_ccs = mkSingletonCCS caf_cc
-- careful: the binder might be :Main.main,
=====================================
compiler/GHC/Types/Tickish.hs
=====================================
@@ -106,7 +106,7 @@ type CmmTickish = GenTickish 'TickishPassCmm
-- See Note [GHC Formalism] in GHC.Core.Lint
data GenTickish pass =
-- | An @{-# SCC #-}@ profiling annotation, either automatically
- -- added by the desugarer as a result of -auto-all, or added by
+ -- added by the desugarer as a result of -fprof-auto, or added by
-- the user.
ProfNote {
profNoteCC :: CostCentre, -- ^ the cost centre
=====================================
docs/users_guide/codegens.rst
=====================================
@@ -69,23 +69,14 @@ To install LLVM and Clang:
.. _c-code-gen:
-C Code Generator (``-fvia-C``)
-------------------------------
+C Code Generator
+----------------
.. index::
single: C code generator
- single: -fvia-C
-
-.. ghc-flag:: -fvia-C
- :shortdesc: use the C code generator
- :type: dynamic
- :category: warnings
-
- Use the C code generator. Only supposed in unregisterised GHC builds.
This is the oldest code generator in GHC and is generally not included
-any more having been deprecated around GHC 7.0. Select it with the
-:ghc-flag:`-fvia-C` flag.
+any more.
The C code generator is only supported when GHC is built in
unregisterised mode, a mode where GHC produces "portable" C code as
=====================================
docs/users_guide/expected-undocumented-flags.txt
=====================================
@@ -1,8 +1,6 @@
--#include
--abi-hash
--backpack
--show-packages
--Onot
-Walternative-layout-rule-transitional
-XAlternativeLayoutRule
-XAlternativeLayoutRuleTransitional
@@ -19,17 +17,11 @@
-dsource-stats
-dstg-stats
-dsuppress-stg-exts
--fallow-incoherent-instances
--fallow-overlapping-instances
--fallow-undecidable-instances
--farrows
--fbang-patterns
-fbuilding-cabal-package
-fconstraint-solver-iterations
-fgivens-expansion-fuel
-fwanteds-expansion-fuel
-fqcs-expansion-fuel
--fcontext-stack
-fcross-module-specialize
-fdiagnostics-color=always
-fdiagnostics-color=auto
@@ -38,10 +30,7 @@
-fprint-error-index-links=auto
-fprint-error-index-links=never
-fembed-manifest
--fextended-default-rules
-ffast-pap-calls
--fffi
--ffi
-ffloat-all-lams
-ffloat-lam-args
-ffrontend-opt
@@ -49,48 +38,34 @@
-fghci-history
-fghci-sandbox
-fhistory-size
--fimplicit-params
--fimplicit-prelude
-firrefutable-tuples
-fmax-errors
-fmax-pmcheck-iterations
--fmonomorphism-restriction
-fpre-inlining
-fprint-bind-contents
-freduction-depth
--frewrite-rules
--fscoped-type-variables
-fshared-implib
-fshow-valid-hole-fits
-fshow-valid-substitutions
-fspec-constr-recursive
-fspecialize
-fspecialize-aggressively
--fth
--ftype-function-depth
-fversion-macros
--fvia-c
-haddock-opts
-instantiated-with
-keep-hi-file
-keep-o-file
--n
-no-keep-hi-file
-no-keep-o-file
-no-link
--no-recomp
-no-rtsopts
--no-user-package-conf
--package-conf
-package-name
-pgmar
-pgmranlib
--recomp
-relative-dynlib-paths
-rtsopts=all
-rtsopts=ignore
-rtsopts=ignoreAll
-rtsopts=none
-rtsopts=some
--syslib
-this-component-id
=====================================
docs/users_guide/exts/control.rst
=====================================
@@ -244,25 +244,3 @@ Similarly, language extensions can be controlled (either enabled or disabled):
* :extension:`StarIsType`
* :extension:`TraditionalRecordSyntax`
* :extension:`ImplicitStagePersistence`
-
-
-
-Although not recommended, the deprecated :ghc-flag:`-fglasgow-exts` flag enables
-a large swath of the extensions supported by GHC at once.
-
-.. ghc-flag:: -fglasgow-exts
- :shortdesc: Deprecated. Enable most language extensions;
- see :ref:`options-language` for exactly which ones.
- :type: dynamic
- :reverse: -fno-glasgow-exts
- :category: misc
-
- The flag ``-fglasgow-exts`` is equivalent to enabling the following extensions:
-
- .. include:: ../what_glasgow_exts_does.rst
-
- Enabling these options is the *only* effect of ``-fglasgow-exts``. We are trying
- to move away from this portmanteau flag, and towards enabling features
- individually.
-
-
=====================================
docs/users_guide/exts/ffi.rst
=====================================
@@ -766,9 +766,6 @@ calls across module and package boundaries: there's no need for the header file
to be available when compiling an inlined version of a foreign call, so the
compiler is free to inline foreign calls in any context.
-The ``-#include`` option is now deprecated, and the ``includes``
-field in a Cabal package specification is ignored.
-
Memory Allocation
~~~~~~~~~~~~~~~~~
=====================================
docs/users_guide/exts/pragmas.rst
=====================================
@@ -26,8 +26,8 @@ Certain pragmas are *file-header pragmas*:
- File-header pragmas are read once only, before pre-processing the
file (e.g. with cpp).
-- The file-header pragmas are: ``{-# LANGUAGE #-}``,
- ``{-# OPTIONS_GHC #-}``, and ``{-# INCLUDE #-}``.
+- The file-header pragmas are: ``{-# LANGUAGE #-}`` and
+ ``{-# OPTIONS_GHC #-}``.
.. _language-pragma:
@@ -80,16 +80,6 @@ Previous versions of GHC accepted ``OPTIONS`` rather than
``OPTIONS_GHC`` is a file-header pragma (see :ref:`pragmas`).
-.. _include-pragma:
-
-``INCLUDE`` pragma
-------------------
-
-The ``INCLUDE`` used to be necessary for specifying header files to be
-included when using the FFI and compiling via C. It is no longer
-required for GHC, but is accepted (and ignored) for compatibility with
-other compilers.
-
.. _warning-deprecated-pragma:
``WARNING`` and ``DEPRECATED`` pragmas
=====================================
docs/users_guide/ghc.rst
=====================================
@@ -28,8 +28,7 @@ As a rule of thumb, all the language options are dynamic, as are the
warning options and the debugging options.
The rest are static, with the notable exceptions of
-``-v``, ``-cpp``, ``-fasm``, ``-fvia-C``, ``-fllvm``, and
-``-#include``.
+``-v``, ``-cpp``, ``-fasm``, and ``-fllvm``.
The OPTIONS sections lists the status of each flag.
Common suffixes of file names for Haskell are:
=====================================
docs/users_guide/profiling.rst
=====================================
@@ -594,42 +594,6 @@ of your profiled program will be different to that of the unprofiled one.
Process (or ignore) manual ``SCC`` annotations. Can be helpful to ignore annotations from libraries which
are not desired.
-.. ghc-flag:: -auto-all
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fprof-auto`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fprof-auto`
-
-.. ghc-flag:: -auto
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fprof-auto-exported`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fprof-auto-exported`
-
-.. ghc-flag:: -caf-all
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fprof-cafs`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fprof-cafs`
-
-.. ghc-flag:: -no-auto-all
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fno-prof-auto`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fno-prof-auto`
-
-.. ghc-flag:: -no-auto
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fno-prof-auto`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fno-prof-auto`
-
-.. ghc-flag:: -no-caf-all
- :shortdesc: *(deprecated)* Alias for :ghc-flag:`-fno-prof-cafs`
- :type: dynamic
-
- Deprecated alias for :ghc-flag:`-fno-prof-cafs`
-
.. _prof-time-options:
Time and allocation profiling
=====================================
docs/users_guide/what_glasgow_exts_does.rst deleted
=====================================
@@ -1,34 +0,0 @@
-.. hlist::
-
- * :extension:`ConstrainedClassMethods`
- * :extension:`DeriveDataTypeable`
- * :extension:`DeriveFoldable`
- * :extension:`DeriveFunctor`
- * :extension:`DeriveGeneric`
- * :extension:`DeriveTraversable`
- * :extension:`EmptyDataDecls`
- * :extension:`ExistentialQuantification`
- * :extension:`ExplicitNamespaces`
- * :extension:`FlexibleContexts`
- * :extension:`FlexibleInstances`
- * :extension:`ForeignFunctionInterface`
- * :extension:`FunctionalDependencies`
- * :extension:`GeneralizedNewtypeDeriving`
- * :extension:`ImplicitParams`
- * :extension:`InterruptibleFFI`
- * :extension:`KindSignatures`
- * :extension:`LiberalTypeSynonyms`
- * :extension:`MagicHash`
- * :extension:`MultiParamTypeClasses`
- * :extension:`ParallelListComp`
- * :extension:`PatternGuards`
- * :extension:`PostfixOperators`
- * :extension:`RankNTypes`
- * :extension:`RecursiveDo`
- * :extension:`ScopedTypeVariables`
- * :extension:`StandaloneDeriving`
- * :extension:`TypeOperators`
- * :extension:`TypeSynonymInstances`
- * :extension:`UnboxedTuples`
- * :extension:`UnicodeSyntax`
- * :extension:`UnliftedFFITypes`
=====================================
testsuite/tests/driver/Makefile
=====================================
@@ -149,18 +149,16 @@ test026:
test -f d026/P/Q$(OBJSUFFIX)
# test stub generation
-# -fvia-C, because we want to check that the .hc file can #include the stub.h
test027:
$(RM) B027/F.hi B027/F$(OBJSUFFIX) B027/F_stub.h
- "$(TEST_HC)" $(TEST_HC_OPTS) -c B027/F.hs -fno-warn-deprecated-flags -fvia-C
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B027/F.hs
test -f B027/F_stub.h
# test -stubdir
-# -fvia-C, because we want to check that the .hc file can #include the stub.h
test028:
$(RM) B028/F.hi B028/F$(OBJSUFFIX)
$(RM) stub028/B028/F_stub.h
- "$(TEST_HC)" $(TEST_HC_OPTS) -c B028/F.hs -stubdir stub028 -fno-warn-deprecated-flags -fvia-C
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c B028/F.hs -stubdir stub028
test -f stub028/B028/F_stub.h
# -----------------------------------------------------------------------------
@@ -289,16 +287,16 @@ test053:
# -----------------------------------------------------------------------------
# Other tests
-# Test that -keep-s-files works with --make and -fvia-C
+# Test that -keep-s-files works with --make
test061a:
$(RM) A061a.hi A061a$(OBJSUFFIX) A061a.s
- "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -keep-s-files -fno-warn-deprecated-flags -fvia-C A061a.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make -keep-s-files A061a.hs
test -f A061a.s
# Test that -keep-s-files works without --make
test061b:
$(RM) A061b.hi A061b$(OBJSUFFIX) A061b.s
- "$(TEST_HC)" $(TEST_HC_OPTS) -c -keep-s-files -fno-warn-deprecated-flags -fvia-C A061b.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c -keep-s-files A061b.hs
test -f A061b.s
# Test that -main-is works with --make
=====================================
testsuite/tests/driver/T2464.hs
=====================================
@@ -1,9 +1,13 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -DTEST #-}
-{-# OPTIONS_GHC -fffi #-} -- deprecation warning
+{-# OPTIONS_GHC -Wno-such-warning #-} -- warned about exactly once
#if defined(TEST)
-{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE MagicHash #-}
#endif
module Test2464 where
-data T
+
+import GHC.Exts
+
+f :: Int# -> Int#
+f x = x +# 1#
=====================================
testsuite/tests/driver/T2464.stderr
=====================================
@@ -1,3 +1,3 @@
-T2464.hs:3:17: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
- -fffi is deprecated: use -XForeignFunctionInterface or pragma {-# LANGUAGE ForeignFunctionInterface #-} instead
+T2464.hs:3:17: warning: [GHC-93741] [-Wunrecognised-warning-flags (in -Wdefault)]
+ unrecognised warning flag: -Wno-such-warning
=====================================
testsuite/tests/ffi/should_run/T2594.hs
=====================================
@@ -1,4 +1,4 @@
-{-# options -fffi #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign
import Foreign.C.Types
=====================================
testsuite/tests/ffi/should_run/ffi015.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -#include "ffi015_cbits.h" #-}
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign
=====================================
testsuite/tests/ffi/should_run/fptr01.hs
=====================================
@@ -4,8 +4,6 @@ module Main where
import Foreign
-{-# INCLUDE "fptr01.h" #-}
-
foreign import ccall "&f" fptr :: FunPtr (Ptr Int -> IO ())
foreign import ccall "&g" gptr :: FunPtr (Ptr Int -> IO ())
foreign import ccall "&h" hptr :: FunPtr (Ptr Int -> IO ())
=====================================
testsuite/tests/ffi/should_run/fptrfail01.hs
=====================================
@@ -5,8 +5,6 @@ module Main where
import Foreign
import GHC.ForeignPtr
-{-# INCLUDE "fptrfail01.h" #-}
-
foreign import ccall "&f" fptr :: FunPtr (Ptr Int -> IO ())
main :: IO ()
=====================================
testsuite/tests/indexed-types/should_compile/all.T
=====================================
@@ -17,7 +17,7 @@ test('Simple16', normal, compile, [''])
test('Simple17', normal, compile, [''])
test('Simple18', normal, compile, [''])
test('Simple19', normal, compile, [''])
-test('Simple20', expect_broken(4296), compile, ['-fcontext-stack=10'])
+test('Simple20', expect_broken(4296), compile, ['-freduction-depth=10'])
test('Simple21', normal, compile, [''])
test('Simple22', normal, compile, [''])
test('Simple23', normal, compile, [''])
=====================================
testsuite/tests/indexed-types/should_fail/SkolemOccursLoop.hs
=====================================
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -ftype-function-depth=3 #-}
+{-# OPTIONS_GHC -freduction-depth=3 #-}
{-# LANGUAGE TypeFamilies, FlexibleContexts, EmptyDataDecls #-}
module SkolemOccursLoop where
=====================================
utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
=====================================
@@ -257,7 +257,6 @@ classify tok =
ITcomplete_prag{} -> TkPragma
ITclose_prag -> TkPragma
IToptions_prag{} -> TkPragma
- ITinclude_prag{} -> TkPragma
ITlanguage_prag -> TkPragma
ITminimal_prag{} -> TkPragma
IToverlappable_prag{} -> TkPragma
@@ -397,7 +396,6 @@ inPragma False tok =
ITann_prag{} -> True
ITcomplete_prag{} -> True
IToptions_prag{} -> True
- ITinclude_prag{} -> True
ITlanguage_prag -> True
ITminimal_prag{} -> True
IToverlappable_prag{} -> True
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/22e8b92a5bbca827ae39e6daa6da0f…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/22e8b92a5bbca827ae39e6daa6da0f…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] 2 commits: TimerManager: publish only evaluated timeout queues (#9809)
by Marge Bot (@marge-bot) 12 Nov '26
by Marge Bot (@marge-bot) 12 Nov '26
12 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
adc294d0 by Erik de Castro Lopo at 2026-11-12T15:28:21-05:00
TimerManager: publish only evaluated timeout queues (#9809)
The issue in #9809 was triggered by many threads registering timeouts
at the same time and those timeouts being stored as unevaluated thunks
in the shared list. When say 100,000 timeouts are registered at the
same time, the program can be slowed down considerably and the memory
usage grow unacceptably large.
The commit that caused the problem was 2d5eccdf1c, a 2013 change that
fixed #7653.
The fix is to add a modifyTimeouts function which applies an edit to a
copy of the list and fully evaluates the result before replacing the
shared list with a CAS operation.
Performance has improved for the threaded case and not regressed for
the single thread case:
Forked registrations of 100k timeouts (median of 5 runs):
-N4: 0.577 s, 428 MB -> 0.078 s, 39 MB
-N12: 1.227 s, 479 MB -> 0.127 s, 80 MB
Forked registrations of 1M timeouts on -N1 (median of 3 and 10 runs):
5.21 s (range 0.67-9.47 s), 1613 MB -> 0.67 s, 250 MB
Single-thread registrations are unchanged or slightly faster, and timer
latency during registration storms improves (p99 lateness of a 1 ms
threadDelay during 100k forked registrations on -N4: 302-394 ms ->
3.5-4.1 ms).
The registration code still runs in constant stack, so #7653 stays fixed;
T7653 and the concurrent, base and ghc-internal testsuites pass.
modifyTimeouts is OPAQUE so that the optimiser cannot expose the edit
function's inspection of the old queue next to the compare-and-swap and
replace the expected pointer with the evaluated queue, which would make the
compare-and-swap keep failing when the MutVar# holds a thunk or indirection.
Regression test T9809.hs included.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
b294b82f by Moritz Angermann at 2026-11-12T15:28:21-05:00
testsuite: give pause_resume_via_safe_ffi_concurrent 60s on Darwin CI
The 10s System.Timeout watchdog was a false deadlock: five serialized
1s pauses plus rts_pause waiting on threadDelay/timer-manager traffic
overruns that budget on loaded Mac runners. Keep a watchdog so a real
hang still fails.
- - - - -
7 changed files:
- + changelog.d/T9809-timer-manager-contention
- libraries/base/tests/.gitignore
- + libraries/base/tests/T9809.hs
- libraries/base/tests/all.T
- libraries/ghc-internal/src/GHC/Internal/Event/TimerManager.hs
- testsuite/tests/rts/pause-resume/all.T
- testsuite/tests/rts/pause-resume/pause_resume_via_safe_ffi_concurrent.hs
Changes:
=====================================
changelog.d/T9809-timer-manager-contention
=====================================
@@ -0,0 +1,12 @@
+section: ghc-internal
+synopsis: Fix excessive GC, memory use and timer latency when many threads
+ register timeouts at once with ``threadDelay``, ``registerDelay`` or
+ ``System.Timeout.timeout``.
+issues: #9809
+mrs: !16863
+description: {
+ Threads registering timeouts now publish only fully evaluated updates to
+ the timer manager's timeout queue, using a compare-and-swap loop, instead
+ of building chains of unevaluated updates that other threads then had to
+ evaluate or block on.
+}
=====================================
libraries/base/tests/.gitignore
=====================================
@@ -275,4 +275,5 @@
/weak001
/T9395
/T9532
+/T9809
/T11555
=====================================
libraries/base/tests/T9809.hs
=====================================
@@ -0,0 +1,29 @@
+-- #9809: when many threads registered timeouts at the same time, the
+-- TimerManager published unevaluated timeout queues with atomicModifyIORef'.
+-- The threads then built long chains of thunks and blocked on each other's
+-- black holes, and the heap grew to hundreds of megabytes. all.T runs this
+-- test with a heap limit that the old code exceeded.
+
+import Control.Concurrent
+import Control.Monad
+import Data.IORef
+import GHC.Conc (TVar, atomically, newTVarIO, readTVar, registerDelay, retry, writeTVar)
+
+main :: IO ()
+main = do
+ let n = 100000
+ ref <- newIORef []
+ registered <- newTVarIO (0 :: Int)
+ replicateM_ n . forkIO $ do
+ tv <- registerDelay 10
+ atomicModifyIORef' ref (\tvs -> (tv : tvs, ()))
+ atomically $ readTVar registered >>= writeTVar registered . (+ 1)
+ atomically $ do
+ r <- readTVar registered
+ when (r /= n) retry
+ readIORef ref >>= mapM_ waitFor
+
+-- | Block until a delay has fired, so that the test also checks that the
+-- TimerManager fires every timeout.
+waitFor :: TVar Bool -> IO ()
+waitFor tv = atomically $ readTVar tv >>= \fired -> unless fired retry
=====================================
libraries/base/tests/all.T
=====================================
@@ -193,6 +193,14 @@ test('T7653', [when(opsys('mingw32'), skip),
omit_ways(prof_ways + ghci_ways)], compile_and_run, [''])
test('T7787', normal, compile_and_run, [''])
+# Before the fix for #9809 this needed more than 256MB of heap.
+# Windows doesn't use TimerManager which makes the test ~80x slower
+test('T9809', [when(opsys('mingw32'), skip),
+ req_ghc_smp,
+ req_target_smp,
+ only_ways(['threaded1', 'threaded2', 'nonmoving_thr'])],
+ compile_and_run, ['-threaded -with-rtsopts="-N2 -M128m"'])
+
test('topHandler01', [when(opsys('mingw32'), skip), js_broken(22261), req_process], compile_and_run, [''])
test('topHandler02',
[when(opsys('mingw32'), skip),
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/TimerManager.hs
=====================================
@@ -13,8 +13,10 @@ import GHC.Internal.Types ()
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE UnboxedTuples #-}
-- TODO: use the new Windows IO manager
module GHC.Internal.Event.TimerManager
@@ -53,6 +55,9 @@ import GHC.Internal.Control.Exception (finally)
import GHC.Internal.Data.Foldable (sequence_)
import GHC.Internal.Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef,
writeIORef)
+import GHC.Internal.IORef (IORef(..))
+import GHC.Internal.Prim (casMutVar#, readMutVar#)
+import GHC.Internal.STRef (STRef(..))
import GHC.Internal.Err (errorWithoutStackTrace)
import GHC.Internal.Clock (getMonotonicTimeNSec)
import GHC.Internal.Conc.Signal (runHandlers)
@@ -188,6 +193,11 @@ step mgr = do
-- Call all expired timer callbacks and return the time to the
-- next timeout.
+ --
+ -- This function uses atomicModifyIORef' whereas we use casMutVar# below
+ -- in modifyTimeouts. We deliberately avoid modifyTimeouts here
+ -- because this update is long, and with a CAS it would rarely win
+ -- against a stream of registrations, starving the manager. See #9809.
mkTimeout :: IO Timeout
mkTimeout = do
now <- getMonotonicTimeNSec
@@ -260,7 +270,7 @@ updateTimeout mgr (TK key) us = do
editTimeouts :: TimerManager -> TimeoutEdit -> IO ()
editTimeouts mgr g = do
- wake <- atomicModifyIORef' (emTimeouts mgr) f
+ wake <- modifyTimeouts (emTimeouts mgr) f
when wake (wakeManager mgr)
where
f q = (q', wake)
@@ -276,4 +286,35 @@ editTimeouts mgr g = do
t0 /= t1
_ -> True
+-- The issue in #9809 was that for the threaded runtime (where each process
+-- has its own timer manager), timer events added to the shared list of
+-- events were potentially added unevaluated. When many threads (eg 100,000)
+-- add entries at the same time, the program can slow down considerably and
+-- use significant amounts of memory. The crux of the matter was that each
+-- thread updated the shared list lazily. In this case it's easy to build a
+-- massive list of unevaluated thunks.
+--
+-- The solution is for each thread that wants to update the shared list to
+-- apply its edit to a copy of the list and fully evaluate the result before
+-- replacing the shared list. Updating the list is an O(log n) process and it
+-- runs in constant stack space, see #7653. The old list is replaced by the
+-- new list using a compare-and-swap (CAS) operation (which compares machine
+-- level pointers). If the CAS fails (ie the list has been updated by another
+-- thread) it starts again with the new list created by the other thread.
+
+-- NOINLINE could have been used here but OPAQUE has stronger guarantees
+-- (ie worker/wrapper optimisation is prevented). If this function were
+-- inlined above (possible without either pragma), the CAS operation may end up
+-- comparing with a different pointer to the one it read (eg if GHC replaces a
+-- thunk or indirection with the evaluated value).
+{-# OPAQUE modifyTimeouts #-}
+modifyTimeouts :: IORef TimeoutQueue -> (TimeoutQueue -> (TimeoutQueue, b)) -> IO b
+modifyTimeouts (IORef (STRef ref)) f = IO modLoop
+ where
+ modLoop s0 = case readMutVar# ref s0 of
+ (# s1, oldVar #) -> case f oldVar of
+ (newVar, r) -> newVar `seq` case casMutVar# ref oldVar newVar s1 of
+ (# s2, 0#, _ #) -> (# s2, r #)
+ (# s2, _, _ #) -> modLoop s2
+
#endif
=====================================
testsuite/tests/rts/pause-resume/all.T
=====================================
@@ -14,6 +14,8 @@ test('pause_resume_via_safe_ffi_concurrent',
[ only_ways(['threaded1', 'threaded2'])
, req_c
, extra_files(['pause_resume.c','pause_resume.h'])
+ # Internal watchdog is 60s; give the harness room on loaded Darwin CI.
+ , run_timeout_multiplier(2)
],
multi_compile_and_run, ['pause_resume_via_safe_ffi_concurrent', [('pause_resume.c','')], ''])
test('pause_and_use_rts_api',
=====================================
testsuite/tests/rts/pause-resume/pause_resume_via_safe_ffi_concurrent.hs
=====================================
@@ -8,6 +8,7 @@ import Foreign.Marshal.Alloc
import Foreign.Ptr
import Foreign.Storable
import System.Exit
+import System.IO (hFlush, stdout)
import System.Timeout
foreign import ccall safe "pause_resume.h pauseAndResume"
@@ -38,11 +39,17 @@ main = do
countPtr
putMVar mvar ()
- -- Wait (at least 2n seconds to be safe) for all threads to finish.
- result <- timeout (2 * n * 1000000) (mapM_ takeMVar mvars)
+ -- Each pause holds the RTS for about a second, so n concurrent
+ -- calls serialize to ~n seconds. 2n (10s) was enough on Linux but
+ -- a false deadlock on Darwin CI: rts_pause waits for every
+ -- capability, and the counter threads keep hitting the timer
+ -- manager via threadDelay. Keep a watchdog so a real hang still
+ -- fails, but give 60s of slack.
+ result <- timeout (60 * 1000000) (mapM_ takeMVar mvars)
case result of
Nothing -> do
putStrLn "Not all rts_pause/rts_resume threads have finished. Assuming deadlocked and failing test."
+ hFlush stdout
exitFailure
Just () -> do
putStrLn "All threads finished"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/419f2a12d2f7a0b59b3a7e79ae26b2…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/419f2a12d2f7a0b59b3a7e79ae26b2…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] 3 commits: testsuite: Fix python type errors
by Marge Bot (@marge-bot) 12 Nov '26
by Marge Bot (@marge-bot) 12 Nov '26
12 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
5a7591b3 by David Eichmann at 2026-11-12T15:26:56-05:00
testsuite: Fix python type errors
These errors appear when using the VSCode python extension which uses
Pylance under the hood.
- - - - -
52f129f8 by David Eichmann at 2026-11-12T15:26:56-05:00
Add test modifier to test over all IO Managers
- - - - -
22e8b92a by David Eichmann at 2026-11-12T15:26:56-05:00
testsuite: include custom IO Manager in test name
- - - - -
10 changed files:
- rts/RtsUtils.c
- testsuite/config/ghc
- testsuite/driver/junit.py
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/tests/cmm/should_run/all.T
- testsuite/tests/primops/should_run/all.T
- testsuite/tests/rts/all.T
Changes:
=====================================
rts/RtsUtils.c
=====================================
@@ -397,6 +397,7 @@ void printRtsInfo(const RtsConfig rts_config) {
rts_config.rts_opts != NULL ? rts_config.rts_opts : "");
selectIOManager(); /* resolve the io-manager, accounting for flags */
mkRtsInfoPair("I/O manager default", showIOManager());
+ mkRtsInfoPair("I/O managers", &IOMGRS_ENABLED_STR[1]); // skips the initial ' ' character in IOMGRS_ENABLED_STR
printf(" ]\n");
}
=====================================
testsuite/config/ghc
=====================================
@@ -257,7 +257,9 @@ def get_compiler_info():
)
except Exception as err:
- print("Exception thrown in testsuite/config/ghc.get_compiler_info: %s", err)
+ # We don't throw so that we can still discover tests before we've built
+ # GHC (i.e. config.compiler doesn't yet exist).
+ print("Exception thrown in testsuite/config/ghc.get_compiler_info: ", err)
else:
res = p.returncode == 0
@@ -315,6 +317,58 @@ def get_compiler_info():
config.ghc_th_way = "normal"
config.ghc_th_hi_ext = "hi"
+ # I/O manager discovery.
+ #
+ # Which I/O managers (GHC's `--io-manager` RTS flag) a given RTS build
+ # supports depends on the target platform and on whether the RTS is the
+ # threaded or non-threaded flavour (see rts/IOManager.h's
+ # IOMGR_ENABLED_* macros). Rather than duplicate that platform/way
+ # dependent logic here, we ask the RTS itself using `+RTS --info -RTS`
+ # and extract the "I/O managers" value from stdout.
+ def discover_io_managers_generic(extra_flags):
+ import tempfile
+
+ test_src = 'main :: IO ()\nmain = return ()\n'
+
+ res = [None]
+
+ with tempfile.TemporaryDirectory() as d:
+ src = Path(d) / 'IOMgrProbe.hs'
+ src.write_text(test_src)
+ exe = Path(d) / ('IoMgrProbe' + config.exeext)
+
+ # -rtsopts is needed so that the resulting binary will even
+ # consider an --io-manager= flag (rather than immediately
+ # rejecting all "unsafe" RTS options).
+ cmd = '{} -v0 -rtsopts -o {} {} {}'.format(
+ config.compiler,
+ exe,
+ src,
+ ' '.join(extra_flags))
+ try:
+ cp = subprocess.run(
+ cmd,
+ shell=True,
+ cwd=d,
+ stdout=subprocess.DEVNULL,
+ stderr=None if config.verbose >= 3 else subprocess.DEVNULL)
+ if cp.returncode != 0 or not exe.exists():
+ raise Exception("Error in testsuite/config/ghc.discover_io_managers: failed to compile with: {}".format(cmd))
+ res = list(discover_io_managers(exe, d))
+
+ except Exception as err:
+ # We don't throw so that we can still discover tests before we've built
+ # GHC (i.e. config.compiler doesn't yet exist).
+ print("Exception thrown in testsuite/config/ghc.discover_io_managers_generic: ", err)
+
+ return res
+
+ config.io_managers_nonthreaded = discover_io_managers_generic([])
+ config.io_managers_threaded = (
+ discover_io_managers_generic(['-threaded']) if config.ghc_with_threaded_rts
+ else [])
+ config.io_managers_all = list(set(config.io_managers_nonthreaded).union(set(config.io_managers_threaded)))
+
config.cmm_cpp_is_gcc = test_compile(
['-c'],
test_filename='test.cmm',
=====================================
testsuite/driver/junit.py
=====================================
@@ -3,13 +3,15 @@ from datetime import datetime
import xml.etree.ElementTree as ET
from testglobals import TestRun, TestResult
+from testutil import io_manager_test_name_suffix
def add_testcase(testsuite: ET.Element, test_result: TestResult) -> ET.Element:
"""Adds the xml element representing the testcase."""
testcase = ET.SubElement(testsuite, 'testcase',
classname = test_result.way,
- name = '%s(%s)' % (test_result.testname, test_result.way))
+ name = '%s(%s)%s' % (test_result.testname, test_result.way,
+ io_manager_test_name_suffix(test_result.io_manager)))
if test_result.runtime is not None:
testcase.set('time', '%.3f' % test_result.runtime)
return testcase
=====================================
testsuite/driver/runtests.py
=====================================
@@ -28,7 +28,7 @@ import subprocess
import asyncio
-from testutil import getStdout, str_warn, str_info, print_table, shorten_metric_name, str_removeprefix
+from testutil import discover_io_managers, getStdout, str_warn, str_info, print_table, shorten_metric_name, str_removeprefix
from testglobals import getConfig, ghc_env, TestConfig, t, \
TestOptions, brokens, PerfMetric
from my_typing import TestName
=====================================
testsuite/driver/testglobals.py
=====================================
@@ -126,6 +126,15 @@ class TestConfig:
self.way_flags = {} # type: Dict[WayName, List[str]]
self.way_rts_flags = {} # type: Dict[WayName, List[str]]
+ # I/O managers (GHC's `--io-manager` RTS flag) supported by the threaded runtime.
+ self.io_managers_threaded = [] # type: List[str]
+
+ # I/O managers (GHC's `--io-manager` RTS flag) supported by the non-threaded runtime.
+ self.io_managers_nonthreaded = [] # type: List[str]
+
+ # All I/O managers (GHC's `--io-manager` RTS flag)
+ self.io_managers_all = [] # type: List[str]
+
# Do we have a functional LLVM toolchain?
self.have_llvm = False
@@ -227,7 +236,7 @@ class TestConfig:
self.allowed_perf_changes = {}
# The test environment.
- self.test_env = 'local'
+ self.test_env = TestEnv('local')
# terminal supports colors
self.supports_colors = False
@@ -291,12 +300,13 @@ class TestResult:
expected_failures, framework_failures, framework_warnings, unexpected_passes,
unexpected_failures, unexpected_stat_failures lists of TestRun.
"""
- __slots__ = 'directory', 'testname', 'reason', 'way', 'stdout', 'stderr', 'diff', 'runtime'
+ __slots__ = 'directory', 'testname', 'reason', 'way', 'stdout', 'stderr', 'diff', 'runtime', 'io_manager'
def __init__(self,
directory: str,
testname: TestName,
reason: str,
way: WayName,
+ io_manager: Optional[str],
stdout: Optional[str]=None,
stderr: Optional[str]=None,
diff: Optional[str]=None,
@@ -309,6 +319,7 @@ class TestResult:
self.stderr = stderr
self.diff = diff
self.runtime = runtime # Walltime
+ self.io_manager = io_manager # None means the default IO Manager
# A performance metric measured in this test run.
PerfMetric = NamedTuple('PerfMetric',
@@ -367,6 +378,14 @@ class TestOptions:
# add these ways to the default set
self.extra_ways = [] # type: List[WayName]
+ # IO Managers to test (passed as the --io-manager RTS option)
+ # * [None] - only default IO Manager
+ # * [...] - list of io managers e.g. "mio" or "poll"
+ self.io_managers = [None] # type: List[Optional[str]]
+
+ # IO Manager used in the current test case. Set before each test case. None means default IO Manager
+ self.io_manager_current = None # type: Optional[str]
+
# the result we normally expect for this test
self.expect = 'pass'
=====================================
testsuite/driver/testlib.py
=====================================
@@ -23,10 +23,11 @@ import subprocess
from testglobals import config, ghc_env, default_testopts, brokens, t, \
TestRun, TestResult, TestOptions, PerfMetric
-from testutil import strip_quotes, lndir, link_or_copy_file, passed, \
+from testutil import discover_io_managers, strip_quotes, lndir, link_or_copy_file, passed, \
failBecause, residency_testing_metrics, \
stable_perf_counters, \
- PassFail, badResult, str_warn, str_removeprefix
+ PassFail, badResult, str_warn, str_removeprefix, \
+ io_manager_test_name_suffix
from term_color import Color, colored_if
import testutil
from cpu_features import have_cpu_feature
@@ -190,7 +191,7 @@ def no_lint( name, opts ):
def stage1(name, opts):
# See Note [Why is there no stage1 setup function?]
- framework_fail(name, 'stage1 setup function does not exist',
+ framework_fail(name, None,
'add your test to testsuite/tests/stage1 instead')
# Note [Why is there no stage1 setup function?]
@@ -341,7 +342,7 @@ def req_th( name, opts ):
req_interp(name, opts);
if ghc_dynamic():
- return _omit_ways(name, opts, ['profasm', 'profthreaded'])
+ return _omit_ways(name, opts, [WayName('profasm'), WayName('profthreaded')])
def req_plugins( name, opts ):
"""
@@ -355,7 +356,7 @@ def req_plugins( name, opts ):
req_interp(name, opts)
# Plugins aren't supported with the external interpreter (#14335)
- expect_broken_for(14335,['ext-interp'])(name,opts)
+ expect_broken_for(IssueNumber(14335),[WayName('ext-interp')])(name,opts)
if config.cross:
opts.skip = True
@@ -565,10 +566,42 @@ def valid_way( way: WayName ) -> bool:
def extra_ways( ways: List[WayName] ):
def helper( name: TestName, opts ):
_lint_ways(name, ways)
- opts.extra_ways = [way for way in ways if valid_way(way)]
+ opts.extra_ways += [way for way in ways if valid_way(way) and way not in opts.extra_ways]
return helper
+# -----
+
+def _io_managers( name: TestName, opts, io_mgrs: Union[List[str], str] ) -> None:
+ if isinstance(io_mgrs, str):
+ io_mgrs = [io_mgrs]
+ opts.io_managers = io_mgrs
+
+def io_managers( io_mgrs: List[str] ):
+ """
+ Further split test cases into the given IO Managers if available.
+ Available IO Managers are determined by the test case's way (threaded/non-threads) and OS.
+ You'll likely want to use `extra_ways(['threaded2'])` if you want to test threaded IO Managers (e.g. mio).
+ """
+ return lambda name, opts: _io_managers(name, opts, io_mgrs)
+
+def all_available_io_managers( name: TestName, opts ):
+ """
+ Further split test cases into all available IO Managers.
+ Available IO Managers are determined by the test case's way (threaded/non-threads) and OS.
+ You'll likely want to use `extra_ways(['threaded2'])` to ensure threaded IO Managers are tested (e.g. mio).
+ """
+ _io_managers(name, opts, config.io_managers_all)
+
+def all_available_io_managers_except(exclude: Union[List[str], str]):
+ """
+ Further split test cases into all available (except the given excluded) IO Managers.
+ Available IO Managers are determined by the test case's way (threaded/non-threads) and OS.
+ You'll likely want to use `extra_ways(['threaded2'])` to ensure threaded IO Managers are tested (e.g. mio).
+ """
+ if isinstance(exclude, str):
+ exclude = [exclude]
+ return lambda name, opts: _io_managers(name, opts, list(set(config.io_managers_all) - set(exclude)))
# -----
@@ -661,18 +694,15 @@ def collect_size ( deviation, path ):
def collect_size_func ( deviation, path_func ):
return collect_generic_stat ( 'size', deviation, lambda way: os.path.getsize(in_testdir(path_func())) )
-def get_dir_size(path):
+def get_dir_size(path) -> int:
total = 0
- try:
- with os.scandir(path) as it:
- for entry in it:
- if entry.is_file():
- total += entry.stat().st_size
- elif entry.is_dir():
- total += get_dir_size(entry.path)
- return total
- except FileNotFoundError:
- print("Exception: Could not find: " + path)
+ with os.scandir(path) as it:
+ for entry in it:
+ if entry.is_file():
+ total += entry.stat().st_size
+ elif entry.is_dir():
+ total += get_dir_size(entry.path)
+ return total
def collect_size_dir ( deviation, path ):
return collect_size_dir_func ( deviation, lambda: path )
@@ -790,7 +820,7 @@ def find_non_inplace_so(lib):
return _find_so(lib,path_from_ghcPkg(lib, "dynamic-library-dirs"),False)
-def collect_generic_stat ( metric, deviation: Optional[int], get_stat: Callable[[WayName], str]):
+def collect_generic_stat ( metric, deviation: Optional[int], get_stat: Callable[[WayName], Any]):
"""
Define a generic stat test, which computes the statistic by calling the function
given as the third argument.
@@ -1067,6 +1097,9 @@ def have_dynamic_prof( ) -> bool:
def have_profiling( ) -> bool:
return config.have_profiling
+def have_smp() -> bool:
+ return config.ghc_has_smp
+
def have_threaded( ) -> bool:
return config.ghc_with_threaded_rts
@@ -1135,7 +1168,7 @@ def _collect_compiler_perf_counters(counters: Set[str], deviation: Optional[int]
# Slightly hacky, we need the requested perf_counters in 'simple_run'.
# Thus, we have to globally register these counters
opts.compiler_perf_counters += list(counters)
- _collect_stats(name, opts, counters, deviation, False, True, True)
+ _collect_stats(name, opts, counters, deviation, None, True, True)
return f
@@ -1334,21 +1367,22 @@ def check_errmsg(needle):
# grep_errmsg(regex,[groups])
# If groups are given, return only the matched groups
# that matches the regex.
-def grep_errmsg_norm(needle:str, groups = None):
-
- def get_match(str:str):
- m = re.search(needle,str)
- if m:
- return "".join([m.group(g) for g in groups if m.group(g) is not None])
- else:
- return None
+def grep_errmsg_norm(needle:str, groups_may = None):
- def norm(str) -> str:
- if groups == None:
+ def norm(string) -> str:
+ if groups_may == None:
return "".join( filter(lambda l: re.search(needle,l),
- str.splitlines(True)))
+ string.splitlines(True)))
else:
- matches = [get_match(x) for x in str.splitlines(True)]
+ groups = groups_may
+ def get_match(string: str):
+ m = re.search(needle, string)
+ if m:
+ return "".join([m.group(g) for g in groups if m.group(g) is not None])
+ else:
+ return None
+
+ matches = [get_match(x) for x in string.splitlines(True)]
res = "\n".join([x for x in matches if x])
return res
return norm
@@ -1573,6 +1607,15 @@ do_not_copy = ('.hi', '.o', '.dyn_hi'
, '.dyn_o', '.out'
,'.hi-boot', '.o-boot') # 12112
+def way_supports_io_manager(way: WayName, io_manager: Optional[str]) -> bool:
+ # All ways support a default IO Manager
+ if io_manager is None:
+ return True
+
+ way_is_threaded = '-threaded' in config.way_flags[way]
+ available_io_managers = config.io_managers_threaded if way_is_threaded else config.io_managers_nonthreaded
+ return io_manager in available_io_managers
+
async def test_common_work(name: TestName, opts,
func, args) -> None:
try:
@@ -1621,7 +1664,22 @@ async def test_common_work(name: TestName, opts,
# A test itself can request extra ways by setting opts.extra_ways
all_ways = list(OrderedDict.fromkeys(all_ways + [way for way in opts.extra_ways if way not in all_ways]))
- t.total_test_cases += len(all_ways)
+ # We split each way over available io managers
+ if len(opts.io_managers) == 0:
+ framework_fail(name, None, 'opts.io_managers is empty')
+ all_ways_and_io_managers = dict(
+ (
+ way,
+ [io_manager
+ for io_manager in opts.io_managers
+ if way_supports_io_manager(way, io_manager)
+ ]
+ )
+ for way in all_ways
+ )
+
+ for io_managers in all_ways_and_io_managers.values():
+ t.total_test_cases += len(io_managers)
only_ways = getTestOpts().only_ways
ok_way = lambda way: \
@@ -1699,19 +1757,25 @@ async def test_common_work(name: TestName, opts,
# Run the required tests...
for way in do_ways:
- if stopping():
- break
- start = time.monotonic()
- try:
- await do_test(name, way, func, args, files)
- except KeyboardInterrupt:
- stopNow()
- except Exception as e:
- traceback.print_exc()
- framework_fail(name, way, traceback.format_exc(),
- runtime=time.monotonic() - start)
+ for io_manager in all_ways_and_io_managers[way]:
+ if stopping():
+ break
+ start = time.monotonic()
+ try:
+ getTestOpts().io_manager_current = io_manager
+ await do_test(name ,way ,func ,args ,files)
+ except KeyboardInterrupt:
+ stopNow()
+ except Exception as e:
+ traceback.print_exc()
+ framework_fail(name, way, traceback.format_exc(),
+ runtime=time.monotonic() - start)
+ finally:
+ getTestOpts().io_manager_current = None
+
+ for skipped_way in set(all_ways) - set(do_ways):
+ t.n_tests_skipped += len(all_ways_and_io_managers[skipped_way])
- t.n_tests_skipped += len(set(all_ways) - set(do_ways))
if getTestOpts().expect == 'missing-lib': t.n_missing_libs += 1
if config.cleanup and do_ways:
@@ -1737,7 +1801,8 @@ async def do_test(name: TestName,
opts = getTestOpts()
start = time.monotonic()
- full_name = name + '(' + way + ')'
+ io_manager = opts.io_manager_current
+ full_name = name + '(' + way + ')' + io_manager_test_name_suffix(io_manager)
test_n = len(allTestNames)
progress_args = [ full_name, t.total_tests, test_n,
[len(t.unexpected_passes),
@@ -1831,22 +1896,21 @@ async def do_test(name: TestName,
if way in opts.fragile_ways:
if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail'))
if result.passed:
- t.fragile_passes.append(TestResult(directory, name, 'fragile', way,
- runtime=runtime))
+ t.fragile_passes.append(TestResult(directory, name, 'fragile', way, io_manager, runtime=runtime))
else:
reason = '%s (fragile)' % result.reason if result.reason else 'fragile'
- t.fragile_failures.append(TestResult(directory, name, reason, way,
+ t.fragile_failures.append(TestResult(directory, name, reason, way, io_manager,
stdout=result.stdout,
stderr=result.stderr,
diff=result.diff,
runtime=runtime))
elif result.passed:
if _expect_pass(way):
- t.expected_passes.append(TestResult(directory, name, "", way,
+ t.expected_passes.append(TestResult(directory, name, "", way, io_manager,
runtime=runtime))
else:
if_verbose(1, '*** unexpected pass for %s' % full_name)
- t.unexpected_passes.append(TestResult(directory, name, 'unexpected', way,
+ t.unexpected_passes.append(TestResult(directory, name, 'unexpected', way, io_manager,
runtime=runtime))
else:
if _expect_pass(way):
@@ -1854,11 +1918,11 @@ async def do_test(name: TestName,
tag = result.tag
if tag == 'stat':
if_verbose(1, '*** unexpected stat test failure for %s' % full_name)
- t.unexpected_stat_failures.append(TestResult(directory, name, reason, way,
+ t.unexpected_stat_failures.append(TestResult(directory, name, reason, way, io_manager,
runtime=runtime))
else:
if_verbose(1, '*** unexpected failure for %s' % full_name)
- tr = TestResult(directory, name, reason, way,
+ tr = TestResult(directory, name, reason, way, io_manager,
stdout=result.stdout,
stderr=result.stderr,
diff=result.diff,
@@ -1867,7 +1931,7 @@ async def do_test(name: TestName,
else:
# Only keep the reason: nothing reports the output of expected
# failures.
- t.expected_failures.append(TestResult(directory, name, result.reason, way,
+ t.expected_failures.append(TestResult(directory, name, result.reason, way, io_manager,
runtime=runtime))
# Make is often invoked with -s, which means if it fails, we get
@@ -1892,21 +1956,23 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str
directory = _result_directory(opts)
except:
directory = ''
- full_name = '%s(%s)' % (name, way)
+ io_manager = opts.io_manager_current
+ full_name = '%s(%s)%s' % (name, way, io_manager_test_name_suffix(io_manager))
if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason))
name2 = name if name is not None else TestName('none')
way2 = way if way is not None else WayName('none')
if way not in opts.fragile_ways:
# If the test is fragile then we rather report this as a fragile test failure
- t.framework_failures.append(TestResult(directory, name2, reason, way2,
+ t.framework_failures.append(TestResult(directory, name2, reason, way2, io_manager,
runtime=runtime))
def framework_warn(name: TestName, way: WayName, reason: str) -> None:
opts = getTestOpts()
directory = _result_directory(opts)
- full_name = name + '(' + way + ')'
+ io_manager = opts.io_manager_current
+ full_name = name + '(' + way + ')' + io_manager_test_name_suffix(io_manager)
if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason))
- t.framework_warnings.append(TestResult(directory, name, reason, way))
+ t.framework_warnings.append(TestResult(directory, name, reason, way, io_manager))
# -----------------------------------------------------------------------------
# Generic command tests
@@ -1920,7 +1986,7 @@ def framework_warn(name: TestName, way: WayName, reason: str) -> None:
# run_command.
async def run_command( name, way, cmd ):
- return await simple_run( name, '', override_options(cmd), '' )
+ return await simple_run( name, WayName(''), override_options(cmd), '' )
async def makefile_test( name, way, target=None ):
if target is None:
@@ -2006,7 +2072,7 @@ async def multi_compile_fail( name, way, top_mod, extra_mods, extra_hc_opts ):
return await do_compile( name, way, True, top_mod, extra_mods, [], extra_hc_opts)
async def make_depend( name, way, mods, extra_hc_opts ):
- return await do_compile( name, way, False, ' '.join(mods), [], [], extra_hc_opts, mode = '-M')
+ return await do_compile( name, way, False, Path(' '.join(mods)), [], [], extra_hc_opts, mode = '-M')
async def do_compile(name: TestName,
way: WayName,
@@ -2137,7 +2203,7 @@ async def compile_grep_core(name: TestName,
async def compile_and_run__(name: TestName,
way: WayName,
- top_mod: Path,
+ top_mod: Optional[Path],
extra_mods: List[str],
extra_hc_opts: str,
backpack: bool=False,
@@ -2420,6 +2486,9 @@ async def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: st
my_rts_flags = rts_flags(way)
+ if opts.io_manager_current is not None:
+ my_rts_flags += ' +RTS --io-manager={0} -RTS '.format(opts.io_manager_current)
+
# Collect runtime stats if necessary:
# isStatsTest and not isCompilerStatsTest():
# assume we are running a ghc compiled program. Collect stats.
@@ -2445,6 +2514,12 @@ async def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: st
output_file = perfStatsFile(False, name)
+ # Check that IO Manager is available
+ if opts.io_manager_current is not None:
+ available_io_managers = discover_io_managers(prog, opts.testdir)
+ if opts.io_manager_current not in available_io_managers:
+ framework_fail(name, way, 'IO Manager {} unexpectedly unavailable (available IO Managers: {}). `-non-threaded`/`-threaded` is only supported through way RTS flags (not manually added via test modifiers/args) when testing over IO Managers.'.format(opts.io_manager_current, available_io_managers))
+
# run the command
exit_code = await runCmdPerf(opts.compiler_perf_counters, cmd, output_file,
working_dir=opts.testdir,
@@ -2506,7 +2581,7 @@ def rts_flags(way: WayName) -> str:
async def interpreter_run(name: TestName,
way: WayName,
extra_hc_opts: str,
- top_mod: Path
+ top_mod: Optional[Path]
) -> PassFail:
opts = getTestOpts()
@@ -2877,11 +2952,11 @@ async def compare_outputs(
if config.accept_platform:
if_verbose(1, 'Accepting new output for platform "'
+ config.platform + '".')
- expected_path += '-' + config.platform
+ expected_path = Path(str(expected_path) + '-' + config.platform)
elif config.accept_os:
if_verbose(1, 'Accepting new output for os "'
+ config.os + '".')
- expected_path += '-' + config.os
+ expected_path = Path(str(expected_path) + '-' + config.os)
else:
if_verbose(1, 'Accepting new output.')
@@ -3511,7 +3586,7 @@ def find_expected_file(name: TestName, suff: str, way: WayName) -> Path:
for f in files:
if in_srcdir(f).exists():
- return f
+ return Path(f)
return basename
@@ -3725,21 +3800,24 @@ def strip_diff_header(diff: Optional[str]) -> Optional[str]:
return diff
def sorted_results(testInfos: List[TestResult]) -> List[TestResult]:
- return sorted(testInfos, key=lambda r: (r.testname.lower(), r.directory, r.way))
+ return sorted(testInfos, key=lambda r: (r.testname.lower(), r.directory, r.way,
+ r.io_manager or ''))
# A failure-output block: a representative result, its header-stripped diff,
# and the ways that share it.
OutputGroup = Tuple[TestResult, Optional[str], List[WayName]]
# Tests that fail identically in several ways (e.g. normal and g1) share one
-# output block, with the ways collected in the header.
+# output block, with the ways collected in the header. Results from different
+# IO Managers are kept in separate blocks, so that each header can name its IO
+# Manager.
def groupTestOutput(testInfos: List[TestResult]) -> List[OutputGroup]:
# Relies on dicts preserving insertion order.
groups = {} # type: Dict[Tuple, OutputGroup]
for result in sorted_results(testInfos):
diff = strip_diff_header(result.diff)
- key = (result.testname, result.directory, result.reason,
- diff, result.stdout, result.stderr)
+ key = (result.testname, result.directory, result.io_manager,
+ result.reason, diff, result.stdout, result.stderr)
groups.setdefault(key, (result, diff, []))[2].append(result.way)
return list(groups.values())
@@ -3754,8 +3832,9 @@ def printTestOutputSummary(file: TextIO,
where = ', see {}'.format(junit_path) if junit_path else ''
for result, diff, ways in groups:
- header = '=====> {}({}) ({}) [{}]'.format(
- result.testname, ', '.join(ways), result.directory + os.sep, result.reason)
+ header = '=====> {}({}){} ({}) [{}]'.format(
+ result.testname, ', '.join(ways), io_manager_test_name_suffix(result.io_manager),
+ result.directory + os.sep, result.reason)
file.write(colored_if(color, Color.RED, header) + '\n')
# See Note [Redundant output in test results] for why these don't overlap.
for label, contents in [('Output diff (expected vs actual):', diff),
@@ -3779,7 +3858,8 @@ def printTestOutputSummary(file: TextIO,
def printTestInfosSummary(file: TextIO, testInfos):
for result in sorted_results(testInfos):
path = os.path.join(result.directory, result.testname)
- file.write(' {path} [{r.reason}] ({r.way})\n'.format(r=result, path=path))
+ file.write(' {path} [{r.reason}] ({r.way}){io}\n'.format(
+ r=result, path=path, io=io_manager_test_name_suffix(result.io_manager)))
file.write('\n')
def modify_lines(s: str, f: Callable[[str], str]) -> str:
=====================================
testsuite/driver/testutil.py
=====================================
@@ -1,4 +1,5 @@
import os
+import re
import subprocess
import shutil
import tempfile
@@ -179,3 +180,26 @@ def shorten_metric_name(name: str) -> str:
"binary_size/if_compression(3)": "size/3",
}
return dic.get(name, name)
+
+# I/O manager discovery for a haskell binary. Returns the set of IO Manager
+# strings supported by the binary
+def discover_io_managers(hs_exe: Union[str, Path], cwd: Union[str, Path]) -> Set[str]:
+ rp = subprocess.run(
+ [str(hs_exe), '+RTS', '--info', '-RTS'],
+ cwd=cwd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL)
+ stdout = rp.stdout.decode('utf-8', errors='replace')
+
+ m = re.search(r'\("I/O managers", "(.*)"\)', stdout)
+ if not m:
+ raise Exception('Expected stdout output of form \'... ("I/O managers", "select selectbis poll") ...\' but got:\n{}'.format(stdout))
+
+ return set(m.group(1).split())
+
+# Suffix appended to a test case's name to identify the IO Manager it was run
+# with. Empty for the default IO Manager (None) so that output is unchanged.
+def io_manager_test_name_suffix(io_manager: Optional[str]) -> str:
+ if io_manager is None:
+ return ''
+ return ' (IO Manager: {})'.format(io_manager)
=====================================
testsuite/tests/cmm/should_run/all.T
=====================================
@@ -56,7 +56,7 @@ test('T25601',
test('T27447',
[ req_cmm
, extra_ways(['optasm'])
- , when(have_llvm(), extra_ways(['optasm', 'optllvm']))
+ , when(have_llvm(), extra_ways(['optllvm']))
],
multi_compile_and_run,
['T27447', [('T27447_cmm.cmm', '')], ''])
=====================================
testsuite/tests/primops/should_run/all.T
=====================================
@@ -41,9 +41,9 @@ test('T14664', normal, compile_and_run, [''])
test('CStringLength', normal, compile_and_run, ['-O2'])
test('NonNativeSwitch', normal, compile_and_run, ['-O2'])
test('Sized', [
+ extra_ways(['ghci','ghci-opt']),
# optasm is broken with js backend: #25922
- extra_ways(['optasm','ghci','ghci-opt']) if not js_arch()
- else extra_ways(['ghci','ghci-opt'])
+ when(not js_arch(), extra_ways(['optasm']))
], compile_and_run, [''])
test('LevPolyPtrEquality1', normal, compile_and_run, [''])
=====================================
testsuite/tests/rts/all.T
=====================================
@@ -679,8 +679,10 @@ test('T23142', [unless(debug_rts(), skip), req_interp], makefile_test, ['T23142'
test('T23400', [], compile_and_run, ['-with-rtsopts -A8k'])
test('IOManager', [js_skip, when(arch('wasm32'), skip), when(opsys('mingw32'), skip),
- pre_cmd('$MAKE -s --no-print-directory IOManager.hs')],
- compile_and_run, [''])
+ pre_cmd('$MAKE -s --no-print-directory IOManager.hs'),
+ when(have_smp(), extra_ways(['threaded2'])),
+ all_available_io_managers_except(['winio', 'mio'])],
+ compile_and_run, [''])
test('T24142', [req_target_smp], compile_and_run, ['-threaded -with-rtsopts "-N2"'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d72505e46f1bafff068bb7d995c9d9…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d72505e46f1bafff068bb7d995c9d9…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] testsuite: Fix T17088 flakiness and restore bug coverage
by Marge Bot (@marge-bot) 12 Nov '26
by Marge Bot (@marge-bot) 12 Nov '26
12 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
d72505e4 by Simon Jakobi at 2026-11-12T15:26:14-05:00
testsuite: Fix T17088 flakiness and restore bug coverage
T17088 reads and prints a byte from an uninitialized array. Debug RTS
ways fill allocated memory with 0xaa, so the test can fail due to an
output mismatch unrelated to the pointer-tagging bug it covers.
Initialize the byte to zero to make the output deterministic.
The original bug requires the compacting collector and particular
compiler and RTS settings. Run the test only in the compacting_gc way
with -O1 and -A128k. Also disable STG lambda lifting because it removes
the closure shape needed to reproduce the pointer-tagging failure.
This makes the test reliable while ensuring it remains an effective
reproducer for #17088.
Closes #27534.
Assisted-by: gpt-5.6-sol via Codex CLI
- - - - -
2 changed files:
- testsuite/tests/rts/T17088.hs
- testsuite/tests/rts/all.T
Changes:
=====================================
testsuite/tests/rts/T17088.hs
=====================================
@@ -2,6 +2,9 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
+-- Lambda lifting removes the closure shape needed to reproduce #17088.
+{-# OPTIONS_GHC -fno-stg-lift-lams #-}
+
module Main (main) where
import Data.Word
@@ -27,7 +30,9 @@ instance Show Bytes where
bytesAllocRet :: Int -> IO Bytes
bytesAllocRet (I# sz) =
IO $ \s -> case newAlignedPinnedByteArray# sz 8# s of
- (# s', mba #) -> (# s', Bytes mba #)
+ (# s', mba #) ->
+ case writeWord8Array# mba 0# (wordToWord8# 0##) s' of
+ s'' -> (# s'', Bytes mba #)
------------------------------------------------------------------------
=====================================
testsuite/tests/rts/all.T
=====================================
@@ -554,8 +554,11 @@ test('RestartEventLogging',
compile_and_run, ['RestartEventLogging_c.c'])
test('T17088',
- [extra_ways(['compacting_gc']), extra_run_opts('+RTS -A256k -RTS')],
- compile_and_run, ['-rtsopts -O2'])
+ [ only_ways(['compacting_gc'])
+ , extra_ways(['compacting_gc'])
+ , extra_run_opts('+RTS -A128k -RTS')
+ ],
+ compile_and_run, ['-rtsopts -O1'])
test('T15427', js_broken(22374), compile_and_run, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d72505e46f1bafff068bb7d995c9d95…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d72505e46f1bafff068bb7d995c9d95…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc] Pushed new branch wip/angerman/rts-simd-memcmp
by Moritz Angermann (@angerman) 12 Nov '26
by Moritz Angermann (@angerman) 12 Nov '26
12 Nov '26
Moritz Angermann pushed new branch wip/angerman/rts-simd-memcmp at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/angerman/rts-simd-memcmp
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/jeltsch/smaller-pit] Restrict storage of interface hashes to the `Final` phase
by Wolfgang Jeltsch (@jeltsch) 12 Nov '26
by Wolfgang Jeltsch (@jeltsch) 12 Nov '26
12 Nov '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/smaller-pit at Glasgow Haskell Compiler / GHC
Commits:
8a73448f by Wolfgang Jeltsch at 2026-11-12T20:34:27+02:00
Restrict storage of interface hashes to the `Final` phase
- - - - -
1 changed file:
- compiler/GHC/Unit/Module/ModIface.hs
Changes:
=====================================
compiler/GHC/Unit/Module/ModIface.hs
=====================================
@@ -78,6 +78,7 @@ module GHC.Unit.Module.ModIface
, IfaceCache_ (..)
, IfaceSimplifiedCore (..)
, withSelfRecomp
+ , IfaceHashData
, IfaceSelfRecompData
, IfaceSimplifiedCoreData
, ExtensibleFieldsData
@@ -252,6 +253,11 @@ type family IfaceBinHandle (phase :: ModIfacePhase) where
IfaceBinHandle 'ModIfaceFinal = FullBinData
IfaceBinHandle 'ModIfaceRetained = Void
+type family IfaceHashData (phase :: ModIfacePhase) where
+ IfaceHashData 'ModIfaceCore = ()
+ IfaceHashData 'ModIfaceFinal = Fingerprint
+ IfaceHashData 'ModIfaceRetained = ()
+
type family IfaceSelfRecompData (phase :: ModIfacePhase) where
IfaceSelfRecompData 'ModIfaceCore = Maybe IfaceSelfRecomp
IfaceSelfRecompData 'ModIfaceFinal = Maybe IfaceSelfRecomp
@@ -364,7 +370,7 @@ data ModIface_ (phase :: ModIfacePhase)
-- when taking partially defined values into account, because
-- @Strict.Just undefined@ is @undefined@ and so @Nothing@ and
-- @undefined@ are the only inhabitants of that type.
- mi_iface_hash_ :: Fingerprint, -- A hash of the whole interface
+ mi_iface_hash_ :: IfaceHashData phase, -- A hash of the whole interface
mi_mod_info_ :: IfaceModInfo,
-- ^ Meta information about the module the interface file is for
@@ -870,7 +876,7 @@ emptyPartialModIface mod
= PrivateModIface
{
mi_hi_bytes_ = Strict.Nothing,
- mi_iface_hash_ = fingerprint0,
+ mi_iface_hash_ = (),
mi_mod_info_ = emptyIfaceModInfo mod,
mi_deps_ = noDependencies,
mi_public_ = emptyPartialIfacePublic,
@@ -927,8 +933,9 @@ emptyModIface mod
| PrivateModIface {..} <- emptyPartialModIface mod
= PrivateModIface
{
- mi_hi_bytes_ = Strict.Nothing,
- mi_public_ = convertIfacePublic mi_public_,
+ mi_hi_bytes_ = Strict.Nothing,
+ mi_iface_hash_ = fingerprint0,
+ mi_public_ = convertIfacePublic mi_public_,
..
}
where
@@ -987,7 +994,8 @@ emptyIfaceHashCache _occ = Nothing
-- ModIface is completely forced since it will live in memory for a long time.
-- If forcing it uses a lot of memory, then store less things in ModIface.
-instance ( NFData (IfaceSelfRecompData phase)
+instance ( NFData (IfaceHashData phase)
+ , NFData (IfaceSelfRecompData phase)
, NFData (IfaceSimplifiedCoreData phase)
, NFData (ExtensibleFieldsData phase)
, NFData (IfaceAnnotationsData phase)
@@ -1133,6 +1141,7 @@ retainedModIface PrivateModIface {..}
= PrivateModIface
{
mi_hi_bytes_ = Strict.Nothing,
+ mi_iface_hash_ = (),
mi_public_ = retainedIfacePublic mi_public_,
mi_self_recomp_ = (),
mi_simplified_core_ = (),
@@ -1371,7 +1380,7 @@ pattern ModIface ::
-> Module
-> Maybe Module
-> HscSource
- -> Fingerprint
+ -> IfaceHashData phase
-> Dependencies
-> IfacePublic_ phase
-> [IfaceExport]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8a73448f89366b64ba72527aa88f93d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8a73448f89366b64ba72527aa88f93d…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/davide/windows-dlls_sysm-test_master] 25 commits: rts: add missing nonmoving write barrier in out-of-line array copies
by David Eichmann (@DavidEichmann) 12 Nov '26
by David Eichmann (@DavidEichmann) 12 Nov '26
12 Nov '26
David Eichmann pushed to branch wip/davide/windows-dlls_sysm-test_master at Glasgow Haskell Compiler / GHC
Commits:
24927752 by Luite Stegeman at 2026-11-09T09:21:24-05:00
rts: add missing nonmoving write barrier in out-of-line array copies
The out-of-line entries stg_copyArrayzh/stg_copyMutableArrayzh (taken
whenever the element count of copyArray#/copyMutableArray# is not a
compile-time constant) didn't push the overwritten elements to the
nonmoving collector's remembered set.
Fixes #27376
- - - - -
6dbcca65 by Rodrigo Mesquita at 2026-11-09T09:22:06-05:00
interp: Set per-thread break flags consistently on eval/resume
Currently, the per-thread flags are:
- Single-step: Stop at the immediate next breakpoint in this thread
- Step-out: Stop at the next continuation with a breakpoint this thread
returns to.
- Break-on-exception: Stop the next time a synchronous exception is
raised in this thread.
Originally, these flags were all set globally across all threads. More
recently, these flags are set per-thread when `resume`ing that thread,
but globally when starting the evaluation of a new expression
(`evalStmt`).
With this commit, we now use per-TSO flags in both scenarios evaluating
expressions in the interpreter (`evalStmt` and `resumeStmt`).
- In `resumeStmt` we set the `EvalOpts` specifically in the `ThreadId`
being resumed.
- In `evalStmt`, we set the `EvalOpts` exclusively on the sandbox thread
we fork to evaluate the given expression
- When not using the sandbox thread (i.e. -fno-ghci-sandbox), we
don't support the debugger anyway, so the break flags are
irrelevant.
We do this by consistently calling `setBreakFlags` when starting,
resuming, or killing the evaluation.
See Note [Always setBreakFlags on running thread].
This slightly changes the behavior of evaluating a new expression in
the debugger (resuming a thread behaves the same as before). Namely,
`:step <expr>`, where <expr> forks a thread, will stop at the immediate
next breakpoint in the <expr> main thread, not on a breakpoint of any
forked thread.
NB: the forked thread may still stop at breakpoint, if it is enabled by
index specifically, and then :step-ing from that thread's breakpoint
will toggle per-thread stepping for that forked thread.
We will want to control stepping in "all threads, regardless of whether
we control them or if they were spawned by the debuggee" separately from
the commands which trigger evaluation of just an expression. Namely,
we'll likely want a "break at the next immediate breakpoint hit on ANY
thread" command that the user can execute before launching a debuggee
which is multi-threaded. This may even be the default for GHCi.
Towards #26064
Fixes #28080
- - - - -
19ff36f2 by Simon Jakobi at 2026-11-09T09:22:47-05:00
testsuite: Mark T8209 fragile for the ghci ways on FreeBSD and darwin
A shutdown race in the I/O manager intermittently fails T8209(ghci) on
x86_64-freebsd14-validate and aarch64-darwin-validate, recently killing
several Marge batches. Mark it fragile there until the race is fixed.
See #27948.
Assisted-by: Claude Opus 5.5
- - - - -
212c292f by Rajkumar Natarajan at 2026-11-11T13:54:08-05:00
document what ->>> stands for in heap profile
updates the profiling section of the user's guide to explain how types
are approximated when using -hy. Also adds haddocks to getTyDescription
with the same information.
Fixes #26754
- - - - -
c64fc319 by Jonathan at 2026-11-11T13:54:55-05:00
Fix AArch64 veneer target for relocations with an addend
Fixes #27807
The RTS linker would construct invalid relocation veneers on AArch64 if
the addend was non-zero, which typically caused SIGILL crashes. This
could be triggered by evaluating Template Haskell in a package with a
large number of dependencies using a static build of GHC.
- - - - -
cd4dce19 by Kazu Yamamoto at 2026-11-11T13:55:45-05:00
testsuite: add a test for registerFd_ trusting the callback table (#27821)
registerFd001 shows a 'threadWaitRead' that never finishes after an fd is
closed with 'closeFd' rather than 'closeFdWith'. Darwin is the only platform
this reaches -- one-shot registrations are implemented but not used there
(#7651) -- so the test is expect_broken on Darwin only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
5ab442ee by Kazu Yamamoto at 2026-11-11T13:55:45-05:00
registerFd_: always tell the polling backend (#27821)
Where the backend has no one-shot registrations, 'registerFd_' now tells it
about every registration, rather than only when the events differ from the
ones the callback table records: the table alone cannot say whether the
backend still knows the fd. The 'modify' it returns is unchanged. See Note
[Do not trust the callback table].
This fixes registerFd001 and clears its expect_broken.
Changelog wording from Duncan Coutts in review.
Co-Authored-By: Claude Opus 5 (1M context) <noreply(a)anthropic.com>
- - - - -
ab8b5b06 by Vladislav Zavialov at 2026-11-11T13:56:27-05:00
Curried contexts in prefix GADT constructors (#27424)
Prefix GADT constructor declarations now accept multiple consecutive
contexts, equivalent to a single conjoined context:
data G a where
MkCurried :: C a => (D a, E a) => G a
MkConjoined :: (C a, D a, E a) => G a
This is a step towards GHC Proposal #402 "Stable GADT constructor syntax".
To represent multiple contexts, the `con_mb_cxt` field of `ConDeclGADT` has
been replaced by `con_cxts`, which stores a list instead of a Maybe:
- con_mb_cxt :: Maybe (LHsContext pass)
+ con_cxts :: [LHsContext pass]
The rest of this patch follows from this change.
Note that in ConDeclH98, the optional context is still stored as a Maybe.
To accommodate this difference, a few helper functions were generalised over
a Foldable container `t`:
hsConDeclTheta :: Foldable t => t (LHsContext ...) -> [LHsType ...]
pprLHsContext :: (Foldable t, ...) => t (LHsContext ...) -> SDoc
repContexts :: Foldable t => t (LHsContext GhcRn) -> MetaM (Core (M TH.Cxt))
tcHsContext :: Foldable t => t (LHsContext GhcRn) -> TcM [PredType]
In practice, the instantiations of `t` are either `Maybe` or `[]`.
Record-style GADT constructors continue to accept at most one context.
`splitLHsGadtTy` accounts for this by splitting off only the first context
if it detects record syntax, leaving the offending part of the type in the
body for the renamer to reject later on.
Test cases: T12087a T27424a T27424b T27424c T27424d GadtConSigs_th_dump1
- - - - -
d2f135ff by Sylvain Henry at 2026-11-11T13:57:22-05:00
NCG: cache register usage in liveness annotations
regUsageOfInstr allocates fresh register lists on every call, and on the
linear allocator path it was called three times per instruction: in the
backward liveness pass, in the forward liveness pass and in the allocator
itself. Store the usage computed by the backward pass in the Liveness
annotation and reuse it in the other passes (and in the graph allocator's
spill passes). patchRegsLiveInstr recomputes it for the patched
instruction.
See Note [Cached register usage in liveness annotations].
Part of #28008.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
ff0a5d32 by Sylvain Henry at 2026-11-11T13:57:22-05:00
NCG: describe register usage with a small DSL
This new register usage DSL (see Note [Register usage DSL] in
GHC.CmmToAsm.RegUsage) reduces allocation compared to the previous
list-based approach.
Fixes #28008.
Metric Decrease:
ManyAlternatives
T12707
T13035
T13379
T13960
T18698b
T19695
T21839c
T3064
T3294
T4801
T5321FD
T5321Fun
T783
T9198
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
51f38f3a by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock-library: fix the build of the spec and fixtures test suites
The documentation pipeline moved from String to Text (commit 202ed264141)
but the two test suites of haddock-library were left behind and no
longer compiled. They are not run by GHC's CI (see #16206), so this went
unnoticed.
The fixtures suite still has four pre-existing failures (list-blocks1,
table1, table4, table5) that are not addressed here.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
394d9d6d by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock: parse backtick spans as monospaced text
A backtick span whose content is not a valid Haskell identifier, such as
`foo bar`, was rendered as plain text with literal backticks. It is now
parsed as monospaced text, like @foo bar@. A closed backtick span whose
whole content is one identifier keeps its meaning as a hyperlinked
identifier. A span such as `foldl' f z xs` is code: it is no longer read
as the identifier foldl between a backtick and a single quote. The
TeX-style form `foo' stays an identifier when no backtick closes the
span on the same line.
Code spans follow the CommonMark rules: a span opened by a run of N
backticks ends at the next run of exactly N backticks on the same line,
so ``x `plus` y`` is code "x `plus` y". One space is removed at each end
when both are present, and an unclosed opening run is plain text. The
content is literal: no markup is parsed and backslashes are kept, so
`\x -> x` renders as written.
See Note [Backtick code spans] in Documentation.Haddock.Parser.
Fixes #28090
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
7ae41c37 by Sylvain Henry at 2026-11-11T13:58:14-05:00
Use 'T' instead of `T' in Haddock comments next to backtick spans
With backtick code spans, a TeX-style quote `T' followed by a backtick on
the same line opens a code span up to that backtick. Use the 'T' form in
the Haddock comments where this happens.
See Note [Backtick code spans] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
ce96f0b6 by Sylvain Henry at 2026-11-11T13:58:14-05:00
haddock: do not parse backtick spans inside @...@
Text between @...@ is already code, so backtick code spans are no longer
parsed there. Thus in
@x <- f -- of type `M Bool`@
the backticks stay as text. Inline markup inside @...@, such as /.../,
passes this context down.
See Note [Backticks in code] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
744b3036 by Sylvain Henry at 2026-11-11T13:58:15-05:00
haddock: keep the backticks of infix identifiers inside @...@
A backticked identifier inside @...@ was always rendered without its
backticks, so @f `elem` xs@ rendered as "f elem xs". Now an identifier
in an infix application or an operator section, such as @f `elem` xs@
or @(`elem` xs)@, is parsed in infix form, as if written ``elem``, and
renders with its backticks and with elem linked. Elsewhere, as in
@`foldlM` :: ...@, the backticks still only mark the link.
See Note [Backticks in code] in Documentation.Haddock.Parser.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
0d8e1f8d by Sylvain Henry at 2026-11-11T13:59:05-05:00
PPC NCG: print non-standard NaN literals in target byte order
The PowerPC NCG printed a non-standard NaN literal byte by byte with
floatToBytes/doubleToBytes, which use the byte order of the host. This
is wrong when the host and the target have a different endianness (e.g.
from x86_64 to big-endian PowerPC). Print the bits with `.long`/`.quad`
instead, so that the assembler uses the target byte order.
Also make `ppr_item` print its argument: some clauses printed the
literal of `pprDataItem` instead.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
5a9db1ed by Sylvain Henry at 2026-11-11T13:59:05-05:00
Print all NaN literals as integer bits (#28101)
The x86 and PowerPC NCGs printed the quiet NaNs 0x7fc00000 and
0x7ff8000000000000 as `.float NaN`/`.double NaN`. GNU as and clang
encode these with all mantissa bits set, so constant-folded bit casts
of these values gave 0x7fffffff/0x7fffffffffffffff. The C backend
printed every NaN as `NAN`, losing its sign and payload.
Now the NCGs print all NaNs with `.long`/`.quad` and the C backend with
hs_bitcastword2float/hs_bitcastword642double.
See Note [Printing NaN literals].
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
b4ceb6a9 by mangoiv at 2026-11-11T13:59:47-05:00
ci: fix ghcup nightly script misbehaviour
- download all jobs instead of just the first 100
- stop using a canary job to detect whether it's a nightly or release
pipeline
- - - - -
aefa0c1b by Alan Zimmerman at 2026-11-11T14:00:28-05:00
EPA: Use AnnList in HsMultiIf
It introduces layout, capture it
- - - - -
5496d626 by David Eichmann at 2026-11-12T15:49:21+00:00
rts: Expose getRtsSymbols() and store redirect labels and external symbols tag
- - - - -
a28246dc by David Eichmann at 2026-11-12T15:49:21+00:00
hadrian: when running tests, properly set have_gdb and have_readelf
- - - - -
c28bcb9e by David Eichmann at 2026-11-12T15:49:21+00:00
testsuite: add have_ldd() test modifier
- - - - -
8373af75 by David Eichmann at 2026-11-12T15:49:21+00:00
testsuite driver: on windows, ensure PATH correctly contains mingw and ghc-pkg libraries
- - - - -
ecd0c204 by David Eichmann at 2026-11-12T15:49:21+00:00
testsuite: driver now sets WAY_FLAGS variable for makefile tests
- - - - -
b7a4f5d8 by David Eichmann at 2026-11-12T15:49:21+00:00
Add golden test for rts/RtsSymbols.c
This test compares declared symbols against symbols observed
in the rts DSO (.so file).
- - - - -
133 changed files:
- .gitlab-ci.yml
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- + changelog.d/27821
- + changelog.d/28080
- + changelog.d/28101
- + changelog.d/T26754
- changelog.d/allow-gadt-prefix-con-parens
- + changelog.d/fix-aarch64-veneer-target-16686
- + changelog.d/fix-copyarray-nonmoving-barrier-27376
- + changelog.d/gadt-curried-contexts-27424
- + changelog.d/ncg-reg-usage.md
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/LA64/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/RV64/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- + compiler/GHC/CmmToAsm/RegUsage.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Literal/Floating.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- compiler/Language/Haskell/Syntax/Type.hs
- compiler/ghc.cabal.in
- docs/users_guide/exts/gadt_syntax.rst
- docs/users_guide/profiling.rst
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/base/src/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Manager.hs
- libraries/ghci/GHCi/Run.hs
- rts/Linker.c
- rts/LinkerInternals.h
- rts/PrimOps.cmm
- rts/RtsSymbols.c
- rts/RtsSymbols.h
- rts/include/Cmm.h
- rts/include/Rts.h
- + rts/include/rts/RtsSymbols.h
- rts/linker/PEi386.c
- rts/linker/elf_reloc_aarch64.c
- rts/rts.cabal
- rts/sm/NonMovingMark.c
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
- + testsuite/tests/cmm/should_run/T28101.hs
- + testsuite/tests/cmm/should_run/T28101.stdout
- + testsuite/tests/cmm/should_run/T28101_cmm.cmm
- testsuite/tests/cmm/should_run/all.T
- testsuite/tests/concurrent/should_run/all.T
- + testsuite/tests/concurrent/should_run/registerFd001.hs
- + testsuite/tests/concurrent/should_run/registerFd001.stdout
- − testsuite/tests/gadt/T12087.stderr
- + testsuite/tests/gadt/T12087a.hs
- testsuite/tests/gadt/T12087.hs → testsuite/tests/gadt/T12087b.hs
- + testsuite/tests/gadt/T12087b.stderr
- + testsuite/tests/gadt/T27424a.hs
- + testsuite/tests/gadt/T27424b.hs
- + testsuite/tests/gadt/T27424b.stderr
- testsuite/tests/gadt/all.T
- testsuite/tests/ghci.debugger/scripts/all.T
- + testsuite/tests/ghci.debugger/scripts/break037.hs
- + testsuite/tests/ghci.debugger/scripts/break037.script
- + testsuite/tests/ghci.debugger/scripts/break037.stdout
- testsuite/tests/ghci/linking/T25155_iserv_main.c
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/printer/Makefile
- testsuite/tests/printer/T18791.stderr
- + testsuite/tests/printer/T27424c.hs
- testsuite/tests/printer/Test20297.hs
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/all.T
- + testsuite/tests/rts/T27376.hs
- + testsuite/tests/rts/T27376.stdout
- testsuite/tests/rts/all.T
- testsuite/tests/rts/linker/Makefile
- + testsuite/tests/rts/linker/T27807.s
- + testsuite/tests/rts/linker/T27807.stdout
- testsuite/tests/rts/linker/all.T
- + testsuite/tests/rts/symbols/Main.hs
- + testsuite/tests/rts/symbols/Makefile
- + testsuite/tests/rts/symbols/all.T
- + testsuite/tests/rts/symbols/dumpDeclaredSymbols.c
- + testsuite/tests/rts/symbols/rts-check-symbols.sh
- + testsuite/tests/rts/symbols/rts-check-symbols.stdout
- testsuite/tests/th/GadtConSigs_th_dump1.hs
- testsuite/tests/th/GadtConSigs_th_dump1.stderr
- + testsuite/tests/th/T27424d.hs
- + testsuite/tests/th/T27424d.stderr
- testsuite/tests/th/all.T
- utils/check-exact/ExactPrint.hs
- utils/haddock/CHANGES.md
- utils/haddock/doc/markup.rst
- utils/haddock/haddock-api/haddock-api.cabal
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-library/CHANGES.md
- utils/haddock/haddock-library/fixtures/Fixtures.hs
- + utils/haddock/haddock-library/fixtures/examples/codeBackticks.input
- + utils/haddock/haddock-library/fixtures/examples/codeBackticks.parsed
- + utils/haddock/haddock-library/fixtures/examples/codeDoubleBackticks.input
- + utils/haddock/haddock-library/fixtures/examples/codeDoubleBackticks.parsed
- utils/haddock/haddock-library/haddock-library.cabal
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser/Identifier.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f3c9aa041a771b1f269c9eb4a0e3e6…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f3c9aa041a771b1f269c9eb4a0e3e6…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/jeltsch/smaller-pit] 5 commits: Statically enforce module interface reduction for the PIT
by Wolfgang Jeltsch (@jeltsch) 12 Nov '26
by Wolfgang Jeltsch (@jeltsch) 12 Nov '26
12 Nov '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/smaller-pit at Glasgow Haskell Compiler / GHC
Commits:
3321ac5f by Wolfgang Jeltsch at 2026-11-03T21:33:26+02:00
Statically enforce module interface reduction for the PIT
`GHC.Iface.Load.loadInterface` used to replace certain fields of each
fetched module interface by `panic` applications before storing it in
the PIT. With the present change, the absence of those fields in the PIT
is guaranteed statically.
See #27044 for the bigger picture.
- - - - -
4216f2e7 by Wolfgang Jeltsch at 2026-11-03T21:34:20+02:00
Make `IfaceBinHandle` a type synonym family
This brings the handling of `IfaceBinHandle` somewhat in line with how
other phase-dependent data is handled. Note that `mi_hi_bytes_` now
includes the `Strict.Maybe` layer itself, independently of the phase.
This is necessary, because with a type family instead of a GADT
`clear_mi_hi_bytes` cannot determine the phase at runtime anymore and
thus has to set `mi_hi_bytes_` to `Strict.Nothing` for every phase.
Metric Decrease:
T15164
T19695
T21839c
WWRec
- - - - -
d1556021 by Wolfgang Jeltsch at 2026-11-03T21:34:20+02:00
Streamline the construction of empty module interfaces
- - - - -
ba8f35e9 by Wolfgang Jeltsch at 2026-11-03T21:34:20+02:00
Shift the creation of `ModIface` caches to later phases
- - - - -
28af2cdc by Wolfgang Jeltsch at 2026-11-12T18:07:24+02:00
Stop retention of interface hashes in the PIT
- - - - -
24 changed files:
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Main/Interactive.hs
- compiler/GHC/Driver/Main/Passes.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Driver/Session/Inspect.hs
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Binary.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Load.hs-boot
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Loader.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Unit/External.hs
- compiler/GHC/Unit/Module/ModIface.hs
- ghc/Main.hs
- utils/count-deps/Main.hs
Changes:
=====================================
compiler/GHC/Driver/Downsweep.hs
=====================================
@@ -898,7 +898,8 @@ readFixedModule (DownsweepEnv { ds_hsc_env = hsc_env }) key =
-- part of the compiler.
lookupIfaceByModuleHsc hsc_env (mnkToModule key) >>= \case
Just iface -> return (MaybeErr.Succeeded iface)
- Nothing -> readIface (hsc_hooks hsc_env) (hsc_logger hsc_env) (hsc_dflags hsc_env) (hsc_NC hsc_env) (mnkToModule key) (ml_hi_file loc)
+ Nothing -> fmap retainedModIface <$>
+ readIface (hsc_hooks hsc_env) (hsc_logger hsc_env) (hsc_dflags hsc_env) (hsc_NC hsc_env) (mnkToModule key) (ml_hi_file loc)
return $ case read_result of
MaybeErr.Succeeded iface -> Just (FixedModule loc (ifaceEdges (mi_deps iface)))
-- Skip any failure, we might try to read a .hi-boot file for
=====================================
compiler/GHC/Driver/Env.hs
=====================================
@@ -387,10 +387,10 @@ lookupIfaceByModule
:: HomeUnitGraph
-> PackageIfaceTable
-> Module
- -> IO (Maybe ModIface)
+ -> IO (Maybe RetainedModIface)
lookupIfaceByModule hug pit mod
= HUG.lookupHugByModule mod hug >>= pure . \case
- Just hm -> Just (hm_iface hm)
+ Just hm -> Just (retainedModIface (hm_iface hm))
Nothing -> lookupModuleEnv pit mod
-- If the module does come from the home package, why do we look in the PIT as well?
-- (a) In OneShot mode, even home-package modules accumulate in the PIT
@@ -399,7 +399,7 @@ lookupIfaceByModule hug pit mod
-- We could eliminate (b) if we wanted, by making GHC.Prim belong to a package
-- of its own, but it doesn't seem worth the bother.
-lookupIfaceByModuleHsc :: HscEnv -> Module -> IO (Maybe ModIface)
+lookupIfaceByModuleHsc :: HscEnv -> Module -> IO (Maybe RetainedModIface)
lookupIfaceByModuleHsc hsc_env mod = do
eps <- hscEPS hsc_env
lookupIfaceByModule (hsc_HUG hsc_env) (eps_PIT eps) mod
=====================================
compiler/GHC/Driver/Main/Interactive.hs
=====================================
@@ -148,7 +148,7 @@ hscIsGHCiMonad :: HscEnv -> String -> IO Name
hscIsGHCiMonad hsc_env name
= runHsc hsc_env $ ioMsgMaybe $ hoistTcRnMessage $ isGHCiMonad hsc_env name
-hscGetModuleInterface :: HscEnv -> Module -> IO ModIface
+hscGetModuleInterface :: HscEnv -> Module -> IO RetainedModIface
hscGetModuleInterface hsc_env0 mod = runInteractiveHsc hsc_env0 $ do
hsc_env <- getHscEnv
ioMsgMaybe $ hoistTcRnMessage $ getModuleInterface hsc_env mod
@@ -270,7 +270,7 @@ hscCheckSafe' m l = do
_ | isHomeModule home_unit mod -> True
_ -> isUnitTrusted unit_state (moduleUnit m)
- lookup' :: Module -> Hsc (Maybe ModIface)
+ lookup' :: Module -> Hsc (Maybe RetainedModIface)
lookup' m = do
hsc_env <- getHscEnv
iface <- liftIO $ lookupIfaceByModuleHsc hsc_env m
=====================================
compiler/GHC/Driver/Main/Passes.hs
=====================================
@@ -1335,7 +1335,7 @@ hscCheckSafe' m l = do
_ | isHomeModule home_unit mod -> True
_ -> isUnitTrusted unit_state (moduleUnit m)
- lookup' :: Module -> Hsc (Maybe ModIface)
+ lookup' :: Module -> Hsc (Maybe RetainedModIface)
lookup' m = do
hsc_env <- getHscEnv
iface <- liftIO $ lookupIfaceByModuleHsc hsc_env m
=====================================
compiler/GHC/Driver/Plugins.hs
=====================================
@@ -224,7 +224,7 @@ data PluginWithArgs = PluginWithArgs
data LoadedPlugin = LoadedPlugin
{ lpPlugin :: PluginWithArgs
-- ^ the actual plugin together with its commandline arguments
- , lpModule :: ModIface
+ , lpModule :: RetainedModIface
-- ^ the module containing the plugin
}
=====================================
compiler/GHC/Driver/Session/Inspect.hs
=====================================
@@ -87,7 +87,7 @@ data ModuleInfo = ModuleInfo {
minf_type_env :: TypeEnv,
minf_exports :: [AvailInfo],
minf_instances :: [ClsInst],
- minf_iface :: Maybe ModIface,
+ minf_iface :: Maybe RetainedModIface,
minf_safe :: SafeHaskellMode,
minf_modBreaks :: Maybe InternalModBreaks
}
@@ -140,7 +140,7 @@ getHomeModuleInfo hsc_env mdl =
Nothing -> return Nothing
Just hmi -> do
let details = hm_details hmi
- iface = hm_iface hmi
+ iface = retainedModIface (hm_iface hmi)
return (Just (ModuleInfo {
minf_type_env = md_types details,
minf_exports = md_exports details,
@@ -187,7 +187,7 @@ modInfoLookupName minf name = withSession $ \hsc_env -> do
Just tyThing -> return (Just tyThing)
Nothing -> liftIO (lookupType hsc_env name)
-modInfoIface :: ModuleInfo -> Maybe ModIface
+modInfoIface :: ModuleInfo -> Maybe RetainedModIface
modInfoIface = minf_iface
-- | Retrieve module safe haskell mode
=====================================
compiler/GHC/HsToCore/Usage.hs
=====================================
@@ -276,7 +276,7 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
-- a) we used something from it; has something in used_names
-- b) we imported it, even if we used nothing from it
-- (need to recompile if its export list changes: export_fprint)
- mkUsage :: Module -> ModIface -> Maybe Usage
+ mkUsage :: Module -> RetainedModIface -> Maybe Usage
mkUsage mod iface
| toUnitId (moduleUnit mod) `Set.notMember` home_unit_ids
= Just $ UsagePackageModule{ usg_mod = mod,
@@ -302,9 +302,9 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
usg_entities = Map.toList ent_hashs,
usg_safe = imp_safe }
where
- finsts_mod = mi_finsts iface
+ finsts_mod = mi_abi_finsts (mi_abi_hashes iface)
hash_env = mi_hash_fn iface
- mod_hash = mi_mod_hash iface
+ mod_hash = mi_abi_mod_hash (mi_abi_hashes iface)
imported_exports
= if not depend_on_exports
then Nothing
@@ -312,9 +312,9 @@ mk_mod_usage_info uc home_unit home_unit_ids this_mod direct_imports imp_decls u
Just $
HomeModImport
{ hmiu_orphanLikeHash
- = mi_orphan_like_hash iface
+ = mi_abi_orphan_like_hash (mi_abi_hashes iface)
, hmiu_importedAvails
- = moduleImportedAvails mod (mi_export_avails_hash iface) imp_decls
+ = moduleImportedAvails mod (mi_abi_export_avails_hash (mi_abi_hashes iface)) imp_decls
}
by_is_safe (ImportedByUser imv) = imv_is_safe imv
=====================================
compiler/GHC/Iface/Binary.hs
=====================================
@@ -197,7 +197,7 @@ getIfaceWithExtFields name_cache bh = do
modIfaceBinData <- freezeBinHandle bh start
pure $ mod_iface
& set_mi_ext_fields extFields
- & set_mi_hi_bytes (FullIfaceBinHandle $ Strict.Just modIfaceBinData)
+ & set_mi_hi_bytes (Strict.Just modIfaceBinData)
-- | This performs a get action after reading the dictionary and symbol
-- table. It is necessary to run this before trying to deserialise any
@@ -276,10 +276,10 @@ writeBinIface profile traceBinIface compressionLevel hi_path mod_iface = do
putIfaceWithExtFields :: TraceBinIFace -> CompressionIFace -> WriteBinHandle -> ModIface -> IO ()
putIfaceWithExtFields traceBinIface compressionLevel bh mod_iface =
case mi_hi_bytes mod_iface of
- FullIfaceBinHandle Strict.Nothing -> do
+ Strict.Nothing -> do
forwardPutRel_ bh (\_ -> put_ bh (mi_ext_fields mod_iface)) $ do
putWithUserData traceBinIface compressionLevel bh mod_iface
- FullIfaceBinHandle (Strict.Just binData) -> putFullBinData bh binData
+ Strict.Just binData -> putFullBinData bh binData
-- | Put a piece of data with an initialised `UserData` field. This
-- is necessary if you want to serialise Names or FastStrings.
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -308,7 +308,7 @@ loadKnownKeyOccMaps
known_key_maps :: Module -> IfM lcl KnownKeyNameMaps
known_key_maps mod
= do { iface <- loadInterfaceWithException doc mod ImportBySystem
- ; let !abi_hash = mi_mod_hash iface
+ ; let !abi_hash = mi_abi_mod_hash (mi_abi_hashes iface)
; eps <- getEps
; case lookupModuleEnv (eps_known_keys eps) mod of
Just (cached_hash, kk_maps)
@@ -321,7 +321,7 @@ loadKnownKeyOccMaps
(abi_hash, kk_maps) }
; return kk_maps } }
- build_maps :: ModIface -> KnownKeyNameMaps
+ build_maps :: RetainedModIface -> KnownKeyNameMaps
build_maps iface = (kk_map, occ_map)
where
kk_map :: UniqFM KnownKey Name
@@ -628,7 +628,7 @@ loadSrcInterface :: SDoc
-> ModuleName
-> IsBootInterface -- {-# SOURCE #-} ?
-> PkgQual -- "package", if any
- -> RnM ModIface
+ -> RnM RetainedModIface
loadSrcInterface doc scope mod want_boot maybe_pkg
= do { res <- loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
@@ -648,7 +648,7 @@ loadSrcInterface_maybe :: SDoc
-> ModuleName
-> IsBootInterface -- {-# SOURCE #-} ?
-> PkgQual -- "package", if any
- -> RnM (MaybeErr MissingInterfaceError ModIface)
+ -> RnM (MaybeErr MissingInterfaceError RetainedModIface)
loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
-- We must first find which Module this import refers to. This involves
@@ -667,7 +667,7 @@ loadSrcInterface_maybe doc scope mod want_boot maybe_pkg
-- rare operation, but in particular it is used to load orphan modules
-- in order to pull their instances into the global package table and to
-- handle some operations in GHCi).
-loadModuleInterface :: SDoc -> Module -> TcM ModIface
+loadModuleInterface :: SDoc -> Module -> TcM RetainedModIface
loadModuleInterface doc mod = initIfaceTcRn (loadSysInterface doc mod)
-- | Load interfaces for a collection of modules.
@@ -681,7 +681,7 @@ loadModuleInterfaces doc mods
-- | Loads the interface for a given Name.
-- Should only be called for an imported name;
-- otherwise loadSysInterface may not find the interface
-loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
+loadInterfaceForName :: SDoc -> Name -> TcRn RetainedModIface
loadInterfaceForName doc name
= do { when debugIsOn $ -- Check pre-condition
do { this_mod <- getModule
@@ -690,7 +690,7 @@ loadInterfaceForName doc name
initIfaceTcRn $ loadSysInterface doc (nameModule name) }
-- | Loads the interface for a given Module.
-loadInterfaceForModule :: SDoc -> Module -> TcRn ModIface
+loadInterfaceForModule :: SDoc -> Module -> TcRn RetainedModIface
loadInterfaceForModule doc m
= do
-- Should not be called with this module
@@ -724,23 +724,23 @@ loadWiredInHomeIface name
------------------
-- | Loads a system interface and throws an exception if it fails
-loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
+loadSysInterface :: SDoc -> Module -> IfM lcl RetainedModIface
loadSysInterface doc mod_name = loadInterfaceWithException doc mod_name ImportBySystem
------------------
-- | Loads a user interface and throws an exception if it fails. The first parameter indicates
-- whether we should import the boot variant of the module
-loadUserInterface :: IsBootInterface -> SDoc -> Module -> IfM lcl ModIface
+loadUserInterface :: IsBootInterface -> SDoc -> Module -> IfM lcl RetainedModIface
loadUserInterface is_boot doc mod_name
= loadInterfaceWithException doc mod_name (ImportByUser is_boot)
-loadPluginInterface :: SDoc -> Module -> IfM lcl ModIface
+loadPluginInterface :: SDoc -> Module -> IfM lcl RetainedModIface
loadPluginInterface doc mod_name
= loadInterfaceWithException doc mod_name ImportByPlugin
------------------
-- | A wrapper for 'loadInterface' that throws an exception if it fails
-loadInterfaceWithException :: SDoc -> Module -> WhereFrom -> IfM lcl ModIface
+loadInterfaceWithException :: SDoc -> Module -> WhereFrom -> IfM lcl RetainedModIface
loadInterfaceWithException doc mod_name where_from
= do
dflags <- getDynFlags
@@ -749,7 +749,7 @@ loadInterfaceWithException doc mod_name where_from
------------------
loadInterface :: SDoc -> Module -> WhereFrom
- -> IfM lcl (MaybeErr MissingInterfaceError ModIface)
+ -> IfM lcl (MaybeErr MissingInterfaceError RetainedModIface)
-- loadInterface looks in both the HPT and PIT for the required interface
-- If not found, it loads it, and puts it in the PIT (always).
@@ -796,7 +796,7 @@ loadInterface doc_str mod from
liftIO $ computeInterface hsc_env doc_str hi_boot_file mod
; case read_result of {
Failed err -> do
- { let fake_iface = emptyFullModIface mod
+ { let fake_iface = emptyRetainedModIface mod
; updateEps_ $ \eps ->
eps { eps_PIT = extendModuleEnv (eps_PIT eps) (mi_module fake_iface) fake_iface }
@@ -856,16 +856,7 @@ loadInterface doc_str mod from
; new_eps_complete_matches <- tcIfaceCompleteMatches (mi_complete_matches iface)
; purged_hsc_env <- getTopEnv
- ; let final_iface = iface
- & set_mi_decls (panic "No mi_decls in PIT")
- & set_mi_insts (panic "No mi_insts in PIT")
- & set_mi_defaults (panic "No mi_defaults in PIT")
- & set_mi_fam_insts (panic "No mi_fam_insts in PIT")
- & set_mi_rules (panic "No mi_rules in PIT")
- & set_mi_anns (panic "No mi_anns in PIT")
- & set_mi_simplified_core (panic "No mi_simplified_core in PIT")
-
- bad_boot = mi_boot iface == IsBoot
+ ; let bad_boot = mi_boot iface == IsBoot
&& isJust (lookupKnotVars (if_rec_types gbl_env) mod)
-- Warn against an EPS-updating import
-- of one's own boot file! (one-shot only)
@@ -892,7 +883,7 @@ loadInterface doc_str mod from
then eps { eps_PTE = addDeclsToPTE (eps_PTE eps) new_eps_decls }
else
eps {
- eps_PIT = extendModuleEnv (eps_PIT eps) mod final_iface,
+ eps_PIT = extendModuleEnv (eps_PIT eps) mod (retainedModIface iface),
eps_PTE = addDeclsToPTE (eps_PTE eps) new_eps_decls,
eps_iface_bytecode = add_bytecode (eps_iface_bytecode eps),
eps_rule_base = extendRuleBaseList (eps_rule_base eps)
@@ -921,10 +912,8 @@ loadInterface doc_str mod from
eps_defaults = extendModuleEnv (eps_defaults eps) mod new_eps_defaults
}
- ; -- invoke plugins with *full* interface, not final_iface, to ensure
- -- that plugins have access to declarations, etc.
- res <- withPlugins (hsc_plugins hsc_env) (\p -> interfaceLoadAction p) iface
- ; return (Succeeded res)
+ ; res <- withPlugins (hsc_plugins hsc_env) (\p -> interfaceLoadAction p) iface
+ ; return (Succeeded (retainedModIface res))
}}}}
{- Note [Loading your own hi-boot file]
@@ -1389,14 +1378,11 @@ ghcPrimIface
& set_mi_decls []
& set_mi_fixities ghcPrimFixities
& set_mi_fix_fn (mkIfaceFixCache ghcPrimFixities)
- & set_mi_decl_warn_fn (mkIfaceDeclWarnCache ghcPrimWarns)
- & set_mi_export_warn_fn (mkIfaceExportWarnCache ghcPrimWarns)
- & set_mi_fix_fn (mkIfaceFixCache ghcPrimFixities)
& set_mi_docs (Just ghcPrimDeclDocs) -- See Note [GHC.Prim Docs] in GHC.Builtin
& set_mi_warns (toIfaceWarnings ghcPrimWarns) -- See Note [GHC.Prim Deprecations] in GHC.Builtin
where
- empty_iface = emptyFullModIface gHC_PRIM
+ empty_iface = emptyModIface gHC_PRIM
-- | Get gHC_PRIM interface file
--
=====================================
compiler/GHC/Iface/Load.hs-boot
=====================================
@@ -2,7 +2,7 @@ module GHC.Iface.Load where
import GHC.Unit.Module (Module)
import GHC.Tc.Utils.Monad (IfM)
-import GHC.Unit.Module.ModIface (ModIface)
+import GHC.Unit.Module.ModIface (RetainedModIface)
import GHC.Utils.Outputable (SDoc)
-loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
+loadSysInterface :: SDoc -> Module -> IfM lcl RetainedModIface
=====================================
compiler/GHC/Iface/Make.hs
=====================================
@@ -77,6 +77,7 @@ import GHC.Iface.Binary
import GHC.Data.FastString
import GHC.Data.Maybe
+import qualified GHC.Data.Strict as Strict
import GHC.HsToCore.Docs
import GHC.HsToCore.Usage
@@ -394,7 +395,7 @@ mkIface_ hsc_env
& set_mi_docs docs
& set_mi_abi_hashes ()
& set_mi_ext_fields emptyExtensibleFields
- & set_mi_hi_bytes PartialIfaceBinHandle
+ & set_mi_hi_bytes Strict.Nothing
where
cmp_rule = lexicalCompareFS `on` ifRuleName
=====================================
compiler/GHC/Iface/Recomp.hs
=====================================
@@ -68,7 +68,6 @@ import GHC.Unit.Home
import GHC.Unit.Module
import GHC.Unit.Module.ModIface
import GHC.Unit.Module.ModSummary
-import GHC.Unit.Module.Warnings
import GHC.Unit.Module.Deps
import Control.Monad
@@ -707,7 +706,7 @@ checkDependencies hsc_env summary iface
return $ needsRecompileBecause $ ModulePackageChanged new_name
-needInterface :: Module -> (ModIface -> IO RecompileRequired)
+needInterface :: Module -> (RetainedModIface -> IO RecompileRequired)
-> IfG RecompileRequired
needInterface mod continue
= do
@@ -727,7 +726,7 @@ needBytecode mod continue
Nothing -> return $ NeedsRecompile MustCompile
Just mbc -> liftIO $ continue mbc
-tryGetModIface :: String -> Module -> IfG (Maybe ModIface)
+tryGetModIface :: String -> Module -> IfG (Maybe RetainedModIface)
tryGetModIface doc_msg mod
= do -- Load the imported interface if possible
logger <- getLogger
@@ -779,7 +778,7 @@ checkModUsage _ UsagePackageModule{
logger <- getLogger
needInterface mod $ \iface -> do
let reason = ModuleChanged (moduleName mod)
- checkModuleFingerprint logger reason old_mod_hash (mi_mod_hash iface)
+ checkModuleFingerprint logger reason old_mod_hash (mi_abi_mod_hash (mi_abi_hashes iface))
-- We only track the ABI hash of package modules, rather than
-- individual entity usages, so if the ABI hash changes we must
-- recompile. This is safe but may entail more recompilation when
@@ -789,7 +788,7 @@ checkModUsage _ UsageMergedRequirement{ usg_mod = mod, usg_mod_hash = old_mod_ha
logger <- getLogger
needInterface mod $ \iface -> do
let reason = ModuleChangedRaw (moduleName mod)
- checkModuleFingerprint logger reason old_mod_hash (mi_mod_hash iface)
+ checkModuleFingerprint logger reason old_mod_hash (mi_abi_mod_hash (mi_abi_hashes iface))
checkModUsage _ UsageHomeModuleBytecode{ usg_mod_name = mod_name
, usg_unit_id = uid
, usg_bytecode_hash = old_bytecode_hash } = do
@@ -810,7 +809,7 @@ checkModUsage _ UsageHomeModule{
logger <- getLogger
needInterface mod $ \iface -> do
let
- new_mod_hash = mi_mod_hash iface
+ new_mod_hash = mi_abi_mod_hash (mi_abi_hashes iface)
new_decl_hash = mi_hash_fn iface
reason = ModuleChanged (moduleName mod)
@@ -864,7 +863,7 @@ checkModUsage fc UsageDirectory{ usg_dir_path = dir,
-- Does this require recompilation?
--
-- See Note [When to recompile when export lists change?]
-checkHomeModImport :: Logger -> RecompReason -> Maybe HomeModImport -> ModIface -> IO RecompileRequired
+checkHomeModImport :: Logger -> RecompReason -> Maybe HomeModImport -> RetainedModIface -> IO RecompileRequired
checkHomeModImport _ _ Nothing _ = return UpToDate
checkHomeModImport logger reason
(Just (HomeModImport old_orphan_like_hash old_avails))
@@ -901,8 +900,8 @@ checkHomeModImport logger reason
2 (ppr changes)
return $ needsRecompileBecause reason
where
- new_orphan_like_hash = mi_orphan_like_hash iface
- new_avails_hash = mi_export_avails_hash iface
+ new_orphan_like_hash = mi_abi_orphan_like_hash (mi_abi_hashes iface)
+ new_avails_hash = mi_abi_export_avails_hash (mi_abi_hashes iface)
new_exports = mi_exports iface
-- | The exported avails of a module have changed. Should this cause recompilation
@@ -1299,8 +1298,6 @@ addAbiHashes hsc_env info
= iface_public
-- And these fields of deps should be in IfacePublic, but in good time.
Dependencies _ _ _ sig_mods trusted_pkgs boot_mods orph_mods fis_mods = deps
- decl_warn_fn = mkIfaceDeclWarnCache (fromIfaceWarnings warns)
- export_warn_fn = mkIfaceExportWarnCache (fromIfaceWarnings $ warns)
fix_fn = mkIfaceFixCache fixities
this_mod = mi_mod_info_module info
@@ -1535,10 +1532,10 @@ addAbiHashes hsc_env info
}
caches = IfaceCache
- { mi_cache_decl_warn_fn = decl_warn_fn
- , mi_cache_export_warn_fn = export_warn_fn
+ { mi_cache_decl_warn_fn = ()
+ , mi_cache_export_warn_fn = ()
, mi_cache_fix_fn = fix_fn
- , mi_cache_hash_fn = lookupOccEnv local_env
+ , mi_cache_hash_fn = ()
}
return (final_iface_exts, caches, decls_w_hashes)
where
@@ -1617,7 +1614,7 @@ getOrphanHashes hsc_env mods = do
get_orph_hash mod = do
iface <- initIfaceLoad hsc_env . withIfaceErr ctx
$ loadInterface (text "getOrphanHashes") mod ImportBySystem
- return (mi_orphan_hash iface)
+ return (mi_abi_orphan_hash (mi_abi_hashes iface))
mapM get_orph_hash mods
=====================================
compiler/GHC/Rename/Names.hs
=====================================
@@ -517,7 +517,7 @@ renamePkgQual unit_env mn mb_pkg = case mb_pkg of
-- interface, but without 'imp_mods'.
calculateAvails :: HomeUnit
-> S.Set UnitId
- -> ModIface
+ -> RetainedModIface
-> IsSafeImport
-> IsBootInterface
-> ImportedBy
@@ -525,8 +525,8 @@ calculateAvails :: HomeUnit
calculateAvails home_unit other_home_units iface mod_safe' want_boot imported_by =
let imp_mod = mi_module iface
imp_sem_mod= mi_semantic_module iface
- orph_iface = mi_orphan iface
- has_finsts = mi_finsts iface
+ orph_iface = mi_abi_orphan (mi_abi_hashes iface)
+ has_finsts = mi_abi_finsts (mi_abi_hashes iface)
deps = mi_deps iface
trust = getSafeMode $ mi_trust iface
trust_pkg = mi_trust_pkg iface
@@ -1209,7 +1209,7 @@ gresFromAvail hsc_env prov avail =
gresFromAvails :: HscEnv -> Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt]
gresFromAvails hsc_env prov = concatMap (gresFromAvail hsc_env prov)
-importsFromIface :: HscEnv -> ModIface -> ImpDeclSpec -> Maybe NameSet -> GlobalRdrEnv
+importsFromIface :: HscEnv -> RetainedModIface -> ImpDeclSpec -> Maybe NameSet -> GlobalRdrEnv
importsFromIface hsc_env iface decl_spec hidden = mkGlobalRdrEnv $ case hidden of
Nothing -> all_gres
Just hidden_names -> filter (not . (`elemNameSet` hidden_names) . greName) all_gres
@@ -1225,7 +1225,7 @@ rnNamespaceSpecifier (DataNamespaceSpecifier x) = DataNamespaceSpecifier x
filterImports
:: HasDebugCallStack
=> HscEnv
- -> ModIface
+ -> RetainedModIface
-> ImpDeclSpec
-- ^ Import spec
-> Maybe (ImportListInterpretation, [LIE GhcPs])
@@ -2327,7 +2327,7 @@ getMinimalImports ie_decls
where
doc = text "Compute minimal imports for" <+> ppr decl
- to_ie :: GlobalRdrEnv -> ModIface -> AvailInfo -> RnM [IE GhcRn]
+ to_ie :: GlobalRdrEnv -> RetainedModIface -> AvailInfo -> RnM [IE GhcRn]
-- The main trick here is that if we're importing all the constructors
-- we want to say "T(..)", but if we're importing only a subset we want
-- to say "T(A,B,C)". So we have to find out what the module exports.
@@ -2529,7 +2529,7 @@ DRFPatSynExport for a test of this.
-}
badImportItemErr
- :: ModIface -> ImpDeclSpec -> IE GhcPs
+ :: RetainedModIface -> ImpDeclSpec -> IE GhcPs
-> IsSubordinateError
-> [AvailInfo]
-> TcRn (NonEmpty ImportLookupReason)
=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -534,7 +534,7 @@ warnIfDeclDeprecated gre@(GRE { gre_imp = iss })
definedMod = moduleName $ assertPpr (isExternalName name) (ppr name) (nameModule name)
doc = text "The name" <+> quotes (ppr occ) <+> text "is mentioned explicitly"
-lookupImpDeclDeprec :: ModIface -> GlobalRdrElt -> Maybe (WarningTxt GhcRn)
+lookupImpDeclDeprec :: RetainedModIface -> GlobalRdrElt -> Maybe (WarningTxt GhcRn)
lookupImpDeclDeprec iface gre
-- Bleat if the thing, or its parent, is warn'd
= mi_decl_warn_fn iface (greOccName gre) `mplus`
=====================================
compiler/GHC/Runtime/Loader.hs
=====================================
@@ -190,7 +190,7 @@ checkExternalInterpreter hsc_env = case interpInstance <$> hsc_interp hsc_env of
-> throwIO (InstallationError "Plugins require -fno-external-interpreter")
_ -> pure ()
-loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, ModIface, [LinkableUsage], PkgsLoaded)
+loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, RetainedModIface, [LinkableUsage], PkgsLoaded)
loadPlugin' occ_name plugin_name hsc_env mod_name
= do { let plugin_rdr_name = mkRdrQual mod_name occ_name
dflags = hsc_dflags hsc_env
@@ -341,7 +341,7 @@ lessUnsafeCoerce logger context what = do
-- Need the module as well to record information in the interface file
lookupRdrNameInModuleForPlugins :: HasDebugCallStack
=> HscEnv -> ModuleName -> RdrName
- -> IO (Maybe (Name, ModIface))
+ -> IO (Maybe (Name, RetainedModIface))
lookupRdrNameInModuleForPlugins hsc_env mod_name rdr_name = do
let dflags = hsc_dflags hsc_env
-- First find the unit the module resides in by searching exposed units and home modules
=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -6400,7 +6400,7 @@ pprImportLookup :: ImportLookupReason -> SDoc
pprImportLookup = \case
ImportLookupBad k iface decl_spec ie _exts ->
let
- pprImpDeclSpec :: ModIface -> ImpDeclSpec -> SDoc
+ pprImpDeclSpec :: RetainedModIface -> ImpDeclSpec -> SDoc
pprImpDeclSpec iface decl_spec =
quotes (ppr (moduleName $ is_mod decl_spec)) <+> case mi_boot iface of
IsBoot -> text "(hi-boot interface)"
=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -216,7 +216,7 @@ import GHC.Types.DefaultEnv (ClassDefaults)
import GHC.Unit.Types (Module, ModuleName)
import GHC.Unit.State (UnitState)
-import GHC.Unit.Module.ModIface (ModIface)
+import GHC.Unit.Module.ModIface (RetainedModIface)
import GHC.Utils.Outputable
@@ -6650,7 +6650,7 @@ data ImportLookupReason where
T9006, T11071, T9905fail2, T5385, T10668
-}
ImportLookupBad :: BadImportKind
- -> ModIface
+ -> RetainedModIface
-> ImpDeclSpec
-> IE GhcPs
-> ImportLookupExtensions
=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -1693,7 +1693,7 @@ lookupArgDoc i nm = do
_ -> pure Nothing
-- | Returns the module a Name belongs to, if it is isn't local.
-getExternalModIface :: Name -> TcM (Maybe ModIface)
+getExternalModIface :: Name -> TcM (Maybe RetainedModIface)
getExternalModIface nm = do
isLocal <- nameIsLocalOrFrom <$> getModule <*> pure nm
if isLocal
=====================================
compiler/GHC/Tc/Instance/Family.hs
=====================================
@@ -308,7 +308,7 @@ checkFamInstConsistency directlyImpMods
ifc <- modIface mod
deps <- dep_finsts . mi_deps <$> modIface mod
pure $
- if mi_finsts ifc
+ if mi_abi_finsts (mi_abi_hashes ifc)
then mod:deps
else deps
=====================================
compiler/GHC/Tc/Module.hs
=====================================
@@ -2968,7 +2968,7 @@ externaliseAndTidyId this_mod id
-- a package module with an interface on disk. If neither of these is
-- true, then the result will be an error indicating the interface
-- could not be found.
-getModuleInterface :: HscEnv -> Module -> IO (Messages TcRnMessage, Maybe ModIface)
+getModuleInterface :: HscEnv -> Module -> IO (Messages TcRnMessage, Maybe RetainedModIface)
getModuleInterface hsc_env mod
= runTcInteractive NoTcMPlugins hsc_env $
loadModuleInterface (text "getModuleInterface") mod
=====================================
compiler/GHC/Unit/External.hs
=====================================
@@ -49,7 +49,7 @@ type PackageAnnEnv = AnnEnv
type PackageCompleteMatches = CompleteMatches
-- | Helps us find information about modules in the imported packages
-type PackageIfaceTable = ModuleEnv ModIface
+type PackageIfaceTable = ModuleEnv RetainedModIface
-- Domain = modules in the imported packages
-- | Constructs an empty PackageIfaceTable
=====================================
compiler/GHC/Unit/Module/ModIface.hs
=====================================
@@ -2,6 +2,7 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE DeriveAnyClass #-}
+{-# LANGUAGE RecordWildCards #-}
module GHC.Unit.Module.ModIface
( ModIface
@@ -68,19 +69,35 @@ module GHC.Unit.Module.ModIface
, set_mi_fix_fn
, set_mi_hash_fn
, completePartialModIface
- , IfaceBinHandle(..)
+ , retainedModIface
+ , IfaceBinHandle
, PartialModIface
+ , RetainedModIface
, IfaceAbiHashes (..)
, IfaceSelfRecomp (..)
- , IfaceCache (..)
+ , IfaceCache_ (..)
, IfaceSimplifiedCore (..)
, withSelfRecomp
- , IfaceDeclExts
- , IfaceAbiHashesExts
+ , IfaceHashData
+ , IfaceSelfRecompData
+ , IfaceSimplifiedCoreData
+ , ExtensibleFieldsData
+ , IfaceAnnotationsData
+ , IfaceDeclsData
+ , IfaceDefaultsData
+ , IfaceClsInstsData
+ , IfaceFamInstsData
+ , IfaceRulesData
+ , IfaceCompleteMatchesData
+ , IfaceAbiHashesData
, IfaceExport
, IfacePublic_(..)
, IfacePublic
, PartialIfacePublic
+ , RetainedIfacePublic
+ , IfaceCache
+ , PartialIfaceCache
+ , RetainedIfaceCache
, IfaceModInfo(..)
, WhetherHasOrphans
, WhetherHasFamInst
@@ -106,7 +123,9 @@ module GHC.Unit.Module.ModIface
, mi_orphan_hash
, renameFreeHoles
, emptyPartialModIface
+ , emptyModIface
, emptyFullModIface
+ , emptyRetainedModIface
, mkIfaceHashCache
, emptyIfaceHashCache
, forceModIface
@@ -147,16 +166,18 @@ import GHC.Utils.Binary
import Control.DeepSeq
import Control.Exception
+import Data.Void (Void)
{- Note [Interface file stages]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Interface files have two possible stages.
+Interface files have three possible stages.
* A partial stage built from the result of the core pipeline.
-* A fully instantiated form. Which also includes fingerprints and
+* A fully instantiated form, which also includes fingerprints and
potentially information provided by backends.
+* A form for retention in the EPS.
We can build a full interface file two ways:
* Directly from a partial one:
@@ -167,9 +188,15 @@ We can build a full interface file two ways:
type PartialModIface = ModIface_ 'ModIfaceCore
type ModIface = ModIface_ 'ModIfaceFinal
+type RetainedModIface = ModIface_ 'ModIfaceRetained
type PartialIfacePublic = IfacePublic_ 'ModIfaceCore
type IfacePublic = IfacePublic_ 'ModIfaceFinal
+type RetainedIfacePublic = IfacePublic_ 'ModIfaceRetained
+
+type PartialIfaceCache = IfaceCache_ 'ModIfaceCore
+type IfaceCache = IfaceCache_ 'ModIfaceFinal
+type RetainedIfaceCache = IfaceCache_ 'ModIfaceRetained
-- | Extends a PartialModIface with hashes of the ABI.
--
@@ -196,14 +223,14 @@ data IfaceAbiHashes = IfaceAbiHashes
-- NOT transitive
}
-data IfaceCache = IfaceCache
- { mi_cache_decl_warn_fn :: !(OccName -> Maybe (WarningTxt GhcRn))
+data IfaceCache_ phase = IfaceCache
+ { mi_cache_decl_warn_fn :: !(IfaceDeclWarningCacheData phase)
-- ^ Cached lookup for 'mi_warns' for declaration deprecations
- , mi_cache_export_warn_fn :: !(Name -> Maybe (WarningTxt GhcRn))
+ , mi_cache_export_warn_fn :: !(IfaceExportWarningCacheData phase)
-- ^ Cached lookup for 'mi_warns' for export deprecations
- , mi_cache_fix_fn :: !(OccName -> Maybe Fixity)
+ , mi_cache_fix_fn :: !(IfaceFixityCacheData phase)
-- ^ Cached lookup for 'mi_fixities'
- , mi_cache_hash_fn :: !(OccName -> Maybe (OccName, Fingerprint))
+ , mi_cache_hash_fn :: !(IfaceHashCacheData phase)
-- ^ Cached lookup for 'mi_decls'. The @Nothing@ in 'mi_hash_fn' means that
-- the thing isn't in decls. It's useful to know that when seeing if we are
-- up to date wrt. the old interface. The 'OccName' is the parent of the
@@ -212,34 +239,103 @@ data IfaceCache = IfaceCache
data ModIfacePhase
= ModIfaceCore
- -- ^ Partial interface built based on output of core pipeline.
+ -- ^ Partial interface built from the output of the core pipeline
| ModIfaceFinal
-
--- | Selects a IfaceDecl representation.
--- For fully instantiated interfaces we also maintain
--- a fingerprint, which is used for recompilation checks.
-type family IfaceDeclExts (phase :: ModIfacePhase) = decl | decl -> phase where
- IfaceDeclExts 'ModIfaceCore = IfaceDecl
- IfaceDeclExts 'ModIfaceFinal = (Fingerprint, IfaceDecl)
-
-type family IfaceAbiHashesExts (phase :: ModIfacePhase) = bk | bk -> phase where
- IfaceAbiHashesExts 'ModIfaceCore = ()
- IfaceAbiHashesExts 'ModIfaceFinal = IfaceAbiHashes
+ -- ^ Complete interface
+ | ModIfaceRetained
+ -- ^ Interface shrunk to the parts that may be retained
-- | In-memory byte array representation of a 'ModIface'.
--
-- See Note [Sharing of ModIface] for why we need this.
-data IfaceBinHandle (phase :: ModIfacePhase) where
- -- | A partial 'ModIface' cannot be serialised to disk.
- PartialIfaceBinHandle :: IfaceBinHandle 'ModIfaceCore
- -- | Optional 'FullBinData' that can be serialised to disk directly.
- --
- -- See Note [Private fields in ModIface] for when this fields needs to be cleared
- -- (e.g., set to 'Nothing').
- FullIfaceBinHandle :: !(Strict.Maybe FullBinData) -> IfaceBinHandle 'ModIfaceFinal
-
-
-withSelfRecomp :: ModIface_ phase -> r -> (IfaceSelfRecomp -> r) -> r
+type family IfaceBinHandle (phase :: ModIfacePhase) where
+ IfaceBinHandle 'ModIfaceCore = Void
+ IfaceBinHandle 'ModIfaceFinal = FullBinData
+ IfaceBinHandle 'ModIfaceRetained = Void
+
+type family IfaceHashData (phase :: ModIfacePhase) where
+ IfaceHashData 'ModIfaceCore = Fingerprint
+ IfaceHashData 'ModIfaceFinal = Fingerprint
+ IfaceHashData 'ModIfaceRetained = ()
+
+type family IfaceSelfRecompData (phase :: ModIfacePhase) where
+ IfaceSelfRecompData 'ModIfaceCore = Maybe IfaceSelfRecomp
+ IfaceSelfRecompData 'ModIfaceFinal = Maybe IfaceSelfRecomp
+ IfaceSelfRecompData 'ModIfaceRetained = ()
+
+type family IfaceSimplifiedCoreData (phase :: ModIfacePhase) where
+ IfaceSimplifiedCoreData 'ModIfaceCore = Maybe IfaceSimplifiedCore
+ IfaceSimplifiedCoreData 'ModIfaceFinal = Maybe IfaceSimplifiedCore
+ IfaceSimplifiedCoreData 'ModIfaceRetained = ()
+
+type family ExtensibleFieldsData (phase :: ModIfacePhase) where
+ ExtensibleFieldsData 'ModIfaceCore = ExtensibleFields
+ ExtensibleFieldsData 'ModIfaceFinal = ExtensibleFields
+ ExtensibleFieldsData 'ModIfaceRetained = ()
+
+type family IfaceAnnotationsData (phase :: ModIfacePhase) where
+ IfaceAnnotationsData 'ModIfaceCore = [IfaceAnnotation]
+ IfaceAnnotationsData 'ModIfaceFinal = [IfaceAnnotation]
+ IfaceAnnotationsData 'ModIfaceRetained = ()
+
+-- | The fingerprint in the 'ModIfaceFinal' case is used for recompilation
+-- checks.
+type family IfaceDeclsData (phase :: ModIfacePhase) where
+ IfaceDeclsData 'ModIfaceCore = [IfaceDecl]
+ IfaceDeclsData 'ModIfaceFinal = [(Fingerprint, IfaceDecl)]
+ IfaceDeclsData 'ModIfaceRetained = ()
+
+type family IfaceDefaultsData (phase :: ModIfacePhase) where
+ IfaceDefaultsData 'ModIfaceCore = [IfaceDefault]
+ IfaceDefaultsData 'ModIfaceFinal = [IfaceDefault]
+ IfaceDefaultsData 'ModIfaceRetained = ()
+
+type family IfaceClsInstsData (phase :: ModIfacePhase) where
+ IfaceClsInstsData 'ModIfaceCore = [IfaceClsInst]
+ IfaceClsInstsData 'ModIfaceFinal = [IfaceClsInst]
+ IfaceClsInstsData 'ModIfaceRetained = ()
+
+type family IfaceFamInstsData (phase :: ModIfacePhase) where
+ IfaceFamInstsData 'ModIfaceCore = [IfaceFamInst]
+ IfaceFamInstsData 'ModIfaceFinal = [IfaceFamInst]
+ IfaceFamInstsData 'ModIfaceRetained = ()
+
+type family IfaceRulesData (phase :: ModIfacePhase) where
+ IfaceRulesData 'ModIfaceCore = [IfaceRule]
+ IfaceRulesData 'ModIfaceFinal = [IfaceRule]
+ IfaceRulesData 'ModIfaceRetained = ()
+
+type family IfaceCompleteMatchesData (phase :: ModIfacePhase) where
+ IfaceCompleteMatchesData 'ModIfaceCore = [IfaceCompleteMatch]
+ IfaceCompleteMatchesData 'ModIfaceFinal = [IfaceCompleteMatch]
+ IfaceCompleteMatchesData 'ModIfaceRetained = ()
+
+type family IfaceAbiHashesData (phase :: ModIfacePhase) where
+ IfaceAbiHashesData 'ModIfaceCore = ()
+ IfaceAbiHashesData 'ModIfaceFinal = IfaceAbiHashes
+ IfaceAbiHashesData 'ModIfaceRetained = IfaceAbiHashes
+
+type family IfaceDeclWarningCacheData (phase :: ModIfacePhase) where
+ IfaceDeclWarningCacheData 'ModIfaceCore = ()
+ IfaceDeclWarningCacheData 'ModIfaceFinal = ()
+ IfaceDeclWarningCacheData 'ModIfaceRetained = OccName -> Maybe (WarningTxt GhcRn)
+
+type family IfaceExportWarningCacheData (phase :: ModIfacePhase) where
+ IfaceExportWarningCacheData 'ModIfaceCore = ()
+ IfaceExportWarningCacheData 'ModIfaceFinal = ()
+ IfaceExportWarningCacheData 'ModIfaceRetained = Name -> Maybe (WarningTxt GhcRn)
+
+type family IfaceFixityCacheData (phase :: ModIfacePhase) where
+ IfaceFixityCacheData 'ModIfaceCore = ()
+ IfaceFixityCacheData 'ModIfaceFinal = OccName -> Maybe Fixity
+ IfaceFixityCacheData 'ModIfaceRetained = OccName -> Maybe Fixity
+
+type family IfaceHashCacheData (phase :: ModIfacePhase) where
+ IfaceHashCacheData 'ModIfaceCore = ()
+ IfaceHashCacheData 'ModIfaceFinal = ()
+ IfaceHashCacheData 'ModIfaceRetained = OccName -> Maybe (OccName, Fingerprint)
+
+withSelfRecomp :: ModIface -> r -> (IfaceSelfRecomp -> r) -> r
withSelfRecomp iface nk jk =
case mi_self_recomp_info iface of
Nothing -> nk
@@ -258,12 +354,23 @@ withSelfRecomp iface nk jk =
-- fields.
data ModIface_ (phase :: ModIfacePhase)
= PrivateModIface {
- mi_hi_bytes_ :: !(IfaceBinHandle phase),
- -- ^ A serialised in-memory buffer of this 'ModIface'.
- -- If this handle is given, we can avoid serialising the 'ModIface'
- -- when writing this 'ModIface' to disk, and write this buffer to disk instead.
- -- See Note [Sharing of ModIface].
- mi_iface_hash_ :: Fingerprint, -- A hash of the whole interface
+ mi_hi_bytes_ :: !(Strict.Maybe (IfaceBinHandle phase)),
+ -- ^ Optionally an in-memory buffer that contains the
+ -- serialization of this 'ModIface'. If such a buffer is
+ -- present, we can avoid serialising the 'ModIface' when
+ -- writing it to disk and write this buffer instead. See
+ -- Note [Sharing of ModIface] and
+ -- Note [Private fields in ModIface].
+ --
+ -- Only in the 'ModIfaceFinal' phase, there can be a buffer
+ -- with the serialization. Both @IfaceBinHandle 'ModIfaceCore@
+ -- and @IfaceBinHandle 'ModIfaceRetained@ are defined to be
+ -- 'Void', so that the 'mi_hi_bytes' field gets the type
+ -- @Strict.Maybe Void@. This type is isomorphic to '()', even
+ -- when taking partially defined values into account, because
+ -- @Strict.Just undefined@ is @undefined@ and so @Nothing@ and
+ -- @undefined@ are the only inhabitants of that type.
+ mi_iface_hash_ :: IfaceHashData phase, -- A hash of the whole interface
mi_mod_info_ :: IfaceModInfo,
-- ^ Meta information about the module the interface file is for
@@ -279,11 +386,11 @@ data ModIface_ (phase :: ModIfacePhase)
-- importing this module. The main, original part of an interface.
- mi_self_recomp_ :: Maybe IfaceSelfRecomp,
+ mi_self_recomp_ :: IfaceSelfRecompData phase,
-- ^ Information needed for checking self-recompilation.
-- See Note [Self recompilation information in interface files]
- mi_simplified_core_ :: Maybe IfaceSimplifiedCore,
+ mi_simplified_core_ :: IfaceSimplifiedCoreData phase,
-- ^ The part of the interface written when `-fwrite-if-simplified-core` is enabled.
-- These parts are used to restart bytecode generation.
@@ -301,7 +408,7 @@ data ModIface_ (phase :: ModIfacePhase)
-- defined by the user). Used for GHCi and for inspecting
-- the contents of modules via the GHC API only.
- mi_ext_fields_ :: ExtensibleFields
+ mi_ext_fields_ :: ExtensibleFieldsData phase
-- ^ Additional optional fields, where the Map key represents
-- the field name, resulting in a (size, serialized data) pair.
-- Because the data is intended to be serialized through the
@@ -334,12 +441,12 @@ data IfacePublic_ phase = IfacePublic {
-- ^ Warnings
-- NOT STRICT! we read this field lazily from the interface file
- mi_anns_ :: [IfaceAnnotation],
+ mi_anns_ :: IfaceAnnotationsData phase,
-- ^ Annotations
-- NOT STRICT! we read this field lazily from the interface file
- mi_decls_ :: [IfaceDeclExts phase],
+ mi_decls_ :: IfaceDeclsData phase,
-- ^ Type, class and variable declarations
-- The hash of an Id changes if its fixity or deprecations change
-- (as well as its type of course)
@@ -347,14 +454,14 @@ data IfacePublic_ phase = IfacePublic {
-- the hash of the parent class/tycon changes
- mi_defaults_ :: [IfaceDefault],
+ mi_defaults_ :: IfaceDefaultsData phase,
-- ^ default declarations exported by the module
-- Instance declarations and rules
- mi_insts_ :: [IfaceClsInst], -- ^ Sorted class instance
- mi_fam_insts_ :: [IfaceFamInst], -- ^ Sorted family instances
- mi_rules_ :: [IfaceRule], -- ^ Sorted rules
+ mi_insts_ :: IfaceClsInstsData phase, -- ^ Sorted class instance
+ mi_fam_insts_ :: IfaceFamInstsData phase, -- ^ Sorted family instances
+ mi_rules_ :: IfaceRulesData phase, -- ^ Sorted rules
mi_trust_ :: IfaceTrustInfo,
@@ -367,20 +474,20 @@ data IfacePublic_ phase = IfacePublic {
-- itself) but imports some trustworthy modules from its own
-- package (which does require its own package be trusted).
-- See Note [Trust Own Package] in GHC.Rename.Names
- mi_complete_matches_ :: [IfaceCompleteMatch],
+ mi_complete_matches_ :: IfaceCompleteMatchesData phase,
-- ^ {-# COMPLETE #-} declarations
- mi_caches_ :: IfaceCache,
+ mi_caches_ :: IfaceCache_ phase,
-- ^ Cached lookups of some parts of mi_public
- mi_abi_hashes_ :: (IfaceAbiHashesExts phase)
+ mi_abi_hashes_ :: IfaceAbiHashesData phase
-- ^ Either `()` or `IfaceAbiHashes` for
-- a fully instantiated interface.
-- These fields are hashes of different parts of the public interface.
}
mkIfacePublic :: [IfaceExport]
- -> [IfaceDeclExts 'ModIfaceFinal]
+ -> [(Fingerprint, IfaceDecl)]
-> [(OccName, Fixity)]
-> IfaceWarnings
-> [IfaceAnnotation]
@@ -407,10 +514,10 @@ mkIfacePublic exports decls fixities warns anns defaults insts fam_insts rules t
mi_trust_pkg_ = trust_pkg,
mi_complete_matches_ = complete_matches,
mi_caches_ = IfaceCache {
- mi_cache_decl_warn_fn = mkIfaceDeclWarnCache $ fromIfaceWarnings warns,
- mi_cache_export_warn_fn = mkIfaceExportWarnCache $ fromIfaceWarnings warns,
+ mi_cache_decl_warn_fn = (),
+ mi_cache_export_warn_fn = (),
mi_cache_fix_fn = mkIfaceFixCache fixities,
- mi_cache_hash_fn = mkIfaceHashCache decls
+ mi_cache_hash_fn = ()
},
mi_abi_hashes_ = abi_hashes
}
@@ -501,22 +608,22 @@ That's why in GHC.Driver.Main.hscMaybeWriteIface there is the call to
forceModIface.
-}
-mi_flag_hash :: ModIface_ phase -> Maybe (FingerprintWithValue IfaceDynFlags)
+mi_flag_hash :: ModIface -> Maybe (FingerprintWithValue IfaceDynFlags)
mi_flag_hash = fmap mi_sr_flag_hash . mi_self_recomp_
-mi_opt_hash :: ModIface_ phase -> Maybe Fingerprint
+mi_opt_hash :: ModIface -> Maybe Fingerprint
mi_opt_hash = fmap mi_sr_opt_hash . mi_self_recomp_
-mi_hpc_hash :: ModIface_ phase -> Maybe Fingerprint
+mi_hpc_hash :: ModIface -> Maybe Fingerprint
mi_hpc_hash = fmap mi_sr_hpc_hash . mi_self_recomp_
-mi_src_hash :: ModIface_ phase -> Maybe Fingerprint
+mi_src_hash :: ModIface -> Maybe Fingerprint
mi_src_hash = fmap mi_sr_src_hash . mi_self_recomp_
-mi_usages :: ModIface_ phase -> Maybe [Usage]
+mi_usages :: ModIface -> Maybe [Usage]
mi_usages = fmap mi_sr_usages . mi_self_recomp_
-mi_plugin_hash :: ModIface_ phase -> Maybe Fingerprint
+mi_plugin_hash :: ModIface -> Maybe Fingerprint
mi_plugin_hash = fmap mi_sr_plugin_hash . mi_self_recomp_
-- | Accessor for the module hash of the ABI from a ModIface.
@@ -547,7 +654,7 @@ mi_orphan_hash iface = mi_abi_orphan_hash (mi_abi_hashes iface)
-- | Old-style accessor for whether or not the ModIface came from an hs-boot
-- file.
-mi_boot :: ModIface -> IsBootInterface
+mi_boot :: ModIface_ phase -> IsBootInterface
mi_boot iface = if mi_hsc_src iface == HsBootFile
then IsBoot
else NotBoot
@@ -557,7 +664,7 @@ mi_mnwib iface = GWIB (moduleName $ mi_module iface) (mi_boot iface)
-- | Lookups up a (possibly cached) fixity from a 'ModIface'. If one cannot be
-- found, 'defaultFixity' is returned instead.
-mi_fix :: ModIface -> OccName -> Fixity
+mi_fix :: RetainedModIface -> OccName -> Fixity
mi_fix iface name = mi_fix_fn iface name `orElse` defaultFixity
-- | The semantic module for this interface; e.g., if it's a interface
@@ -573,7 +680,7 @@ mi_semantic_module iface = mi_mod_info_semantic_module (mi_mod_info iface)
-- | The "precise" free holes, e.g., the signatures that this
-- 'ModIface' depends on.
-mi_free_holes :: ModIface -> UniqDSet ModuleName
+mi_free_holes :: ModIface_ phase -> UniqDSet ModuleName
mi_free_holes iface =
case getModuleInstantiation (mi_module iface) of
(_, Just indef)
@@ -654,7 +761,7 @@ instance Binary ModIface where
-- We can't populate this field here, as we are
-- missing the 'mi_ext_fields_' field, which is
-- handled in 'getIfaceWithExtFields'.
- mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
+ mi_hi_bytes_ = Strict.Nothing
})
instance Binary IfaceModInfo where
@@ -767,70 +874,108 @@ instance Binary IfaceSimplifiedCore where
emptyPartialModIface :: Module -> PartialModIface
emptyPartialModIface mod
= PrivateModIface
- { mi_mod_info_ = emptyIfaceModInfo mod,
- mi_iface_hash_ = fingerprint0,
- mi_hi_bytes_ = PartialIfaceBinHandle,
- mi_deps_ = noDependencies,
- mi_public_ = emptyPublicModIface (),
- mi_simplified_core_ = Nothing,
- mi_top_env_ = IfaceTopEnv emptyDetOrdAvails [] ,
- mi_docs_ = Nothing,
- mi_self_recomp_ = Nothing,
- mi_ext_fields_ = emptyExtensibleFields
+ {
+ mi_hi_bytes_ = Strict.Nothing,
+ mi_iface_hash_ = fingerprint0,
+ mi_mod_info_ = emptyIfaceModInfo mod,
+ mi_deps_ = noDependencies,
+ mi_public_ = emptyPartialIfacePublic,
+ mi_self_recomp_ = Nothing,
+ mi_simplified_core_ = Nothing,
+ mi_docs_ = Nothing,
+ mi_top_env_ = IfaceTopEnv emptyDetOrdAvails [],
+ mi_ext_fields_ = emptyExtensibleFields
+ }
+ where
+ emptyIfaceModInfo :: Module -> IfaceModInfo
+ emptyIfaceModInfo mod
+ = IfaceModInfo
+ {
+ mi_mod_info_module = mod,
+ mi_mod_info_sig_of = Nothing,
+ mi_mod_info_hsc_src = HsSrcFile
}
-emptyIfaceModInfo :: Module -> IfaceModInfo
-emptyIfaceModInfo mod = IfaceModInfo
- { mi_mod_info_module = mod
- , mi_mod_info_sig_of = Nothing
- , mi_mod_info_hsc_src = HsSrcFile
- }
-
+ emptyPartialIfacePublic :: PartialIfacePublic
+ emptyPartialIfacePublic
+ = IfacePublic
+ {
+ mi_exports_ = [],
+ mi_fixities_ = [],
+ mi_warns_ = IfWarnSome [] [],
+ mi_anns_ = [],
+ mi_decls_ = [],
+ mi_defaults_ = [],
+ mi_insts_ = [],
+ mi_fam_insts_ = [],
+ mi_rules_ = [],
+ mi_trust_ = noIfaceTrustInfo,
+ mi_trust_pkg_ = False,
+ mi_complete_matches_ = [],
+ mi_caches_ = emptyPartialIfaceCache,
+ mi_abi_hashes_ = ()
+ }
+ where
+
+ emptyPartialIfaceCache :: PartialIfaceCache
+ emptyPartialIfaceCache
+ = IfaceCache
+ {
+ mi_cache_decl_warn_fn = (),
+ mi_cache_export_warn_fn = (),
+ mi_cache_fix_fn = (),
+ mi_cache_hash_fn = ()
+ }
-emptyPublicModIface :: IfaceAbiHashesExts phase -> IfacePublic_ phase
-emptyPublicModIface abi_hashes = IfacePublic
- { mi_exports_ = []
- , mi_decls_ = []
- , mi_fixities_ = []
- , mi_warns_ = IfWarnSome [] []
- , mi_anns_ = []
- , mi_defaults_ = []
- , mi_insts_ = []
- , mi_fam_insts_ = []
- , mi_rules_ = []
- , mi_abi_hashes_ = abi_hashes
- , mi_trust_ = noIfaceTrustInfo
- , mi_trust_pkg_ = False
- , mi_caches_ = emptyModIfaceCache
- , mi_complete_matches_ = []
- }
+emptyModIface :: Module -> ModIface
+emptyModIface mod
+ | PrivateModIface {..} <- emptyPartialModIface mod
+ = PrivateModIface
+ {
+ mi_hi_bytes_ = Strict.Nothing,
+ mi_public_ = convertIfacePublic mi_public_,
+ ..
+ }
+ where
-emptyModIfaceCache :: IfaceCache
-emptyModIfaceCache = IfaceCache {
- mi_cache_decl_warn_fn = emptyIfaceWarnCache,
- mi_cache_export_warn_fn = emptyIfaceWarnCache,
- mi_cache_fix_fn = emptyIfaceFixCache,
- mi_cache_hash_fn = emptyIfaceHashCache
-}
+ convertIfacePublic :: PartialIfacePublic -> IfacePublic
+ convertIfacePublic IfacePublic {..}
+ = IfacePublic
+ {
+ mi_decls_ = [],
+ mi_caches_ = convertIfaceCache mi_caches_,
+ mi_abi_hashes_ = emptyIfaceAbiHashes,
+ ..
+ }
+ where
+
+ convertIfaceCache :: PartialIfaceCache -> IfaceCache
+ convertIfaceCache IfaceCache {..}
+ = IfaceCache
+ {
+ mi_cache_fix_fn = emptyIfaceFixCache,
+ ..
+ }
-emptyIfaceBackend :: IfaceAbiHashes
-emptyIfaceBackend = IfaceAbiHashes
- { mi_abi_mod_hash = fingerprint0,
- mi_abi_orphan = False,
- mi_abi_finsts = False,
+ emptyIfaceAbiHashes :: IfaceAbiHashes
+ emptyIfaceAbiHashes
+ = IfaceAbiHashes
+ {
+ mi_abi_mod_hash = fingerprint0,
+ mi_abi_orphan = False,
+ mi_abi_finsts = False,
mi_abi_export_avails_hash = fingerprint0,
- mi_abi_orphan_like_hash = fingerprint0,
- mi_abi_orphan_hash = fingerprint0
+ mi_abi_orphan_like_hash = fingerprint0,
+ mi_abi_orphan_hash = fingerprint0
}
+{-# DEPRECATED emptyFullModIface "Use the equivalent emptyModIface instead." #-}
emptyFullModIface :: Module -> ModIface
-emptyFullModIface mod =
- (emptyPartialModIface mod)
- { mi_public_ = emptyPublicModIface emptyIfaceBackend
- , mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
- }
+emptyFullModIface = emptyModIface
+emptyRetainedModIface :: Module -> RetainedModIface
+emptyRetainedModIface = retainedModIface . emptyModIface
-- | Constructs cache for the 'mi_hash_fn' field of a 'ModIface'
mkIfaceHashCache :: [(Fingerprint,IfaceDecl)]
@@ -848,11 +993,21 @@ emptyIfaceHashCache _occ = Nothing
-- ModIface is completely forced since it will live in memory for a long time.
-- If forcing it uses a lot of memory, then store less things in ModIface.
-instance ( NFData (IfaceAbiHashesExts (phase :: ModIfacePhase))
- , NFData (IfaceDeclExts (phase :: ModIfacePhase))
+instance ( NFData (IfaceHashData phase)
+ , NFData (IfaceSelfRecompData phase)
+ , NFData (IfaceSimplifiedCoreData phase)
+ , NFData (ExtensibleFieldsData phase)
+ , NFData (IfaceAnnotationsData phase)
+ , NFData (IfaceDeclsData phase)
+ , NFData (IfaceDefaultsData phase)
+ , NFData (IfaceClsInstsData phase)
+ , NFData (IfaceFamInstsData phase)
+ , NFData (IfaceRulesData phase)
+ , NFData (IfaceCompleteMatchesData phase)
+ , NFData (IfaceAbiHashesData phase)
) => NFData (ModIface_ phase) where
rnf (PrivateModIface a1 a2 a3 a4 a5 a6 a7 a8 a9 a10)
- = (a1 :: IfaceBinHandle phase)
+ = a1
`seq` rnf a2
`seq` rnf a3
`seq` rnf a4
@@ -882,7 +1037,15 @@ instance NFData IfaceAbiHashes where
`seq` rnf a5
`seq` rnf a6
-instance (NFData (IfaceAbiHashesExts phase), NFData (IfaceDeclExts phase)) => NFData (IfacePublic_ phase) where
+instance ( NFData (IfaceAnnotationsData phase)
+ , NFData (IfaceDeclsData phase)
+ , NFData (IfaceDefaultsData phase)
+ , NFData (IfaceClsInstsData phase)
+ , NFData (IfaceFamInstsData phase)
+ , NFData (IfaceRulesData phase)
+ , NFData (IfaceCompleteMatchesData phase)
+ , NFData (IfaceAbiHashesData phase)
+ ) => NFData (IfacePublic_ phase) where
rnf (IfacePublic a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14)
= rnf a1
`seq` rnf a2
@@ -899,7 +1062,7 @@ instance (NFData (IfaceAbiHashesExts phase), NFData (IfaceDeclExts phase)) => NF
`seq` rnf a13
`seq` rnf a14
-instance NFData IfaceCache where
+instance NFData (IfaceCache_ phase) where
rnf = rwhnf
forceModIface :: ModIface -> IO ()
@@ -955,10 +1118,9 @@ completePartialModIface :: PartialModIface
completePartialModIface partial iface_hash decls extra_decls final_exts cache = partial
{ mi_public_ = completePublicModIface decls final_exts cache (mi_public_ partial)
, mi_simplified_core_ = extra_decls
- , mi_hi_bytes_ = FullIfaceBinHandle Strict.Nothing
+ , mi_hi_bytes_ = Strict.Nothing
, mi_iface_hash_ = iface_hash
}
- where
-- | Given a 'PartialIfacePublic', turn it into an 'IfacePublic' by completing
-- missing fields.
@@ -973,13 +1135,57 @@ completePublicModIface decls abi_hashes cache partial = partial
, mi_caches_ = cache
}
+retainedModIface :: ModIface -> RetainedModIface
+retainedModIface PrivateModIface {..}
+ = PrivateModIface
+ {
+ mi_hi_bytes_ = Strict.Nothing,
+ mi_iface_hash_ = (),
+ mi_public_ = retainedIfacePublic mi_public_,
+ mi_self_recomp_ = (),
+ mi_simplified_core_ = (),
+ mi_ext_fields_ = (),
+ ..
+ }
+ where
+
+ retainedIfacePublic :: IfacePublic -> RetainedIfacePublic
+ retainedIfacePublic IfacePublic {..}
+ = IfacePublic
+ {
+ mi_anns_ = (),
+ mi_decls_ = (),
+ mi_defaults_ = (),
+ mi_insts_ = (),
+ mi_fam_insts_ = (),
+ mi_rules_ = (),
+ mi_complete_matches_ = (),
+ mi_caches_ = retainedIfaceCache mi_caches_,
+ ..
+ }
+ where
+
+ retainedIfaceCache :: IfaceCache -> RetainedIfaceCache
+ retainedIfaceCache IfaceCache {..}
+ = IfaceCache
+ {
+ mi_cache_decl_warn_fn = mkIfaceDeclWarnCache bare_warnings,
+ mi_cache_export_warn_fn = mkIfaceExportWarnCache bare_warnings,
+ mi_cache_hash_fn = mkIfaceHashCache mi_decls_,
+ ..
+ }
+ where
+
+ bare_warnings :: Warnings GhcRn
+ bare_warnings = fromIfaceWarnings mi_warns_
+
set_mi_mod_info :: IfaceModInfo -> ModIface_ phase -> ModIface_ phase
set_mi_mod_info val iface = clear_mi_hi_bytes $ iface { mi_mod_info_ = val }
-set_mi_self_recomp :: Maybe IfaceSelfRecomp-> ModIface_ phase -> ModIface_ phase
+set_mi_self_recomp :: IfaceSelfRecompData phase -> ModIface_ phase -> ModIface_ phase
set_mi_self_recomp val iface = clear_mi_hi_bytes $ iface { mi_self_recomp_ = val }
-set_mi_hi_bytes :: IfaceBinHandle phase -> ModIface_ phase -> ModIface_ phase
+set_mi_hi_bytes :: Strict.Maybe (IfaceBinHandle phase) -> ModIface_ phase -> ModIface_ phase
set_mi_hi_bytes val iface = iface { mi_hi_bytes_ = val }
set_mi_deps :: Dependencies -> ModIface_ phase -> ModIface_ phase
@@ -988,7 +1194,7 @@ set_mi_deps val iface = clear_mi_hi_bytes $ iface { mi_deps_ = val }
set_mi_public :: (IfacePublic_ phase -> IfacePublic_ phase) -> ModIface_ phase -> ModIface_ phase
set_mi_public f iface = clear_mi_hi_bytes $ iface { mi_public_ = f (mi_public_ iface) }
-set_mi_simplified_core :: Maybe IfaceSimplifiedCore -> ModIface_ phase -> ModIface_ phase
+set_mi_simplified_core :: IfaceSimplifiedCoreData phase -> ModIface_ phase -> ModIface_ phase
set_mi_simplified_core val iface = clear_mi_hi_bytes $ iface { mi_simplified_core_ = val }
set_mi_top_env :: IfaceTopEnv -> ModIface_ phase -> ModIface_ phase
@@ -997,7 +1203,7 @@ set_mi_top_env val iface = clear_mi_hi_bytes $ iface { mi_top_env_ = val }
set_mi_docs :: Maybe Docs -> ModIface_ phase -> ModIface_ phase
set_mi_docs val iface = clear_mi_hi_bytes $ iface { mi_docs_ = val }
-set_mi_ext_fields :: ExtensibleFields -> ModIface_ phase -> ModIface_ phase
+set_mi_ext_fields :: ExtensibleFieldsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_ext_fields val iface = clear_mi_hi_bytes $ iface { mi_ext_fields_ = val }
{- Settings for mi_public interface fields -}
@@ -1011,22 +1217,22 @@ set_mi_fixities val = set_mi_public (\iface -> iface { mi_fixities_ = val })
set_mi_warns :: IfaceWarnings -> ModIface_ phase -> ModIface_ phase
set_mi_warns val = set_mi_public (\iface -> iface { mi_warns_ = val })
-set_mi_anns :: [IfaceAnnotation] -> ModIface_ phase -> ModIface_ phase
+set_mi_anns :: IfaceAnnotationsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_anns val = set_mi_public (\iface -> iface { mi_anns_ = val })
-set_mi_insts :: [IfaceClsInst] -> ModIface_ phase -> ModIface_ phase
+set_mi_insts :: IfaceClsInstsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_insts val = set_mi_public (\iface -> iface { mi_insts_ = val })
-set_mi_fam_insts :: [IfaceFamInst] -> ModIface_ phase -> ModIface_ phase
+set_mi_fam_insts :: IfaceFamInstsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_fam_insts val = set_mi_public (\iface -> iface { mi_fam_insts_ = val })
-set_mi_rules :: [IfaceRule] -> ModIface_ phase -> ModIface_ phase
+set_mi_rules :: IfaceRulesData phase -> ModIface_ phase -> ModIface_ phase
set_mi_rules val = set_mi_public (\iface -> iface { mi_rules_ = val })
-set_mi_decls :: [IfaceDeclExts phase] -> ModIface_ phase -> ModIface_ phase
+set_mi_decls :: IfaceDeclsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_decls val = set_mi_public (\iface -> iface { mi_decls_ = val })
-set_mi_defaults :: [IfaceDefault] -> ModIface_ phase -> ModIface_ phase
+set_mi_defaults :: IfaceDefaultsData phase -> ModIface_ phase -> ModIface_ phase
set_mi_defaults val = set_mi_public (\iface -> iface { mi_defaults_ = val })
set_mi_trust :: IfaceTrustInfo -> ModIface_ phase -> ModIface_ phase
@@ -1035,27 +1241,27 @@ set_mi_trust val = set_mi_public (\iface -> iface { mi_trust_ = val })
set_mi_trust_pkg :: Bool -> ModIface_ phase -> ModIface_ phase
set_mi_trust_pkg val = set_mi_public (\iface -> iface { mi_trust_pkg_ = val })
-set_mi_complete_matches :: [IfaceCompleteMatch] -> ModIface_ phase -> ModIface_ phase
+set_mi_complete_matches :: IfaceCompleteMatchesData phase -> ModIface_ phase -> ModIface_ phase
set_mi_complete_matches val = set_mi_public (\iface -> iface { mi_complete_matches_ = val })
-set_mi_abi_hashes :: IfaceAbiHashesExts phase -> ModIface_ phase -> ModIface_ phase
+set_mi_abi_hashes :: IfaceAbiHashesData phase -> ModIface_ phase -> ModIface_ phase
set_mi_abi_hashes val = set_mi_public (\iface -> iface { mi_abi_hashes_ = val })
{- Setters for mi_caches interface fields -}
-set_mi_decl_warn_fn :: (OccName -> Maybe (WarningTxt GhcRn)) -> ModIface_ phase -> ModIface_ phase
+set_mi_decl_warn_fn :: IfaceDeclWarningCacheData phase -> ModIface_ phase -> ModIface_ phase
set_mi_decl_warn_fn val = set_mi_public (\iface -> iface { mi_caches_ = (mi_caches_ iface) { mi_cache_decl_warn_fn = val } })
-set_mi_export_warn_fn :: (Name -> Maybe (WarningTxt GhcRn)) -> ModIface_ phase -> ModIface_ phase
+set_mi_export_warn_fn :: IfaceExportWarningCacheData phase -> ModIface_ phase -> ModIface_ phase
set_mi_export_warn_fn val = set_mi_public (\iface -> iface { mi_caches_ = (mi_caches_ iface) { mi_cache_export_warn_fn = val } })
-set_mi_fix_fn :: (OccName -> Maybe Fixity) -> ModIface_ phase -> ModIface_ phase
+set_mi_fix_fn :: IfaceFixityCacheData phase -> ModIface_ phase -> ModIface_ phase
set_mi_fix_fn val = set_mi_public (\iface -> iface { mi_caches_ = (mi_caches_ iface) { mi_cache_fix_fn = val } })
-set_mi_hash_fn :: (OccName -> Maybe (OccName, Fingerprint)) -> ModIface_ phase -> ModIface_ phase
+set_mi_hash_fn :: IfaceHashCacheData phase -> ModIface_ phase -> ModIface_ phase
set_mi_hash_fn val = set_mi_public (\iface -> iface { mi_caches_ = (mi_caches_ iface) { mi_cache_hash_fn = val } })
-set_mi_caches :: IfaceCache -> ModIface_ phase -> ModIface_ phase
+set_mi_caches :: IfaceCache_ phase -> ModIface_ phase -> ModIface_ phase
set_mi_caches val = set_mi_public (\iface -> iface { mi_caches_ = val })
{-
@@ -1082,11 +1288,7 @@ set_mi_mod_info_field f iface = clear_mi_hi_bytes $ iface { mi_mod_info_ = f (mi
-- | Invalidate any byte array buffer we might have.
clear_mi_hi_bytes :: ModIface_ phase -> ModIface_ phase
-clear_mi_hi_bytes iface = iface
- { mi_hi_bytes_ = case mi_hi_bytes iface of
- PartialIfaceBinHandle -> PartialIfaceBinHandle
- FullIfaceBinHandle _ -> FullIfaceBinHandle Strict.Nothing
- }
+clear_mi_hi_bytes iface = iface { mi_hi_bytes_ = Strict.Nothing }
-- ----------------------------------------------------------------------------
-- 'ModIface' pattern synonyms to keep breakage low.
@@ -1177,33 +1379,33 @@ pattern ModIface ::
-> Module
-> Maybe Module
-> HscSource
- -> Fingerprint
+ -> IfaceHashData phase
-> Dependencies
-> IfacePublic_ phase
-> [IfaceExport]
-> [(OccName, Fixity)]
-> IfaceWarnings
- -> [IfaceAnnotation]
- -> [IfaceDeclExts phase]
- -> Maybe IfaceSimplifiedCore
- -> [IfaceDefault]
+ -> IfaceAnnotationsData phase
+ -> IfaceDeclsData phase
+ -> IfaceSimplifiedCoreData phase
+ -> IfaceDefaultsData phase
-> IfaceTopEnv
- -> [IfaceClsInst]
- -> [IfaceFamInst]
- -> [IfaceRule]
+ -> IfaceClsInstsData phase
+ -> IfaceFamInstsData phase
+ -> IfaceRulesData phase
-> IfaceTrustInfo
-> Bool
- -> [IfaceCompleteMatch]
+ -> IfaceCompleteMatchesData phase
-> Maybe Docs
- -> IfaceAbiHashesExts phase
- -> ExtensibleFields
- -> IfaceBinHandle phase
- -> Maybe IfaceSelfRecomp
- -> (OccName -> Maybe Fixity)
- -> (OccName -> Maybe (OccName, Fingerprint))
- -> (OccName -> Maybe (WarningTxt GhcRn))
- -> (Name -> Maybe (WarningTxt GhcRn)) ->
- ModIface_ phase
+ -> IfaceAbiHashesData phase
+ -> ExtensibleFieldsData phase
+ -> Strict.Maybe (IfaceBinHandle phase)
+ -> IfaceSelfRecompData phase
+ -> IfaceFixityCacheData phase
+ -> IfaceHashCacheData phase
+ -> IfaceDeclWarningCacheData phase
+ -> IfaceExportWarningCacheData phase
+ -> ModIface_ phase
pattern ModIface
{ mi_mod_info
, mi_module
=====================================
ghc/Main.hs
=====================================
@@ -515,7 +515,7 @@ abiHash strs = do
put_ bh hiVersion
-- package hashes change when the compiler version changes (for now)
-- see #5328
- mapM_ (put_ bh . mi_mod_hash) ifaces
+ mapM_ (put_ bh . mi_abi_mod_hash . mi_abi_hashes) ifaces
f <- fingerprintBinMem bh
putStrLn (showPpr dflags f)
=====================================
utils/count-deps/Main.hs
=====================================
@@ -79,5 +79,5 @@ calcDeps modName libdir =
mkModule :: String -> ModuleName -> Module
mkModule ghcUnitId = Module (stringToUnit ghcUnitId)
- modDeps :: ModIface -> [ModuleName]
+ modDeps :: ModIface_ phase -> [ModuleName]
modDeps mi = map (gwib_mod . (\(_, _, mn) -> mn)) $ Set.toList $ dep_direct_mods (mi_deps mi)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bd762f2c237c9990579d65a2b6e2fd…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bd762f2c237c9990579d65a2b6e2fd…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0