-
6e381626
by Duncan Coutts at 2026-07-01T22:29:55+01:00
Adjust releaseCapability_ precondition to allow cap->running_task == NULL
There are two use cases for releaseCapability_:
1. The current Task (cap->running_task) releases the Capability.
The Capability is marked free, and if there is any work to do,
an appropriate Task is woken up.
2. There is no current task (cap->task == NULL), and thus the
Capability is idle, and we want to wake up an idle Task to animate
the Capability. This case uses always_wakeup.
Currently, the precondition for releaseCapability_ is
cap->running_task != NULL
and so the 2nd use cases have to set cap->running_task (which is then
immediately overwritten) just to satisfy the precondition. See the
use cases in sendMessage and prodCapability.
So we can relax the precondition to be:
cap->running_task != NULL || always_wakeup
so that in the always_wakeup case, we say it is ok for the
cap->running_task to be NULL.
This lets us simplify sendMessage and prodCapability. In particular it
will allow prodCapability to not need a Task parameter.
The ulterior motive for all this is that I want to be able to call
prodCapability from an OS thread that is not itself a Task, in persuit
of issue #27086: disentangle I/O managers from wakeUpRts. The most
straightforward way to wake the RTS is using prodCapability, but the
context in which we will need to do that are threads that are not Tasks.
-
89404ebc
by Duncan Coutts at 2026-07-01T22:29:55+01:00
prodCapability no longer needs to take a Task param
Now that releaseCapability_ can accept cap->running_task == NULL then it
is no longer necessary for prodCapability to require a Task.
-
4e60c5f6
by Duncan Coutts at 2026-07-01T22:29:56+01:00
Define prodOneCapability
There was an existing declaration for this in the header file, but no
definition.
Similarly, there is a declaration for prodAllCapabilities but no
definition, and we don't need it, so remove the declaration.
-
2527026f
by Duncan Coutts at 2026-07-01T22:29:56+01:00
Add a wakeUpRtsViaTicker feature to the posix ticker
It proxies a call to wakeUpRts, but crucially, this can be called from
a signal handler context. It will be used for ctl-c handling.
-
aa5a03a5
by Duncan Coutts at 2026-07-01T22:29:56+01:00
Change how wakeUpRts works
Previously it would call wakeupIOManager to get a capability to wake up
and run. This works but it entangles the I/O managers with unrelated
features: ctl-c handling and idle gc (the two features that use wakeUpRts).
The reason it used wakeupIOManager is that this action is safe to use
from a posix signal handler, since it just posts bytes to a pipe.
Otherwise the more direct approach (used e.g. by sendMessage when the
target capability is idle) is to use releaseCapability. But that uses
condition variables and mutexes, which are not safe to use from within a
signal handler.
So instead of entangling the (multiple) I/O managers with this, we make
wakeUpRts use the direct approach (using prodOneCapability). On win32
the ctl-c console handler can call wakeUpRts directly, since it is
called in a proper thread. On posix, to deal with the signal handler
problem, we make the signal handler ask the ticker thread to proxy the
call to wakeUpRts, since the ticker thread is also a proper thread.
This will allow the I/O managers to no longer be concerned with this.
This is good because there are many I/O managers (and they're
complicated), but there is (on posix) only one ticker implementation. So
this is an overall reduction in coupling and complexity.
Fixes issue #27086
-
c6d53c16
by sheaf at 2026-07-02T21:35:44-04:00
Test driver: normalise line numbers into libraries
When comparing the stdout of tests that print out callstacks, we can't
rely on the stability of exact line:column spans pointing into libraries
(e.g. ghc-internal), as any change (such as adding a comment) can change
them.
This commit addresses this by normalising away line:column in callstacks,
but only when those point into internal libraries. We don't do this in
general, as the exact span might be important to the test (e.g. for a
span within the test module itself).
Fixes #27387
-
81ee62e0
by Alan Zimmerman at 2026-07-02T21:36:33-04:00
EPA: Remove LocatedLW from MatchGroup
This is the last usage of LocatedLW / SrcSpanAnnLW
-
925959db
by Recursion Ninja at 2026-07-04T04:14:12-04:00
Decoupling 'L.H.S' from 'GHC.Hs.Doc'
* Migrated 'GHC.Hs.Doc' and 'GHC.Hs.DocString' AST defintions from 'GHC.*' namespace,
to new 'Language.Haskell.Syntax.Doc' module in the 'L.H.S' "namespace."
* Updated 'HsDocString to be TTG-parameterised as 'HsDocString pass'.
* Added 'GHC.Hs.Extension.Pass': splits 'GhcPass'/'Pass' and all 'HsDocString'
TTG instances out of 'GHC.Hs.Extension', which re-exports it unchanged
(this is backwards compatible and prevents the introduction of a boot file).
* Deleted 'GHC.Hs.Doc.hs-boot'; removed all 'L.H.S.*' imports of 'GHC.Hs.Doc'.
* Updated 'GHC.Hs.DocString' to be TTG pass-parameterised throughout; moved
'mkHsDocStringChunk'/'unpackHDSC' here (require 'GHC.Utils.Encoding').
* Split 'GHC.Rename.Doc.rnHsDoc' from 'rnHsDocIdentifiersOnly'.
* Updated parser, renamer, typechecker, HIE, and exact-print for new types.
* Added 'HsDocString' TTG instances for 'DocNameI' to 'Haddock.Types'.
* Killed the last module loop between GHC.* and LHS.*.
- Only edges from LHS.* to GHC.Data.FastString now!
Resolves #26971
-
b7e24044
by mangoiv at 2026-07-04T04:14:56-04:00
ci: retry fetching test metrics
Retry fetching test metrics to make the CI not fail if the services is
temporarily unavailable
-
4180af3f
by Zubin Duggal at 2026-07-04T04:15:38-04:00
Bump semaphore-compat submodule to 2.0.1
This versions includes some cruicial fixes for darwin
-
242d4317
by sheaf at 2026-07-04T04:16:19-04:00
Remove outdated comment in GHC.Data.ShortText
There was a long comment in GHC.Data.ShortText about a workaround that
was necessary when bootstrapping with GHC 9.2 and below. The actual
logic has since been dropped, but the comment remained. This commit
removes the vestigial comment.
-
9b714c4c
by Zubin Duggal at 2026-07-05T09:40:36+05:30
CorePrep: Don't speculatively evaluate bindings that we have already discovered to be absent
In #25924, we segfault because speculation forces a projection out of a RUBBISH dictionary
(which we generated because it absent).
Solution: Don't speculate on bindings we already know are absent.
Fixes 25924
-
4a59b3ee
by Zubin Duggal at 2026-07-05T09:40:36+05:30
Don't make absent fillers for terminating types
In #25924 we discovered that we could speculatively evaluate an absent filler
for a dictionary, and project a field (a superclass selector) out of it,
resulting in segfaults.
Solution: Never make an absent filler or rubbish literal for a terminating type
like a dictionary. mkAbsentFiller returns Nothing for isTerminatingType, so
worker/wrapper and the specialiser keep the real argument instead.
Some small metric decreases because we do a little less work in the
simplifier now.
Metric Decrease:
T9872a
T9872b
T9872c
TcPlugin_RewritePerf
-
383ddcd4
by Alan Zimmerman at 2026-07-06T07:08:16-04:00
EPA: Move the 'where' annotation for PatSynBind
This allows us to move it out of the MatchGroup exact print annotation
too
-
33964279
by Recursion Ninja at 2026-07-06T10:55:38-04:00
First pass of orphan instance removal.
This is part of a technical debt removal effort made possible
now that seperating out the AST via TTG comes to a close.
As the AST in 'L.H.S' has been incrementally separated from the GHC internals,
there are many accumulated orphan instance of 'Binary', 'Outputable', 'Uniquable', etc.
The orphan instance of data-types from within 'L.H.S' are having thier orphan
instances moved to the module which defined the type-class; i.e. moving an orphan
'Binary' instance to 'GHC.Utils.Binary'.
Orphan instances resolved:
| Data-type | Type-class Instance(s) | Old Orphan Module |
| -----------------------| ------------------------- | ------------------------ |
| `FieldLabelString` | `Outputable`, `Uniquable` | `GHC.Types.FieldLabel` |
| `LexicalFixity` | `Outputable` | `GHC.Hs.Basic` |
| `FixityDirection` | `Outputable`, `Binary` | `GHC.Hs.Basic` |
| `Fixity` | `Outputable`, `Binary` | `GHC.Hs.Basic` |
| `Specificity` | `Binary` | `GHC.Hs.Specificity` |
| `ForAllTyFlag` | `Outputable`, `Binary` | `GHC.Hs.Specificity` |
| `HsDocStringDecorator` | `Outputable`, `Binary` | `GHC.Hs.DocString` |
| `HsDocStringChunk` | `Outputable`, `Binary` | `GHC.Hs.DocString` |
| `WithHsDocIdentifiers` | `Outputable` | `GHC.Hs.Doc` |
| `NamespaceSpecifier` | `Outputable` | `GHC.Hs.ImpExp` |
| `InlinePragma` | `Binary` | `GHC.Types.InlinePragma` |
| `OverlapMode` | `Binary` | `GHC.Hs.Decls.Overlap` |
-
ec826a96
by Recursion Ninja at 2026-07-06T10:55:38-04:00
Second pass of orphan instance removal.
This is part of a technical debt removal effort made possible
now that separating out the AST via TTG comes to a close.
In order to resolve more orphan instances, 'GHC.Utils.Outputable'
needs to be able to import 'GHC.Hs.Extension.GhcPass', but this
import would form a module import cycle. The following module
import cycles needed to be broken. This required re-sorting the
involved data-types into separate modules in order to facilitate
cycle-free imports.
- Cycle 1:
'GHC.Utils.Outputable'
-> 'GHC.Hs.Extension.GhcPass'
-> 'GHC.Types.SrcLoc.Types'
-> 'GHC.Utils.Outputable'
- Cycle 2:
'GHC.Utils.Outputable'
-> 'GHC.Hs.Extension.GhcPass'
-> 'GHC.Prelude'
-> 'GHC.Utils.Trace'
-> 'GHC.Utils.Outputable'
- Cycle 3:
'GHC.Utils.Outputable'
-> 'GHC.Types.SrcLoc.GhcPass'
-> 'GHC.Data.Strict'
-> 'GHC.Prelude'
-> 'GHC.Utils.Trace'
-> 'GHC.Utils.Outputable'
-
79d4bb7c
by Recursion Ninja at 2026-07-06T10:55:38-04:00
Third pass of orphan instance removal.
This is part of a technical debt removal effort made possible
now that separating out the AST via TTG comes to a close.
Now that 'GHC.Utils.Outputable' imports 'GHC.Hs.Extension.GhcPass',
more orphan instances can be resolved that were impossible before.
The orphan instance of data-types from within 'L.H.S', listed below,
have had thier orphan instances moved to the module which defines the
type-class; i.e. moving an orphan 'Binary' instance to 'GHC.Utils.Binary'.
Orphan instances resolved:
| Data-type | Type-class Instance(s) | Old Orphan Module |
| ----------------- | ----------------------------- | ------------------------ |
| HsDocString | Binary | GHC.Hs.DocString |
| WarningCategory | Binary, Outputable, Uniquable | GHC.Unit.Module.Warnings |
| InWarningCategory | Outputable | GHC.Unit.Module.Warnings |
| CCallConv | Binary, Outputable | GHC.Types.ForeignCall |
| CExportSpec | Binary, Outputable | GHC.Types.ForeignCall |
| ForeignKind | Binary | GHC.Types.ForeignCall |
| Safety | Binary, Outputable | GHC.Types.ForeignCall |
| PromotionFlag | Binary, Outputable | GHC.Types.Basic |
| Role | Binary, Outputable | GHC.Core.Coercion.Axiom |
| SrcStrictness | Binary, Outputable | GHC.Core.DataCon |
| SrcUnpackedness | Binary, Outputable | GHC.Core.DataCon |
| HsIPName | Outputable, OutputableBndr | GHC.Hs.Type |
| DocDecl name | Outputable | GHC.Hs.Decls |
-
cf175cb5
by Recursion Ninja at 2026-07-06T10:55:38-04:00
Fourth pass of orphan instance removal.
This is part of a technical debt removal effort made possible
now that separating out the AST via TTG comes to a close.
In order to resolve a few more orphan instances, 'GHC.Utils.Outputable'
needs the 'IsPass' and 'ghcPass' definitions to be in scope when
importing 'GHC.Hs.Extension.GhcPass'. These are currently defined
in 'GHC.Hs.Extension', but it is trivial to perform the migration.
The 'GHC.Hs.Specificity' module only defines the 'NFData' 'Specificity'
orphan instance. The definition was moved into the 'L.H.S' "namespace"
and the superfluous module has been removed.
Orphan instances resolved:
| Data-type | Type-class Instance(s) | Old Orphan Module |
| ----------------- | ---------------------------- | ------------------ |
| DataConCantHappen | Outputable DataConCantHappen | GHC.Hs.Extension |
| NoExtField | Outputable NoExtField | GHC.Hs.Extension |
| Specificity | NFData Specificity | GHC.Hs.Specificity |
-
488f3d4f
by Recursion Ninja at 2026-07-06T11:01:12-04:00
Fifth and final pass of orphan instance removal.
This is part of a technical debt removal effort made possible
now that separating out the AST via TTG comes to a close.
Revised all module headers containing the '{-# OPTIONS_GHC -Wno-orphans #-}'
pragma; updating the remaining orphan instance lists for accuracy and
standardizing the documentation format across modules.
Slightly more verbose in some modules,
but worth it for standardization and clarity of the remaining instances.