-
192be0b6
by Luite Stegeman at 2026-09-07T19:43:36-04:00
rts: fix ctoi_tuple_spill_words getting out of sync
Fix a few places that were not updating ctoi_tuple_spill_words
correctly, leading to corruption/crashes when dealing with large
unboxed tuples in bytecode:
- captureContinuationAndAbort
- findRetryFrameHelper/findAtomicallyFrameHelper
- interpretBCO bci_BRK_FUN
fixes #27633
-
604eb43c
by Simon Jakobi at 2026-09-07T19:44:15-04:00
Hadrian: don't capture the testsuite driver's output (#27780)
a6061455d54 switched the Testsuite RunTest case from Shake's cmd to the
cmd' wrapper. cmd' always captures stdout and stderr, and since the
caller asks for Exit, it returns without dumping what it captured. As a
result the testsuite output no longer appears in CI job logs: failures,
performance metrics and the summary were lost with the job.
Use cmdExe, the uncaptured cmd, as the other plain-cmd sites in that
commit do.
Fixes #27780.
Assisted-by: Claude Fable 5.1
-
06eee015
by Luite Stegeman at 2026-09-08T06:03:06+02:00
rts: Fix missing memory barrier in eval_thunk_selector (#27477)
unchain_thunk_selectors() was missing an ACQUIRE_LOAD for the
indirectee, leading to segfaults and corruption during GC on
weakly-ordered architectures.
Fixes #27477
-
f8b2bd8f
by Alan Zimmerman at 2026-09-08T09:39:12-04:00
EPA Fix HsCmdDo exact print with comments
Exact printing of HsCmdDo was ignoring the location for the do
statements, and this is an annotation that can have comments in it.
Update it so we print the statements as a unit, including any
comments.
Also add the result of auditing that we capture comments in all needed
places, noting that the remaining Anno SrcSpan instances are benign.
-
430967ab
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Reorder cmm decls in HeapStackCheck for a better logical grouping
And put more section headers in to deliniate the groups.
We're about to add more here, so better to organise it first.
-
344080fd
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Add raisePrimIOException and add it to RTS<->ghc-internal API
The raisePrimIOException is a new helper function that I/O primops will
use to help them report I/O errors. This is implemented in Haskell
(since that's a lot easier), but has a calling convention that is
easy(ish) to use from Cmm in the I/O primops.
So we add it to the RTS API struct, and since we'll use it from Cmm we
also need a field accessor macro for cmm (in deriveConstants).
See the Note about how we cannot have nice things due to async
exceptions and thunks preventing us from using catch.
-
cfdb3399
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Add new blocking functions for I/O primops
See the Note [Thread blocking for new I/O primops],
and the Note [Calling convention for raisePrimIOException].
The point is, it will allow us to report synchronous exceptions from I/O
primops, and do so much more flexibly.
Previously the I/O managers could only report async exceptions and only
nullary exceptions. This was OK historically, but no good as we add
more I/O managers and expand the range of I/O operations we support.
-
f09c09d8
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Change the encoding of results from the I/O manager to I/O primops
Previously we just had async continue or heap overflow.
We now extend what we can report with synchronous success, and
synchronous failure with an errno.
See Note [Encoding of result of I/O manager operations]
We don't use these two new cases yet, but we will. In particular an
epoll I/O manager needs to be able to report synchronous success or
failure for waitRead#/waitWrite#.
-
30f074d9
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Switch waitRead/Write# to use new blocking return frames
and update the I/O managers to set the result before resuming the
blocked threads.
This makes it possible for I/O managers to report synchronous exceptions
from the I/O primops, but that will be done in a subsequent commit.
-
a8786ced
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Switch Poll and Select I/O managers to report sync exceptions
rather than using raiseAsync with blockedOnBadFD_closure.
This uses the new mechanism in the blocking frame return code to report
synchronous exceptions.
-
7a9df79a
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Remove now-unused blockedOnBadFD
It was previously thrown by the select and poll I/O managers, but now
they use raisePrimIOException (with an EBADF errno).
-
6b0424e3
by Duncan Coutts at 2026-09-09T11:07:01+01:00
Improve the docs for delay# waitRead# and waitWrite#
Document that the waitRead/Write# can throw exceptions (this was true
before too), and that all of them are async exception cancellation
points.
-
afeb2c30
by Duncan Coutts at 2026-09-09T20:08:58-04:00
Enable printf warnings for trace functions and fix resulting warnings
Most of the existing printf-style functions are annotated with
attributes to enable gcc/clang warnings for the printf format string,
but several trace functions in Trace.h were missing this annotation.
Enable them, and fix the resulting warnings.
-
9a442c93
by Alan Zimmerman at 2026-09-09T20:09:36-04:00
EPA: Exact print ConDeclGADT without custom enterAnn
!16321 brought in explicit capture of parens in a ConDeclGADT.
The ExactPrint update introduced a modification of the fundamental
function in exact printing, `enterAnn`, by splitting it into a version
allowing injection of functionality normally handled by the
ExactPrint class methods.
This commit refactors that code, to restore the prior `enterAnn`
version, by following the convention in ExactPrint of introducing a
helper data structure with its own `ExactPrint` instance to achieve
the same effect.
-
4e9297ea
by Simon Jakobi at 2026-09-11T08:32:45-04:00
ci: Actually pass --ignore-perf-failures to the testsuite driver
684c0018d9 changed the IGNORE_PERF_FAILURES handling to append to
RUNTEST_ARGS with bash array syntax, but the three use sites still
expand RUNTEST_ARGS as a scalar, which yields only the first array
element. The appended flag was therefore dropped in every job, so
perf improvements kept failing Marge Bot batches and master pipelines,
contrary to #19562.
Append as a string instead, matching the existing --force-colors
append in test_hadrian.
Fixes #27563.
Assisted-by: Claude Fable 5.1
-
4f78dfdf
by Simon Jakobi at 2026-09-11T08:33:24-04:00
testsuite: Give T26537 a 1.5x compile timeout
Its -fregs-graph compile step tends to time out in unoptimized builds
(#27188, #27776).
Assisted-by: Claude Fable 5.1
-
130286e3
by Alan Zimmerman at 2026-09-11T08:34:08-04:00
EPA: Remove ListBanana / ListParens from AnnListBrackets
This is a step towards making AnnList only represent
lists of items which can have either braces or layout.
-
a9827d13
by Simon Jakobi at 2026-09-11T18:53:32-04:00
Reject ~, UNPACK and multiplicity annotations on type data fields
Only `!` was rejected so far. `~`, UNPACK and multiplicity annotations
were silently accepted. None of them make sense at the type level, so
restriction (R3) of Note [Type data declarations] now covers all of
them.
Fixes #27732.
Assisted-by: Claude Fable 5.1
-
c71d5e23
by Alan Zimmerman at 2026-09-11T18:54:11-04:00
EPA: Add a Note for the exact print main loop
-
184d4c54
by Alan Zimmerman at 2026-09-12T16:50:25+01:00
EPA: More targeted HsDo exact print annotation
HsDo is multi-purpose, as encoded in its HsDoFlavour field. Some of
these are in a layout context (DoExpr, MDoExpr), others are not
(ListComp, MonadComp).
We are moving towards using AnnList only in layout contexts, so we
switch the HsDo TTG annotation from holding an AnnList for this, to
holding
Either (EpToken "[", EpToken "]") AnnList
This also allows us to trim down AnnListBrackets to only have braces
or None, thereby opening the door for unification with the existing
layout context data type EpLayout.
-
99dc2235
by Alan Zimmerman at 2026-09-12T17:25:02+01:00
EPA: Add specific layout field to AnnList
Up to now AnnList has effectively served to represent lists of things
having layout, regardless of whether they do or not.
In Haskell, layout is optional in many places, as there is also an
alternative syntax using braces and semi-colons, which is free-form.
This commit introduces AnnListLayout, a data structure capturing this
distinction.
It is deliberately set up similarly to EpLayout, so that these two can
be merged in time.
-
5017a5e9
by Alan Zimmerman at 2026-09-12T17:25:02+01:00
EPA: Use EpaLocation in EpVirtualBraces
reword:
EPA Use vocurly as basis for AnnListLayout
For the existing cases that populate AnnList.
This also shows up AnnList usages that can never capture layout.
-
c97a7cd1
by Alan Zimmerman at 2026-09-12T18:01:55+01:00
EPA: Use vocurly as basis for AnnListLayout
For the existing cases that populate AnnList.
This also shows up AnnList usages that can never capture layout.
-
abcb64e7
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: AnnList clean up patch for empty where clause
-
a09cf2ab
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: Add TTG fields to FamilyInfo
This commit is a simple add, with unused extension fields.
It lays the groundwork for using them for exact print annotations
-
14055661
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
WIP annclassdecl
-
fc969850
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: Update AnnClsInstDecl to contain AnnList
It was already separately tracking the '{', '}' and leading ';' values.
This aligns it with layout-introducing parser productions ('vocurly'),
so the layout processing can be handled uniformly
-
306aa75e
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: Tidy up markAnnListA'
It takes an action which can modify the AnnList, but this
is never used. So remove it.
-
c0d5dcea
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: Use AnnList for GADT declarations
-
96f7edc7
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
EPA: Use AnnList in AnnClassDecl
-
0e4a0024
by Alan Zimmerman at 2026-09-12T18:18:51+01:00
MOVE EPA: Plan for Fixing AnnList Layout Properly
-
1e2a6e7b
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make local binds located
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.
-
af74d4a1
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Use AnnList in HsMultiIf
It introduces layout, capture it
-
dff39adb
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Use AnnList in DecBrl
-
bdb6df32
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
-
7d1214a9
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
WIP: setLayoutBoth inside markAnnListA
Current problem is it is a global one-shot, and MG has one too
Check: is it needed?
if so, honouring EpLayout may be needed
-
5df232f9
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA some tests for layout. WIP
-
54059953
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
Exactprint layout scope plan. Do not commit
-
a0ef48f0
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: tidy up a bit. Combine somewhere else
-
62c34a32
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Introduce LayoutFrame stacks in ExactPrint state
-
01869f8a
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
Align with ghc-exactprint
-
568daed7
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Fix AnnList leading semis when layout
When there is layout, anything printed triggers it, including leading
semis.
Add some test case examples too
-
34079dc6
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
Exactprint: tidy up layout capturing
-
dea6e4ce
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: add makeDelta test for Test20297
The original #20297 related to comment placement for exact printing
after running ExactPrint.makeDelta on ParsedSource. Add an additional
test that explicitly tests this.
-
86c3e786
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make ValBinds LocatedA in HsLocalBindsLR
If we have items with an AnnList Annotation, as part of another, which
has different content, it must be LocatedA. This is a technical requirement
due to the way comment allocation happens during the makeDelta processing.
Comments are queued for printing, and as soon as any non-comment is to
be printed, the pending comments before that position are printed, and
in makeDelta processing these attached as preceding comments to the thing
just printed.
The means they end up captured inside the layout region of the AnnList item.
So for
foo = x
where -- comment
x = 3
the comment ends up as a preceding comment of `x = 3`, inside the
layout, and prints as
foo = x
where
-- comment
x = 3
-
ad1401b8
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make IPBinds LocatedA
-
579b1123
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make ClsInstDecl decls LocatedA
-
0218256e
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make ClassDecls decls LocatedA
-
dc8c9efa
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make ClosedTypeFamily equations Located
For FamilyDecl/ClosedTypeFamily
-
497bb000
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make dd_cons located
-
3d7d77df
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make HsMultiIf options located
-
e4e7df9d
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Make DecBrl contents LocatedA
-
86c9a465
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Located do statements
-
29141ac6
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Print RecStmt located
-
f9d73080
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: HsCmdDo Located
-
e901e0c9
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
Extend Test20297 for additional occurrences
-
39b57cab
by Alan Zimmerman at 2026-09-12T18:18:52+01:00
EPA: Tweak PatSynBind location for comments
-
0fbbcadb
by Alan Zimmerman at 2026-09-12T18:42:05+01:00
EPA: WIP, add test for where ;; ValBinds
-
e79fc375
by Alan Zimmerman at 2026-09-12T18:42:05+01:00
EPA: Make EpVirtualBraces noSpanAnchor if no contents
Otherwise the vocurly is emitted at the start of the next
item parsed
Check: is this needed, or just a check for empty contents?
-
5ab16646
by Alan Zimmerman at 2026-09-12T18:42:47+01:00
WIP: turn of exactprint debug printing
-
0c48a521
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
EPA: Remove CanUpdateAnchorOnly
-
dcab4f1d
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
Plan update DO NOT COMMIT
-
74ad6345
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
EPA: First pass implementation of HsList, for ClassDecls
Just as a straight list replacement to start with, no payload.
This shows the scope and invasiveness of the initial change
-
b5fb113b
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
EPA: HsList attempt WIP
-
81185c6e
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
Enable ppr test for Haddock1. It currently fails
-
d0c53068
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
WIP on removing NoEpAnn. Likely abandon
-
e9c53c86
by Alan Zimmerman at 2026-09-12T18:43:04+01:00
EPA: Add an overview doc for exact printing
-
fef90109
by Simon Peyton Jones at 2026-09-12T18:43:04+01:00
Added an intro section