[Git][ghc/ghc][master] 2 commits: ci: bump freebsd boot ghc to 9.10.3
by Marge Bot (@marge-bot) 24 Apr '26
by Marge Bot (@marge-bot) 24 Apr '26
24 Apr '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
87db83e2 by Cheng Shao at 2026-04-24T14:37:21-04:00
ci: bump freebsd boot ghc to 9.10.3
This commit bumps freebsd boot ghc to 9.10.3 to align with other
platforms and prevent outdated boot libs in boot ghc to block the
freebsd job.
- - - - -
17e3a0b7 by Cheng Shao at 2026-04-24T14:37:21-04:00
compiler: improve Binary instance of Array
This patch improves the `Binary` instance of `Array`:
- We no longer allocate intermediate lists. When serializing an
`Array`, we iterate over the elements directly; when deserializing
it, we allocate the result `Array` and fill it in a loop.
- Now we only serialize the array bounds tuple; the length field is
not needed.
Closes #27109.
- - - - -
4 changed files:
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- + changelog.d/binary-array-no-list
- compiler/GHC/Utils/Binary.hs
Changes:
=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -445,7 +445,7 @@ opsysVariables _ FreeBSD14 = mconcat
-- Prefer to use the system's clang-based toolchain and not gcc
, "CC" =: "cc"
, "CXX" =: "c++"
- , "FETCH_GHC_VERSION" =: "9.10.1"
+ , "FETCH_GHC_VERSION" =: "9.10.3"
, "CABAL_INSTALL_VERSION" =: "3.14.2.0"
]
opsysVariables arch (Linux distro) = distroVariables arch distro
=====================================
.gitlab/jobs.yaml
=====================================
@@ -1721,7 +1721,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-freebsd14-validate",
@@ -4543,7 +4543,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
@@ -5643,7 +5643,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-freebsd14-validate"
=====================================
changelog.d/binary-array-no-list
=====================================
@@ -0,0 +1,13 @@
+section: compiler
+synopsis: Reduce allocations when (de)serialising `Array` in the `ghc` library.
+issues: #27109
+mrs: !15805
+
+description: {
+ The `ghc` library's `Binary` instance for `Array` was changed to
+ avoid allocating an intermediate list and to omit a redundant length
+ field during (de)serialisation.
+
+ This should only affect the `ghc` library's (de)serialisation code paths,
+ primarily when parsing HIE files and bytecode objects.
+}
=====================================
compiler/GHC/Utils/Binary.hs
=====================================
@@ -142,6 +142,8 @@ import Control.DeepSeq
import Control.Monad ( when, (<$!>), unless, forM_, void )
import Foreign hiding (bit, setBit, clearBit, shiftL, shiftR, void)
import Data.Array
+import Data.Array.Base (unsafeFreezeIOArray)
+import Data.Array.IArray (traverseArray_)
import Data.Array.IO
import Data.Array.Unsafe
import qualified Data.Binary as Binary
@@ -970,11 +972,12 @@ instance Binary a => Binary (NonEmpty a) where
instance (Ix a, Binary a, Binary b) => Binary (Array a b) where
put_ bh arr = do
put_ bh $ bounds arr
- put_ bh $ elems arr
+ traverseArray_ (put_ bh) arr
+
get bh = do
- bounds <- get bh
- xs <- get bh
- return $ listArray bounds xs
+ (l, u) <- get bh
+ marr <- newGenArray (l, u) $ \_ -> get bh
+ unsafeFreezeIOArray marr
instance Binary a => Binary (SmallArray a) where
put_ bh sa = do
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ed78760a5e1c303b0bb7bbf111dff…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ed78760a5e1c303b0bb7bbf111dff…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/sjakobi/cfg-perf-test] 44 commits: Bump directory submodule to 1.3.11.0 (unreleased)
by Simon Jakobi (@sjakobi2) 24 Apr '26
by Simon Jakobi (@sjakobi2) 24 Apr '26
24 Apr '26
Simon Jakobi pushed to branch wip/sjakobi/cfg-perf-test at Glasgow Haskell Compiler / GHC
Commits:
b135a87d by Zubin Duggal at 2026-04-09T19:36:50+05:30
Bump directory submodule to 1.3.11.0 (unreleased)
- - - - -
3a291d07 by Zubin Duggal at 2026-04-09T19:36:50+05:30
Bump file-io submodule to 0.2.0
- - - - -
e0ab606d by Zubin Duggal at 2026-04-10T18:40:20+05:30
Release notes for GHC 10.0
- - - - -
e08b9b34 by Zubin Duggal at 2026-04-10T18:40:20+05:30
Bump ghc-prim version to 0.14.0
- - - - -
a92aac6e by Zubin Duggal at 2026-04-10T18:40:20+05:30
Bump template-haskell to 2.25.0.0; update submodule exceptions for TH 2.25
- - - - -
f254d9e8 by Zubin Duggal at 2026-04-10T18:40:20+05:30
Bump GHC version to 10.0
- - - - -
6ce0368a by Zubin Duggal at 2026-04-10T18:40:28+05:30
Bump base to 4.23.0.0; update submodules for base 4.24 upper bound
- - - - -
702fb8a5 by Zubin Duggal at 2026-04-10T18:40:28+05:30
Bump GHC version to 10.1; update submodules template-haskell-lift and template-haskell-quasiquoter for ghc-internal 10.200
- - - - -
75df1ca4 by Zubin Duggal at 2026-04-10T18:40:28+05:30
Use changelog.d for release notes (#26002)
GHC now uses a fragment-based changelog workflow using a custom script adapted from https://codeberg.org/fgaz/changelog-d.
Contributors add a file in changelog.d/ for each user-facing change.
At release time, these are assembled into release notes for sphinx (in RST) format, using
the tool.
New hadrian `changelog` target to generate changelogs
CI job to validate changelog entries for MRs unless skipped with ~"no-changelog" label
Teach sphinx about ghc-mr: extlink to link to MRs
Remove `ghc-package-list` from sphinx, and implement it in changelog-d instead (Fixes #26476).
(cherry picked from commit 989c07249978f418dfde1353abfad453f024d61a)
- - - - -
585d7450 by Luite Stegeman at 2026-04-11T02:17:13-04:00
tc: discard warnings in tcUserStmt Plan C
We typecheck let_stmt twice, but we don't want the warnings twice!
see #26233
- - - - -
2df604e9 by Sylvain Henry at 2026-04-11T02:19:30-04:00
Introduce TargetInt to represent target's Int (#15973)
GHC was using host 'Int' in several places to represent values that
live in the target machine's 'Int' type. This is silently wrong when
cross-compiling from a 32-bit host to a 64-bit target: the host Int
is 32 bits while the target Int is 64 bits.
See Note [TargetInt] in GHC.Platform.
Also used the opportunity to make DynTag = Word8.
Fixes #15973
Co-Authored-By: Claude Sonnet 4.6 <noreply(a)anthropic.com>
- - - - -
d419e972 by Luite Stegeman at 2026-04-13T15:16:04-04:00
Suppress desugaring warnings in the pattern match checker
Avoid duplicating warnings from the actual desugaring pass.
fixes #25996
- - - - -
c5b80dd0 by Phil de Joux at 2026-04-13T15:16:51-04:00
Typo ~/ghc/arch-os-version/environments
- - - - -
71462fff by Luite Stegeman at 2026-04-13T15:17:38-04:00
add changelog entry for #26233
- - - - -
d1ddfd4b by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
Add test for #25636
The existing test behaviour of "T23146_liftedeq" changed because the
simplifier now does a bit more inlining. We can restore the previous bad
behavior by using an OPAQUE pragma.
This test doubles as a test for #25636 when run in ghci, so we add it as
such.
- - - - -
b9df40ee by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
refactor: protoBCOName is always a Name
Simplifies the code by removing the unnecessary type argument to
ProtoBCO which was always 'Name'
- - - - -
5c2a179e by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
Allocate static constructors for bytecode
This commit adds support for static constructors when compiling and
linking ByteCode objects.
Top-level StgRhsCon get lowered to ProtoStaticCons rather than to
ProtoBCOs. A ProtoStaticCon gets allocated directly as a data con
application on the heap (using the new primop newConApp#).
Previously, we would allocate a ProtoBCO which, when evaluated, would
PACK and return the constructor.
A few more details are given in Note [Static constructors in Bytecode].
Secondly, this commit also fixes issue #25636 which was caused by
linking *unlifted* constructors in BCO instructions as
- (1) a thunk indexing the array of BCOs in a module
- (2) which evaluated to a BCO which still had to be evaluated to
return the unlifted constructor proper.
The (2) issue has been resolved by allocating the static constructors
directly. The (1) issue can be resolved by ensuring that we allocate all
unlifted top-level constructors eagerly, and leave the knot-tying for
the lifted BCOs and top-level constructors only.
The top-level unlifted constructors are never mutually recursive, so we
can allocate them all in one go as long as we do it in topological
order. Lifted fields of unlifted constructors can still be filled by the
knot-tied lifted variables since in those fields it is fine to keep
those thunks. See Note [Tying the knot in createBCOs] for more details.
Fixes #25636
-------------------------
Metric Decrease:
LinkableUsage01
-------------------------
- - - - -
cde47053 by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
Revert "StgToByteCode: Assert that PUSH_G'd values are lifted"
This reverts commit ec26c54d818e0cd328276196930313f66b780905.
Ever since f7a22c0f4e9ae0dc767115d4c53fddbd8372b777, we now do support
and will link top-level unlifted constructors into evaluated and
properly tagged values which we can reference with PUSH_G.
This assertion is no longer true and triggered a failure in T25636
- - - - -
c7a7e5b8 by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
refactor: Tag more remote Ptrs as RemotePtr
Pure refactor which improves the API of
- GHC.ByteCode.Linker
- GHC.Runtime.Interpreter
- GHC.Runtime.Interpreter.Types.SymbolCache
by using `RemotePtr` for more functions which used to return `Ptr`s that
could potentially be in a foreign process. E.g. `lookupIE`,
`lookupStaticPtr`, etc...
- - - - -
fc59494c by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
Add float# and subword tests for #25636
These tests cover that static constructors in bytecode work correctly
for Float# and subword values (Word8#, Word16#)
- - - - -
477f521b by Rodrigo Mesquita at 2026-04-14T18:41:12-04:00
test: Validate topoSort logic in createBCOs
This test validates that the topological sorting and ordering of the
unlifted constructors and lifted constructors in `createBCOs` is
correct.
See `Note [Tying the knot in createBCOs]` for why tying the knot for the
created BCOs is slightly difficult and why the topological sorting is
necessary.
This test fails when `let topoSortedObjs = topSortObjs objs` is
substituted by `let topoSortedObjs = zip [0..] objs`, thus witnessing
the toposort logic is correct and necessary.
The test calls the ghci `createBCOs` directly because it is currently
impossible to construct in Source Haskell a situation where a top-level
static unlifted constructor depends on another (we don't have top-level
unlifted constructors except for nullary constructors like `Leaf ::
(UTree :: UnliftedType)`).
This is another test for fix for #25636
- - - - -
2d9c30be by Simon Jakobi at 2026-04-14T18:42:00-04:00
Improve tests for `elem`
...in order to simplify the work on #27096.
* Improve T17752 by including the Core output in golden files, checking
both -O1 and -O2.
* Add tests for fusion and no-fusion cases.
Fixes #27101.
- - - - -
2dadf3b0 by sheaf at 2026-04-16T13:28:39-04:00
Simplify mkTick
This commit simplifies 'GHC.Core.Utils.mkTick', removing the
accumulating parameter 'rest' which was suspiciously treating a bunch of
different ticks as a group, and moving the group as a whole around the
AST, ignoring that the ticks in the group might have different placement
properties.
The most important change is that we revert the logic (added in 85b0aae2)
that allowed ticks to be placed around coercions, which caused serious
issues (e.g. #27121). It was just a mistake, as it doesn't make sense
to put a tick around a coercion.
Also adds Note [Pushing SCCs inwards] which clarifies the logic for
pushing SCCs into lambdas, constructor applications, and dropping SCCs
around non-function variables (in particular the treatment of splittable
ticks).
A few other changes are also implemented:
- simplify 'can_split' predicate (no functional change)
- combine profiling ticks into one when possible
Fixes #26878, #26941 and #27121
Co-authored-by: simonpj <simon.peytonjones(a)gmail.com>
- - - - -
a0d6f1f4 by Simon Jakobi at 2026-04-16T13:29:28-04:00
Add regression test for #9074
Closes #9074.
- - - - -
d178ee89 by Sylvain Henry at 2026-04-16T13:30:25-04:00
Add changelog for #15973
- - - - -
e8a196c6 by sheaf at 2026-04-16T13:31:19-04:00
Deal with 'noSpec' in 'coreExprToPmLit'
This commit makes two separate changes relating to
'GHC.HsToCore.Pmc.Solver.Types.coreExprAsPmLit':
1. Commit 7124e4ad mistakenly marked deferred errors as non-canonical,
which led to the introduction of 'nospec' wrappers in the
generated Core. This reverts that accident by declaring deferred
errors as being canonical, avoiding spurious 'nospec' wrapping.
2. Look through magic identity-like Ids such as 'nospec', 'inline' and
'lazy' in 'coreExprAsPmLit', just like Core Prep does.
There might genuinely be incoherent evidence, but that shouldn't
obstruct the pattern match checker. See test T27124a.
Fixes #25926 #27124
-------------------------
Metric Decrease:
T3294
-------------------------
- - - - -
8cb99552 by Sylvain Henry at 2026-04-16T19:22:43-04:00
hadrian: warn when package index is missing (#16484)
Since cabal-install 3.0 we can query the path of remote-repo-cache and
check if hackage package index is present.
Fixes #16484
- - - - -
d6ce7477 by Richard Eisenberg at 2026-04-16T19:23:25-04:00
Teach hadrian to --skip-test.
Fixes #27188.
This adds the --skip-test flag to `hadrian build`, as documented in the
patch.
- - - - -
7666f4a9 by Fendor at 2026-04-17T22:29:51-04:00
Migrate `ghc-pkg` to use `OsPath` and `file-io`
`ghc-pkg` should use UNC paths as much as possible to avoid MAX_PATH
issues on windows.
`file-io` uses UNC Paths by default on windows, ensuring we use the
correct APIs and that we finally are no longer plagued by MAX_PATH
issues in CI and private machines.
On top of it, the higher correctness of `OsPath` is appreciated in this
small codebase. Also, we improve memory usage very slightly, due to the
more efficient memory representation of `OsPath` over `FilePath`
Adds `ghc-pkg` regression test for MAX_PATH on windows
Make sure `ghc-pkg` behaves as expected when long paths (> 255) are
involved on windows.
Let's generate a testcase where we can actually observe that `ghc-pkg`
behaves as epxected.
See the documentation for windows on Maximum Path Length Limitation:
* `https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation`
Adds changelog entry for long path support in ghc-pkg.
- - - - -
78434e8c by Simon Peyton Jones at 2026-04-17T22:30:38-04:00
Kill off the substitution in Lint
Now that we have invariant (NoTypeShadowing) we no longer
need Lint to carry an ambient substitution. This makes it
simpler and faster. A really worthwhile refactor.
There are some knock-on effects
* Linting join points after worker/wrapper. See
Note [Join points and beta redexes]
* Running a type substitution after the desugarer.
See Note [Substituting type-lets] in
the new module GHC.Core.SubstTypeLets
Implements #27078
Most perf tests don't use Lint so we won't see a perf incresae.
But T1969, which uses -O0 and Lint, gets 1.3% worse because it has
to run the SubstTypeLets pass which is a somewhat expensive no-op
Overall though compile-time allocations are down 0.1%.
Metric Increase:
T1969
- - - - -
86ca6c2c by mangoiv at 2026-04-17T22:31:22-04:00
testsuite: inline elemCoreTest
Some weird (probably python scoping) rule caused elemCoreTest, a regex
being out of scope on ubuntu, presumably because of a newer python version.
This patch just inlines the regex, which fixes the issue.
Fixes #27193
- - - - -
72d6dc74 by aparker at 2026-04-20T20:15:44-04:00
NCG: Implement constant folding for vector simd ops (Issue #25030)
- - - - -
b9cab907 by sheaf at 2026-04-20T20:15:44-04:00
Mark some SIMD tests as broken on i386 optllvm
As seen in #25498, several SIMD tests are broken on i386 in the optllvm
way. This commit marks them as "expect_broken".
- - - - -
76528cc3 by Wolfgang Jeltsch at 2026-04-20T20:16:25-04:00
Move most of the `System.IO` implementation into `base`
This involves a rewrite of the `combine` helper function to avoid the
use of `last`, which would now be flagged as an error.
Metric Decrease:
LinkableUsage01
T3294
Metric Increase:
T12227
T12707
T5642
- - - - -
04d143c0 by Luite Stegeman at 2026-04-21T14:05:33-04:00
rts: add a few missing i386 relocations in the rts linker
- - - - -
014087e7 by Luite Stegeman at 2026-04-21T14:05:34-04:00
CodeOutput: Fix finalizers on multiple platforms
- ELF platforms: emit .fini_array section
- wasm32/Darwin: emit initializer with __cxa_atexit call
- Windows: use -Wl,--whole-archive to prevent dropping finalizer symbols
- rts linker: fix crash/assertion failure unloading objects with finalizers
fixes #27072
- - - - -
915bba6f by Simon Jakobi at 2026-04-21T14:06:16-04:00
Add regression test for #10531
Closes #10531.
- - - - -
86a646a6 by Andreas Klebinger at 2026-04-22T13:00:05-04:00
Revert use of generic instances for compiler time perf reasons.
Revert "Derive Semigroup/Monoid for instances believed could be derived in #25871"
This reverts commit 11a04cbb221cc404fe00d65d7c951558ede4caa9.
Revert "add Ghc.Data.Pair deriving"
This reverts commit 15d9ce449e1be8c01b89fd39bdf1e700ea7d1dce.
- - - - -
bc9ee1cf by Wen Kokke at 2026-04-22T13:00:51-04:00
hadrian: Fix docs to remove static flavour
In 638f6548, the static flavour was turned into into the fully_static
flavour transformer. However, this commit did not update flavours.md.
- - - - -
cc9cc6d5 by Cheng Shao at 2026-04-23T09:40:46+00:00
configure: bump LlvmMaxVersion to 23
This patch bumps `LlvmMaxVersion` to 23 to support LLVM 22.x releases.
- - - - -
2ea7ef8e by Cheng Shao at 2026-04-23T09:46:26+00:00
changelog: add llvm 22.x support
- - - - -
5574ee10 by Cheng Shao at 2026-04-24T08:24:30-04:00
compiler: avoid unused temporary `appendFS` operands
This patch fixes unused temporary `appendFS` operands in the codebase
that are retained in the `FastString` table after concatenation.
Rewrite rules are added so that if an operand is
`fsLit`/`mkFastString`, the `appendFS` application is rewritten to
append the `ShortByteString` operands first. The patch also fixes
`sconcat` behavior to align with `mconcat` for the same reason. Fixes #27205.
- - - - -
4ed78760 by mangoiv at 2026-04-24T08:25:13-04:00
contributing: adjust MR template to be less verbose
- MR template only shows text that is relevant for submissiong
- MR template was rewritten so it's readable from a user's and reviewer's
perspective
Resolves #27165
Co-Authored-By: @sheaf
- - - - -
cd427e38 by Simon Jakobi at 2026-04-24T19:06:13+02:00
testsuite: add CmmControlFlowPerf test for code generator
Add a performance test that stresses the code generator's control flow
handling and block layout optimization. The test generates Cmm code with
thousands of basic blocks in a single procedure, testing:
- CFG construction and dominator analysis
- Block layout optimization
- Natural loop detection and backedge handling
The generator creates split/left/right/join diamond patterns with
periodic backedges forming natural loops. Works with all NCG backends
(X86, AArch64, WASM, etc.).
The test is intended to serve as a benchmark for performance work on
the code generator, such as tickets #20726 or #27102.
Assisted-by: GLM-5 via Fireworks <noreply(a)fireworks.ai>
Assisted-by: Codex <codex(a)openai.com>
- - - - -
287 changed files:
- .gitlab-ci.yml
- .gitlab/issue_templates/release_tracking.md
- .gitlab/merge_request_templates/Default.md
- + changelog.d/T15973
- + changelog.d/T25636
- + changelog.d/T27121.md
- + changelog.d/T27124.md
- + changelog.d/changelog-entries
- + changelog.d/config
- + changelog.d/fix-duplicate-pmc-warnings
- + changelog.d/fix-finalizers-27072
- + changelog.d/fix-ghci-duplicate-warnings-26233
- + changelog.d/ghc-pkg-long-path-support
- + changelog.d/hadrian-warn-missing-package-index-16484
- + changelog.d/llvm-22
- + changelog.d/simd_constant_folding
- + changelog.d/skip-test
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Binary.hs
- compiler/GHC/ByteCode/InfoTable.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Liveness.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Lint.hs
- + compiler/GHC/Core/Lint/SubstTypeLets.hs
- compiler/GHC/Core/Opt/FloatOut.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/FastString.hs
- compiler/GHC/Data/Pair.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/Linker/Executable.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Platform.hs
- compiler/GHC/Platform/Tag.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Interpreter/Types/SymbolCache.hs
- compiler/GHC/Stg/Debug.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/DataCon.hs
- compiler/GHC/StgToCmm/Env.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Heap.hs
- compiler/GHC/StgToCmm/InfoTableProv.hs
- compiler/GHC/StgToCmm/Layout.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToCmm/Prof.hs
- compiler/GHC/StgToCmm/Ticky.hs
- compiler/GHC/StgToCmm/Utils.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Types/ForeignStubs.hs
- compiler/GHC/Types/Tickish.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Misc.hs
- compiler/GHC/Utils/Ppr/Colour.hs
- compiler/ghc.cabal.in
- configure.ac
- − docs/users_guide/10.0.1-notes.rst
- + docs/users_guide/10.2.1-notes.rst
- − docs/users_guide/9.16.1-notes.rst
- docs/users_guide/conf.py
- docs/users_guide/ghc_config.py.in
- − docs/users_guide/ghc_packages.py
- docs/users_guide/packages.rst
- docs/users_guide/release-notes.rst
- ghc/ghc-bin.cabal.in
- hadrian/build-cabal
- hadrian/build-cabal.bat
- hadrian/doc/flavours.md
- hadrian/doc/make.md
- hadrian/doc/testsuite.md
- hadrian/hadrian.cabal
- hadrian/src/CommandLine.hs
- hadrian/src/Main.hs
- hadrian/src/Packages.hs
- + hadrian/src/Rules/Changelog.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Builders/RunTest.hs
- hadrian/src/Settings/Default.hs
- libraries/array
- libraries/base/base.cabal.in
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/GHC/IO/Handle.hs
- libraries/base/src/Prelude.hs
- libraries/base/src/System/IO.hs
- libraries/base/src/Text/Printf.hs
- + libraries/base/tests/perf/ElemFusionUnknownList.hs
- + libraries/base/tests/perf/ElemFusionUnknownList_O1.stderr
- + libraries/base/tests/perf/ElemFusionUnknownList_O2.stderr
- + libraries/base/tests/perf/ElemNoFusion.hs
- + libraries/base/tests/perf/ElemNoFusion_O1.stderr
- + libraries/base/tests/perf/ElemNoFusion_O2.stderr
- − libraries/base/tests/perf/Makefile
- libraries/base/tests/perf/T17752.hs
- − libraries/base/tests/perf/T17752.stdout
- + libraries/base/tests/perf/T17752_O1.stderr
- + libraries/base/tests/perf/T17752_O2.stderr
- libraries/base/tests/perf/all.T
- libraries/deepseq
- libraries/directory
- libraries/exceptions
- libraries/file-io
- libraries/filepath
- libraries/ghc-boot-th/ghc-boot-th.cabal.in
- libraries/ghc-boot/GHC/Unit/Database.hs
- libraries/ghc-boot/ghc-boot.cabal.in
- libraries/ghc-compact/ghc-compact.cabal
- libraries/ghc-experimental/ghc-experimental.cabal.in
- libraries/ghc-heap/tests/tso_and_stack_closures.hs
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- libraries/ghc-prim/changelog.md
- libraries/ghc-prim/ghc-prim.cabal
- libraries/ghci/GHCi/CreateBCO.hs
- libraries/ghci/GHCi/ResolvedBCO.hs
- libraries/ghci/ghci.cabal.in
- libraries/haskeline
- libraries/hpc
- libraries/os-string
- libraries/parsec
- libraries/process
- libraries/semaphore-compat
- libraries/stm
- libraries/template-haskell-lift
- libraries/template-haskell-quasiquoter
- libraries/template-haskell/template-haskell.cabal.in
- libraries/terminfo
- libraries/unix
- m4/fp_setup_project_version.m4
- m4/fptools_ghc_version.m4
- rts/Interpreter.c
- rts/Linker.c
- rts/LinkerInternals.h
- rts/PrimOps.cmm
- rts/RtsSymbols.c
- rts/include/Rts.h
- rts/include/rts/storage/ClosureMacros.h
- rts/include/stg/MiscClosures.h
- rts/linker/Elf.c
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/boilerplate.mk
- testsuite/tests/cabal/Makefile
- testsuite/tests/cabal/all.T
- + testsuite/tests/cabal/ghcpkg10.stdout
- testsuite/tests/codeGen/should_run/T23146/T23146_liftedeq.hs
- + testsuite/tests/codeGen/should_run/T23146/T25636.script
- + testsuite/tests/codeGen/should_run/T23146/T25636.stdout
- testsuite/tests/codeGen/should_run/T23146/all.T
- + testsuite/tests/codeGen/should_run/T25636a/T25636a.script
- + testsuite/tests/codeGen/should_run/T25636a/T25636a.stdout
- + testsuite/tests/codeGen/should_run/T25636a/all.T
- + testsuite/tests/codeGen/should_run/T25636b/T25636b.script
- + testsuite/tests/codeGen/should_run/T25636b/T25636b.stdout
- + testsuite/tests/codeGen/should_run/T25636b/all.T
- + testsuite/tests/codeGen/should_run/T25636c/T25636c.script
- + testsuite/tests/codeGen/should_run/T25636c/T25636c.stdout
- + testsuite/tests/codeGen/should_run/T25636c/all.T
- + testsuite/tests/codeGen/should_run/T25636d/T25636d.script
- + testsuite/tests/codeGen/should_run/T25636d/T25636d.stdout
- + testsuite/tests/codeGen/should_run/T25636d/all.T
- + testsuite/tests/codeGen/should_run/T25636e/T25636e.script
- + testsuite/tests/codeGen/should_run/T25636e/T25636e.stdout
- + testsuite/tests/codeGen/should_run/T25636e/all.T
- + testsuite/tests/codeGen/should_run/T27072d.hs
- + testsuite/tests/codeGen/should_run/T27072d.stdout
- + testsuite/tests/codeGen/should_run/T27072d_c.c
- + testsuite/tests/codeGen/should_run/T27072d_check.c
- + testsuite/tests/codeGen/should_run/T27072w.hs
- + testsuite/tests/codeGen/should_run/T27072w.stdout
- + testsuite/tests/codeGen/should_run/T27072w_c.c
- testsuite/tests/codeGen/should_run/all.T
- testsuite/tests/corelint/LintEtaExpand.stderr
- testsuite/tests/corelint/T21115b.stderr
- + testsuite/tests/deSugar/should_compile/T25996.hs
- + testsuite/tests/deSugar/should_compile/T25996.stderr
- testsuite/tests/deSugar/should_compile/all.T
- + testsuite/tests/driver/T10531/A.hs
- + testsuite/tests/driver/T10531/B.hs
- + testsuite/tests/driver/T10531/C.hs
- + testsuite/tests/driver/T10531/Makefile
- + testsuite/tests/driver/T10531/all.T
- testsuite/tests/ghci.debugger/scripts/print034.stdout
- + testsuite/tests/ghci/T9074/Makefile
- + testsuite/tests/ghci/T9074/T9074.hs
- + testsuite/tests/ghci/T9074/T9074.stdout
- + testsuite/tests/ghci/T9074/T9074a.c
- + testsuite/tests/ghci/T9074/T9074b.c
- + testsuite/tests/ghci/T9074/all.T
- + testsuite/tests/ghci/scripts/T26233.script
- + testsuite/tests/ghci/scripts/T26233.stderr
- + testsuite/tests/ghci/scripts/T26233.stdout
- testsuite/tests/ghci/scripts/all.T
- + testsuite/tests/ghci/should_run/T25636f.hs
- + testsuite/tests/ghci/should_run/T25636f.stdout
- testsuite/tests/ghci/should_run/all.T
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/linters/Makefile
- testsuite/tests/linters/all.T
- + testsuite/tests/linters/changelog-d.stdout
- + testsuite/tests/overloadedstrings/should_fail/T25926.hs
- + testsuite/tests/overloadedstrings/should_fail/T25926.stderr
- + testsuite/tests/overloadedstrings/should_fail/T27124.hs
- + testsuite/tests/overloadedstrings/should_fail/T27124.stderr
- + testsuite/tests/overloadedstrings/should_fail/all.T
- + testsuite/tests/overloadedstrings/should_run/T27124a.hs
- testsuite/tests/overloadedstrings/should_run/all.T
- testsuite/tests/perf/compiler/all.T
- + testsuite/tests/perf/compiler/genCmmControlFlowPerf
- + testsuite/tests/profiling/should_compile/T27121.hs
- + testsuite/tests/profiling/should_compile/T27121_aux.hs
- testsuite/tests/profiling/should_compile/all.T
- + testsuite/tests/rts/linker/T27072/Lib.c
- + testsuite/tests/rts/linker/T27072/Makefile
- + testsuite/tests/rts/linker/T27072/T27072.stdout
- + testsuite/tests/rts/linker/T27072/all.T
- + testsuite/tests/rts/linker/T27072/main.c
- + testsuite/tests/simd/should_run/Makefile
- + testsuite/tests/simd/should_run/T25030.hs
- + testsuite/tests/simd/should_run/T25030.stdout
- testsuite/tests/simd/should_run/all.T
- + testsuite/tests/simplCore/should_compile/T26941.hs
- + testsuite/tests/simplCore/should_compile/T26941_aux.hs
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/th/all.T
- testsuite/tests/typecheck/should_compile/T9497a.stderr
- testsuite/tests/typecheck/should_compile/holes.stderr
- testsuite/tests/typecheck/should_compile/holes3.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- testsuite/tests/typecheck/should_fail/T9497d.stderr
- testsuite/tests/typecheck/should_run/T9497a-run.stderr
- testsuite/tests/typecheck/should_run/T9497b-run.stderr
- testsuite/tests/typecheck/should_run/T9497c-run.stderr
- + utils/changelog-d/ChangelogD.hs
- + utils/changelog-d/LICENSE
- + utils/changelog-d/README.md
- + utils/changelog-d/changelog-d.cabal
- utils/deriveConstants/Main.hs
- utils/ghc-pkg/Main.hs
- utils/ghc-pkg/ghc-pkg.cabal.in
- utils/haddock/haddock-api/haddock-api.cabal
- utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs
- utils/haddock/haddock-library/haddock-library.cabal
- utils/haddock/haddock-test/haddock-test.cabal
- utils/haddock/haddock.cabal
- utils/haddock/html-test/ref/Bug1004.html
- utils/haddock/html-test/ref/Bug973.html
- utils/haddock/html-test/ref/ConstructorPatternExport.html
- utils/haddock/html-test/ref/DefaultSignatures.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/PatternSyns.html
- utils/haddock/html-test/ref/PatternSyns2.html
- utils/haddock/html-test/ref/QuasiExpr.html
- utils/haddock/html-test/ref/Test.html
- utils/hsc2hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3feaed2dd3fd09bd823f38713ee97e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3feaed2dd3fd09bd823f38713ee97e…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T27210] Fix assertion check in checkResultTy
by Simon Peyton Jones (@simonpj) 24 Apr '26
by Simon Peyton Jones (@simonpj) 24 Apr '26
24 Apr '26
Simon Peyton Jones pushed to branch wip/T27210 at Glasgow Haskell Compiler / GHC
Commits:
ee946dfa by Simon Peyton Jones at 2026-04-24T15:25:15+01:00
Fix assertion check in checkResultTy
As #27210 shows, the assertion was a little bit too eager.
I refactored a bit by moving some code from GHC.Tc.Gen.App
to GHC.Tc.Utils.Unify; see the new function tcSubTypeApp,
which replaces tcSubTypeDS
- - - - -
6 changed files:
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Utils/Unify.hs
- + testsuite/tests/typecheck/should_fail/T27210.hs
- + testsuite/tests/typecheck/should_fail/T27210.stderr
- testsuite/tests/typecheck/should_fail/all.T
Changes:
=====================================
compiler/GHC/Tc/Gen/App.hs
=====================================
@@ -458,45 +458,9 @@ checkResultTy :: HsExpr GhcRn
-- expose foralls, but maybe not /deeply/ instantiated
-> ExpRhoType -- Expected type; this is deeply skolemised
-> TcM HsWrapper
-checkResultTy rn_expr (tc_fun,_) _ app_res_rho (Infer inf_res)
- = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
- -- Why the "DataConHead" bit? See (IIR5) in
- -- Note [Instantiation of InferResult] in GHC.Tc.Utils.Unify.
- ; fillInferResult ds_flag (exprCtOrigin rn_expr) app_res_rho inf_res }
-
-checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho (Check res_ty)
--- Unify with expected type from the context
--- See Note [Unify with expected type before typechecking arguments]
---
--- Match up app_res_rho: the result type of rn_expr
--- with res_ty: the expected result type
+checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho res_ty
= perhaps_add_res_ty_ctxt $
- do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
- ; traceTc "checkResultTy {" $
- vcat [ text "tc_fun:" <+> ppr tc_fun
- , text "app_res_rho:" <+> ppr app_res_rho
- , text "res_ty:" <+> ppr res_ty
- , text "ds_flag:" <+> ppr ds_flag ]
- ; case ds_flag of
- Shallow -> -- No deep subsumption
- -- app_res_rho and res_ty are both rho-types,
- -- so with simple subsumption we can just unify them
- -- No need to zonk; the unifier does that
- do { co <- unifyExprType rn_expr app_res_rho res_ty
- ; traceTc "checkResultTy 1 }" (ppr co)
- ; return (mkWpCastN co) }
-
- Deep ds_reason -> -- Deep subsumption
- -- Even though both app_res_rho and res_ty are rho-types,
- -- they may have nested polymorphism, so if deep subsumption
- -- is on we must call tcSubType.
- do { wrap <- tcSubTypeDS tc_fun ds_reason rn_expr app_res_rho res_ty
- ; traceTc "checkResultTy 2 }" $
- vcat [ text "app_res_rho:" <+> ppr app_res_rho
- , text "res_ty:" <+> ppr res_ty
- , text "wrap:" <+> ppr wrap
- ]
- ; return wrap } }
+ tcSubTypeApp rn_expr tc_fun app_res_rho res_ty
where
-- perhaps_add_res_ty_ctxt: Inside an expansion, the addFunResCtxt stuff is
-- more confusing than helpful because the function at the head isn't in
@@ -506,7 +470,7 @@ checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho (Check res_ty)
| isGeneratedSrcSpan fun_loc
= thing_inside
| otherwise
- = addFunResCtxt tc_fun inst_args app_res_rho (mkCheckExpType res_ty) $
+ = addFunResCtxt tc_fun inst_args app_res_rho res_ty $
thing_inside
----------------
=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -791,10 +791,9 @@ nonBidirectionalErr = TcRnPatSynNotBidirectional
{- Note [Typechecking data constructors]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-As per Note [Polymorphisation of linear fields] in
-GHC.Core.Multiplicity, when we use a data constructor as a term, we want to
-consider its field to have polymorphic multiplicities. That is,
-Note [Data constructors are linear by default] says:
+As per Note [Polymorphisation of linear fields] in GHC.Core.Multiplicity, when
+we use a data constructor as a term, we want to consider its field to have
+polymorphic multiplicities. Note [Data constructors are linear by default] says:
Just :: a. a %1 -> Maybe a
=====================================
compiler/GHC/Tc/Utils/Unify.hs
=====================================
@@ -11,7 +11,7 @@
module GHC.Tc.Utils.Unify (
-- Full-blown subsumption
tcWrapResult, tcWrapResultO, tcWrapResultMono,
- tcSubType, tcSubTypeSigma, tcSubTypePat, tcSubTypeDS, tcSubTypeHoleFit,
+ tcSubType, tcSubTypeSigma, tcSubTypePat, tcSubTypeApp, tcSubTypeHoleFit,
addSubTypeCtxt,
tcSubTypeAmbiguity, tcSubMult,
checkConstraints, checkTvConstraints,
@@ -1488,24 +1488,62 @@ tcSubTypePat _ _ (Infer inf_res) ty_expected
---------------
--- | A subtype check that performs deep subsumption.
--- See also 'tcSubTypeMono', for when no instantiation is required.
-tcSubTypeDS :: HsExpr GhcTc -- ^ App head (for error messages only)
- -> DeepSubsumptionDepth
- -> HsExpr GhcRn
- -> TcRhoType -- ^ Actual type; a rho-type, not a sigma-type
- -> TcRhoType -- ^ Expected type
- -- DeepSubsumption <=> when checking, this type
- -- is deeply skolemised
- -> TcM HsWrapper
--- Only one call site, in GHC.Tc.Gen.App.checkResultTy
-tcSubTypeDS tc_fun ds_depth rn_expr act_rho exp_rho
- = do { wrap <- tc_sub_type_deep (Just tc_fun, Top) ds_depth
- (unifyExprType rn_expr)
- (exprCtOrigin rn_expr)
- GenSigCtxt act_rho exp_rho
+-- | Connect up the inferred type of an application with the expected type.
+-- This is usually just a unification, but with deep subsumption there is more to do.
+tcSubTypeApp :: HsExpr GhcRn
+ -> HsExpr GhcTc -- Head
+ -> TcRhoType -- Inferred type of the application; zonked to
+ -- expose foralls, but maybe not /deeply/ instantiated
+ -> ExpRhoType -- Expected type; this is deeply skolemised
+ -> TcM HsWrapper
+tcSubTypeApp rn_expr tc_fun app_res_rho (Infer inf_res)
+ = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
+ -- Why the "DataConHead" bit? See (IIR5) in
+ -- Note [Instantiation of InferResult] in GHC.Tc.Utils.Unify.
+ ; fillInferResult ds_flag (exprCtOrigin rn_expr) app_res_rho inf_res }
+
+tcSubTypeApp rn_expr tc_fun app_res_rho (Check exp_rho)
+ = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
+ ; traceTc "tcSubTypeApp {" $
+ vcat [ text "tc_fun:" <+> ppr tc_fun
+ , text "app_res_rho:" <+> ppr app_res_rho
+ , text "exp_rho:" <+> ppr exp_rho
+ , text "ds_flag:" <+> ppr ds_flag ]
+ ; wrap <- case ds_flag of
+ Shallow -- No deep subsumption
+ -- app_res_rho and res_ty are both rho-types,
+ -- so with simple subsumption we can just unify them
+ -- No need to zonk; the unifier does that
+ -> do { co <- unifyExprType rn_expr app_res_rho exp_rho
+ ; return (mkWpCastN co) }
+
+ Deep ds_depth -- Deep subsumption is ON
+ -- Even though both app_res_rho and res_ty are rho-types,
+ -- they may have nested polymorphism, so if deep subsumption
+ -- is on we must call tcSubType.
+ -> tc_sub_type_deep (Just tc_fun, Top) ds_depth
+ (unifyExprType rn_expr)
+ (exprCtOrigin rn_expr)
+ GenSigCtxt app_res_rho exp_rho
+
+ ; traceTc "tcSubTypeApp }" $
+ vcat [ text "tc_fun:" <+> ppr tc_fun
+ , text "wrap:" <+> ppr wrap ]
+
; return (mkWpSubType wrap) }
+-- | Variant of 'getDeepSubsumptionFlag' which enables a top-level subsumption
+-- in order to implement the plan of Note [Typechecking data constructors].
+getDeepSubsumptionFlag_DataConHead :: HsExpr GhcTc -> TcM DeepSubsumptionFlag
+getDeepSubsumptionFlag_DataConHead app_head
+ = do { user_ds <- xoptM LangExt.DeepSubsumption
+ ; return $ if | user_ds
+ -> Deep DeepSub
+ | XExpr (ConLikeTc (RealDataCon {})) <- app_head
+ -> Deep TopSub
+ | otherwise
+ -> Shallow }
+
---------------
-- | Checks that the 'actual' type is more polymorphic than the 'expected' type.
@@ -2104,18 +2142,6 @@ getDeepSubsumptionFlag =
else return Shallow
}
--- | Variant of 'getDeepSubsumptionFlag' which enables a top-level subsumption
--- in order to implement the plan of Note [Typechecking data constructors].
-getDeepSubsumptionFlag_DataConHead :: HsExpr GhcTc -> TcM DeepSubsumptionFlag
-getDeepSubsumptionFlag_DataConHead app_head
- = do { user_ds <- xoptM LangExt.DeepSubsumption
- ; return $ if | user_ds
- -> Deep DeepSub
- | XExpr (ConLikeTc (RealDataCon {})) <- app_head
- -> Deep TopSub
- | otherwise
- -> Shallow }
-
-- | 'tc_sub_type_deep' is where the actual work happens for deep subsumption.
--
@@ -2132,11 +2158,7 @@ tc_sub_type_deep :: HasDebugCallStack
-> TcRhoType -- ^ Expected; deeply skolemised
-> TcM HsWrapper
tc_sub_type_deep fun_pos@(tc_fun, pos) ds_depth unify inst_orig ctxt ty_actual ty_expected
- = assertPpr (isDeeplySkolemised ty_expected)
- (vcat [ text "tc_sub_type_deep: expected type is not a deep rho type"
- , text "ty_expected:" <+> ppr ty_expected
- , text "ty_actual:" <+> ppr ty_actual
- ]) $
+ = assert_precondition $
do { traceTc "tc_sub_type_deep" $
vcat [ text "ty_actual =" <+> ppr ty_actual
, text "ty_expected =" <+> ppr ty_expected ]
@@ -2250,6 +2272,27 @@ tc_sub_type_deep fun_pos@(tc_fun, pos) ds_depth unify inst_orig ctxt ty_actual t
where
given_orig = GivenOrigin (SigSkol GenSigCtxt exp_arg [])
+ -- Assertion check.
+ -- If DeepSubsumption is on (ds_depth = Deep DeepSub) then `exp_rho`
+ -- should already be deeply skolemised; the assertion checks this
+ -- But if DeepSubsumption is NOT on, but there is a data constructor at the
+ -- head, we must still call `tc_sub_type_deep` (for the multiplicity arrows)
+ -- Hence ds_flag = Deep TopSub, but `exp_rho` will only be /top-level/ skolemised
+ -- So we can only check for top-level skolemisation (`isRhoTy`)
+ -- Example of the latter (see #27210), with -XNoDeepSubsumption
+ -- foo :: forall a. a -> forall b. b -> (a,b)
+ -- foo = (,)
+ -- We will only shallowly-skolemise the expected type
+ assert_precondition = assertPpr ty_expected_is_ok $
+ vcat [ text "tc_sub_type_deep: expected type is not a deep rho type"
+ , text "ty_expected:" <+> ppr ty_expected
+ , text "ty_actual:" <+> ppr ty_actual ]
+ ty_expected_is_ok
+ = case ds_depth of
+ TopSub -> isRhoTy ty_expected
+ DeepSub -> isDeeplySkolemised ty_expected
+
+
-- | Whether to do deep subsumption when recurring inside arguments.
recurInArgumentDSFlag :: DeepSubsumptionDepth -> DeepSubsumptionFlag
recurInArgumentDSFlag = \case
@@ -5145,5 +5188,3 @@ lookupCycleBreakerVar cbv (IS { inert_cycle_breakers = cbvs_stack })
= tyfam_app
| otherwise
= pprPanic "lookupCycleBreakerVar found an unbound cycle breaker" (ppr cbv $$ ppr cbvs_stack)
-
---------------------------------------------------------------------------------
=====================================
testsuite/tests/typecheck/should_fail/T27210.hs
=====================================
@@ -0,0 +1,11 @@
+{-# LANGUAGE RankNTypes, ExistentialQuantification #-}
+
+-- NB: No deep subsumption
+
+module T27210 where
+
+data Parser a
+ = forall x. BindP (Parser x) (x -> Parser a)
+
+oneM :: Parser a -> ( forall x. (a -> Parser x) -> Parser x )
+oneM = BindP
=====================================
testsuite/tests/typecheck/should_fail/T27210.stderr
=====================================
@@ -0,0 +1,9 @@
+T27210.hs:11:8: error: [GHC-83865]
+ • Couldn't match expected type: forall x.
+ (a -> Parser x) -> Parser x
+ with actual type: (a -> Parser a0) -> Parser a0
+ • In the expression: BindP
+ In an equation for ‘oneM’: oneM = BindP
+ • Relevant bindings include
+ oneM :: Parser a -> forall x. (a -> Parser x) -> Parser x
+ (bound at T27210.hs:11:1)
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -758,3 +758,4 @@ test('T23162d', normal, compile, [''])
test('T26823', normal, compile_fail, [''])
test('T26861', normal, compile_fail, [''])
test('T26862', normal, compile_fail, [''])
+test('T27210', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ee946dfa797ccbeffa5f29b65177372…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ee946dfa797ccbeffa5f29b65177372…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T27210] Fix assertion check in checkResultTy
by Simon Peyton Jones (@simonpj) 24 Apr '26
by Simon Peyton Jones (@simonpj) 24 Apr '26
24 Apr '26
Simon Peyton Jones pushed to branch wip/T27210 at Glasgow Haskell Compiler / GHC
Commits:
6c89ffeb by Simon Peyton Jones at 2026-04-24T15:22:47+01:00
Fix assertion check in checkResultTy
As #27201 shows, the assertion was a little bit too eager.
I refactored a bit by moving some code from GHC.Tc.Gen.App
to GHC.Tc.Utils.Unify; see the new function tcSubTypeApp,
which replaces tcSubTypeDS
- - - - -
6 changed files:
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Utils/Unify.hs
- + testsuite/tests/typecheck/should_fail/T27210.hs
- + testsuite/tests/typecheck/should_fail/T27210.stderr
- testsuite/tests/typecheck/should_fail/all.T
Changes:
=====================================
compiler/GHC/Tc/Gen/App.hs
=====================================
@@ -458,45 +458,9 @@ checkResultTy :: HsExpr GhcRn
-- expose foralls, but maybe not /deeply/ instantiated
-> ExpRhoType -- Expected type; this is deeply skolemised
-> TcM HsWrapper
-checkResultTy rn_expr (tc_fun,_) _ app_res_rho (Infer inf_res)
- = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
- -- Why the "DataConHead" bit? See (IIR5) in
- -- Note [Instantiation of InferResult] in GHC.Tc.Utils.Unify.
- ; fillInferResult ds_flag (exprCtOrigin rn_expr) app_res_rho inf_res }
-
-checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho (Check res_ty)
--- Unify with expected type from the context
--- See Note [Unify with expected type before typechecking arguments]
---
--- Match up app_res_rho: the result type of rn_expr
--- with res_ty: the expected result type
+checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho res_ty
= perhaps_add_res_ty_ctxt $
- do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
- ; traceTc "checkResultTy {" $
- vcat [ text "tc_fun:" <+> ppr tc_fun
- , text "app_res_rho:" <+> ppr app_res_rho
- , text "res_ty:" <+> ppr res_ty
- , text "ds_flag:" <+> ppr ds_flag ]
- ; case ds_flag of
- Shallow -> -- No deep subsumption
- -- app_res_rho and res_ty are both rho-types,
- -- so with simple subsumption we can just unify them
- -- No need to zonk; the unifier does that
- do { co <- unifyExprType rn_expr app_res_rho res_ty
- ; traceTc "checkResultTy 1 }" (ppr co)
- ; return (mkWpCastN co) }
-
- Deep ds_reason -> -- Deep subsumption
- -- Even though both app_res_rho and res_ty are rho-types,
- -- they may have nested polymorphism, so if deep subsumption
- -- is on we must call tcSubType.
- do { wrap <- tcSubTypeDS tc_fun ds_reason rn_expr app_res_rho res_ty
- ; traceTc "checkResultTy 2 }" $
- vcat [ text "app_res_rho:" <+> ppr app_res_rho
- , text "res_ty:" <+> ppr res_ty
- , text "wrap:" <+> ppr wrap
- ]
- ; return wrap } }
+ tcSubTypeApp rn_expr tc_fun app_res_rho res_ty
where
-- perhaps_add_res_ty_ctxt: Inside an expansion, the addFunResCtxt stuff is
-- more confusing than helpful because the function at the head isn't in
@@ -506,7 +470,7 @@ checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho (Check res_ty)
| isGeneratedSrcSpan fun_loc
= thing_inside
| otherwise
- = addFunResCtxt tc_fun inst_args app_res_rho (mkCheckExpType res_ty) $
+ = addFunResCtxt tc_fun inst_args app_res_rho res_ty $
thing_inside
----------------
=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -791,10 +791,9 @@ nonBidirectionalErr = TcRnPatSynNotBidirectional
{- Note [Typechecking data constructors]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-As per Note [Polymorphisation of linear fields] in
-GHC.Core.Multiplicity, when we use a data constructor as a term, we want to
-consider its field to have polymorphic multiplicities. That is,
-Note [Data constructors are linear by default] says:
+As per Note [Polymorphisation of linear fields] in GHC.Core.Multiplicity, when
+we use a data constructor as a term, we want to consider its field to have
+polymorphic multiplicities. Note [Data constructors are linear by default] says:
Just :: a. a %1 -> Maybe a
=====================================
compiler/GHC/Tc/Utils/Unify.hs
=====================================
@@ -11,7 +11,7 @@
module GHC.Tc.Utils.Unify (
-- Full-blown subsumption
tcWrapResult, tcWrapResultO, tcWrapResultMono,
- tcSubType, tcSubTypeSigma, tcSubTypePat, tcSubTypeDS, tcSubTypeHoleFit,
+ tcSubType, tcSubTypeSigma, tcSubTypePat, tcSubTypeApp, tcSubTypeHoleFit,
addSubTypeCtxt,
tcSubTypeAmbiguity, tcSubMult,
checkConstraints, checkTvConstraints,
@@ -1488,24 +1488,62 @@ tcSubTypePat _ _ (Infer inf_res) ty_expected
---------------
--- | A subtype check that performs deep subsumption.
--- See also 'tcSubTypeMono', for when no instantiation is required.
-tcSubTypeDS :: HsExpr GhcTc -- ^ App head (for error messages only)
- -> DeepSubsumptionDepth
- -> HsExpr GhcRn
- -> TcRhoType -- ^ Actual type; a rho-type, not a sigma-type
- -> TcRhoType -- ^ Expected type
- -- DeepSubsumption <=> when checking, this type
- -- is deeply skolemised
- -> TcM HsWrapper
--- Only one call site, in GHC.Tc.Gen.App.checkResultTy
-tcSubTypeDS tc_fun ds_depth rn_expr act_rho exp_rho
- = do { wrap <- tc_sub_type_deep (Just tc_fun, Top) ds_depth
- (unifyExprType rn_expr)
- (exprCtOrigin rn_expr)
- GenSigCtxt act_rho exp_rho
+-- | Connect up the inferred type of an application with the expected type.
+-- This is usually just a unification, but with deep subsumption there is more to do.
+tcSubTypeApp :: HsExpr GhcRn
+ -> HsExpr GhcTc -- Head
+ -> TcRhoType -- Inferred type of the application; zonked to
+ -- expose foralls, but maybe not /deeply/ instantiated
+ -> ExpRhoType -- Expected type; this is deeply skolemised
+ -> TcM HsWrapper
+tcSubTypeApp rn_expr tc_fun app_res_rho (Infer inf_res)
+ = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
+ -- Why the "DataConHead" bit? See (IIR5) in
+ -- Note [Instantiation of InferResult] in GHC.Tc.Utils.Unify.
+ ; fillInferResult ds_flag (exprCtOrigin rn_expr) app_res_rho inf_res }
+
+tcSubTypeApp rn_expr tc_fun app_res_rho (Check exp_rho)
+ = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun
+ ; traceTc "tcSubTypeApp {" $
+ vcat [ text "tc_fun:" <+> ppr tc_fun
+ , text "app_res_rho:" <+> ppr app_res_rho
+ , text "exp_rho:" <+> ppr exp_rho
+ , text "ds_flag:" <+> ppr ds_flag ]
+ ; wrap <- case ds_flag of
+ Shallow -- No deep subsumption
+ -- app_res_rho and res_ty are both rho-types,
+ -- so with simple subsumption we can just unify them
+ -- No need to zonk; the unifier does that
+ -> do { co <- unifyExprType rn_expr app_res_rho exp_rho
+ ; return (mkWpCastN co) }
+
+ Deep ds_depth -- Deep subsumption is ON
+ -- Even though both app_res_rho and res_ty are rho-types,
+ -- they may have nested polymorphism, so if deep subsumption
+ -- is on we must call tcSubType.
+ -> tc_sub_type_deep (Just tc_fun, Top) ds_depth
+ (unifyExprType rn_expr)
+ (exprCtOrigin rn_expr)
+ GenSigCtxt app_res_rho exp_rho
+
+ ; traceTc "tcSubTypeApp }" $
+ vcat [ text "tc_fun:" <+> ppr tc_fun
+ , text "wrap:" <+> ppr wrap ]
+
; return (mkWpSubType wrap) }
+-- | Variant of 'getDeepSubsumptionFlag' which enables a top-level subsumption
+-- in order to implement the plan of Note [Typechecking data constructors].
+getDeepSubsumptionFlag_DataConHead :: HsExpr GhcTc -> TcM DeepSubsumptionFlag
+getDeepSubsumptionFlag_DataConHead app_head
+ = do { user_ds <- xoptM LangExt.DeepSubsumption
+ ; return $ if | user_ds
+ -> Deep DeepSub
+ | XExpr (ConLikeTc (RealDataCon {})) <- app_head
+ -> Deep TopSub
+ | otherwise
+ -> Shallow }
+
---------------
-- | Checks that the 'actual' type is more polymorphic than the 'expected' type.
@@ -2104,18 +2142,6 @@ getDeepSubsumptionFlag =
else return Shallow
}
--- | Variant of 'getDeepSubsumptionFlag' which enables a top-level subsumption
--- in order to implement the plan of Note [Typechecking data constructors].
-getDeepSubsumptionFlag_DataConHead :: HsExpr GhcTc -> TcM DeepSubsumptionFlag
-getDeepSubsumptionFlag_DataConHead app_head
- = do { user_ds <- xoptM LangExt.DeepSubsumption
- ; return $ if | user_ds
- -> Deep DeepSub
- | XExpr (ConLikeTc (RealDataCon {})) <- app_head
- -> Deep TopSub
- | otherwise
- -> Shallow }
-
-- | 'tc_sub_type_deep' is where the actual work happens for deep subsumption.
--
@@ -2132,11 +2158,7 @@ tc_sub_type_deep :: HasDebugCallStack
-> TcRhoType -- ^ Expected; deeply skolemised
-> TcM HsWrapper
tc_sub_type_deep fun_pos@(tc_fun, pos) ds_depth unify inst_orig ctxt ty_actual ty_expected
- = assertPpr (isDeeplySkolemised ty_expected)
- (vcat [ text "tc_sub_type_deep: expected type is not a deep rho type"
- , text "ty_expected:" <+> ppr ty_expected
- , text "ty_actual:" <+> ppr ty_actual
- ]) $
+ = assert_precondition $
do { traceTc "tc_sub_type_deep" $
vcat [ text "ty_actual =" <+> ppr ty_actual
, text "ty_expected =" <+> ppr ty_expected ]
@@ -2250,6 +2272,27 @@ tc_sub_type_deep fun_pos@(tc_fun, pos) ds_depth unify inst_orig ctxt ty_actual t
where
given_orig = GivenOrigin (SigSkol GenSigCtxt exp_arg [])
+ -- Assertion check.
+ -- If DeepSubsumption is on (ds_depth = Deep DeepSub) then `exp_rho`
+ -- should already be deeply skolemised; the assertion checks this
+ -- But if DeepSubsumption is NOT on, but there is a data constructor at the
+ -- head, we must still call `tc_sub_type_deep` (for the multiplicity arrows)
+ -- Hence ds_flag = Deep TopSub, but `exp_rho` will only be /top-level/ skolemised
+ -- So we can only check for top-level skolemisation (`isRhoTy`)
+ -- Example of the latter (see #27210), with -XNoDeepSubsumption
+ -- foo :: forall a. a -> forall b. b -> (a,b)
+ -- foo = (,)
+ -- We will only shallowly-skolemise the expected type
+ assert_precondition = assertPpr ty_expected_is_ok $
+ vcat [ text "tc_sub_type_deep: expected type is not a deep rho type"
+ , text "ty_expected:" <+> ppr ty_expected
+ , text "ty_actual:" <+> ppr ty_actual ]
+ ty_expected_is_ok
+ = case ds_depth of
+ TopSub -> isRhoTy ty_expected
+ DeepSub -> isDeeplySkolemised ty_expected
+
+
-- | Whether to do deep subsumption when recurring inside arguments.
recurInArgumentDSFlag :: DeepSubsumptionDepth -> DeepSubsumptionFlag
recurInArgumentDSFlag = \case
@@ -5145,5 +5188,3 @@ lookupCycleBreakerVar cbv (IS { inert_cycle_breakers = cbvs_stack })
= tyfam_app
| otherwise
= pprPanic "lookupCycleBreakerVar found an unbound cycle breaker" (ppr cbv $$ ppr cbvs_stack)
-
---------------------------------------------------------------------------------
=====================================
testsuite/tests/typecheck/should_fail/T27210.hs
=====================================
@@ -0,0 +1,11 @@
+{-# LANGUAGE RankNTypes, ExistentialQuantification #-}
+
+-- NB: No deep subsumption
+
+module T27210 where
+
+data Parser a
+ = forall x. BindP (Parser x) (x -> Parser a)
+
+oneM :: Parser a -> ( forall x. (a -> Parser x) -> Parser x )
+oneM = BindP
=====================================
testsuite/tests/typecheck/should_fail/T27210.stderr
=====================================
@@ -0,0 +1,9 @@
+T27210.hs:11:8: error: [GHC-83865]
+ • Couldn't match expected type: forall x.
+ (a -> Parser x) -> Parser x
+ with actual type: (a -> Parser a0) -> Parser a0
+ • In the expression: BindP
+ In an equation for ‘oneM’: oneM = BindP
+ • Relevant bindings include
+ oneM :: Parser a -> forall x. (a -> Parser x) -> Parser x
+ (bound at T27210.hs:11:1)
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -758,3 +758,4 @@ test('T23162d', normal, compile, [''])
test('T26823', normal, compile_fail, [''])
test('T26861', normal, compile_fail, [''])
test('T26862', normal, compile_fail, [''])
+test('T27210', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c89ffeb5170c36995af4dbfa0d9d41…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6c89ffeb5170c36995af4dbfa0d9d41…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Deleted branch wip/spj-reinstallable-base2.rebased
by Wolfgang Jeltsch (@jeltsch) 24 Apr '26
by Wolfgang Jeltsch (@jeltsch) 24 Apr '26
24 Apr '26
Wolfgang Jeltsch deleted branch wip/spj-reinstallable-base2.rebased at Glasgow Haskell Compiler / GHC
--
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/spj-reinstallable-base2] 47 commits: NCG: Implement constant folding for vector simd ops (Issue #25030)
by Wolfgang Jeltsch (@jeltsch) 24 Apr '26
by Wolfgang Jeltsch (@jeltsch) 24 Apr '26
24 Apr '26
Wolfgang Jeltsch pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
72d6dc74 by aparker at 2026-04-20T20:15:44-04:00
NCG: Implement constant folding for vector simd ops (Issue #25030)
- - - - -
b9cab907 by sheaf at 2026-04-20T20:15:44-04:00
Mark some SIMD tests as broken on i386 optllvm
As seen in #25498, several SIMD tests are broken on i386 in the optllvm
way. This commit marks them as "expect_broken".
- - - - -
76528cc3 by Wolfgang Jeltsch at 2026-04-20T20:16:25-04:00
Move most of the `System.IO` implementation into `base`
This involves a rewrite of the `combine` helper function to avoid the
use of `last`, which would now be flagged as an error.
Metric Decrease:
LinkableUsage01
T3294
Metric Increase:
T12227
T12707
T5642
- - - - -
04d143c0 by Luite Stegeman at 2026-04-21T14:05:33-04:00
rts: add a few missing i386 relocations in the rts linker
- - - - -
014087e7 by Luite Stegeman at 2026-04-21T14:05:34-04:00
CodeOutput: Fix finalizers on multiple platforms
- ELF platforms: emit .fini_array section
- wasm32/Darwin: emit initializer with __cxa_atexit call
- Windows: use -Wl,--whole-archive to prevent dropping finalizer symbols
- rts linker: fix crash/assertion failure unloading objects with finalizers
fixes #27072
- - - - -
915bba6f by Simon Jakobi at 2026-04-21T14:06:16-04:00
Add regression test for #10531
Closes #10531.
- - - - -
86a646a6 by Andreas Klebinger at 2026-04-22T13:00:05-04:00
Revert use of generic instances for compiler time perf reasons.
Revert "Derive Semigroup/Monoid for instances believed could be derived in #25871"
This reverts commit 11a04cbb221cc404fe00d65d7c951558ede4caa9.
Revert "add Ghc.Data.Pair deriving"
This reverts commit 15d9ce449e1be8c01b89fd39bdf1e700ea7d1dce.
- - - - -
bc9ee1cf by Wen Kokke at 2026-04-22T13:00:51-04:00
hadrian: Fix docs to remove static flavour
In 638f6548, the static flavour was turned into into the fully_static
flavour transformer. However, this commit did not update flavours.md.
- - - - -
a68b238c by Simon Peyton Jones at 2026-04-23T20:50:40+03:00
Major patch to re-engineer known-key names
This big patch implements the New Plan for known-key names,
described in #27013.
Read the big Note [Overview of known-key names] in GHC.Types.Name
Moving more into the new mechanism [skip ci]
DOES NOT COMPILE, just work in progress
More more stuff into the new mechanism
fromString is known-key
Onward
Onward more
Add imports in ghc-internal for known-key names [skip ci]
Add known-key imports for ghc-internal [skip ci]
More [skip ci]
More
Particularly using a proxy for `toList` from the IsList class.
Add Real to known-key names [skip ci]
More....[skip ci]
Lots of Names have moved to new mechanism
BuiltinRules had KnownKeyNameKeys
Start on updating RdrName but incomplete, hence skip ci
Onward [skip ci]
Onward
Added GHC.Tc.Deriv.RdrNames as a new module
Onward
Added -fexclude-known-key-define
Wibble [skip ci]
More
.. forging ahead with KnownOccs
Onward [skip ci]
including renaming GHC.Builtin.Utils to GHC.Builtin
More and more
I think this might actually bootstrap!
- - - - -
edd25e3e by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibbles [skip ci]
- - - - -
7c91593b by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibbles
- - - - -
1e3e58a8 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibbles
- - - - -
c4a5152e by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibble check-exact
- - - - -
45f20ee3 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibble
- - - - -
c8bc8007 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Update KnownKeyNames
- - - - -
d97957b7 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
More
- - - - -
e5b4bf34 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Wibble
- - - - -
ff2bef49 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
More fixes
- - - - -
1bdc68dd by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
More and more
- - - - -
a450f9f0 by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
Renaming
GHC.Builtin.Names --> GHC.Builtin.KnownKeys
GHC.Builtin.RdrNames --> GHC.Builtin.KnownOccs
- - - - -
e324351c by Simon Peyton Jones at 2026-04-23T20:50:48+03:00
More
- - - - -
ff35a3cb by Simon Peyton Jones at 2026-04-23T20:50:49+03:00
A huge pile of import wibbles
.. to satisfy known-occ names for generated Typeable bindings
- - - - -
75096105 by Simon Peyton Jones at 2026-04-23T20:50:49+03:00
Onward
- - - - -
234cb2c3 by Simon Peyton Jones at 2026-04-23T20:51:22+03:00
More [skip ci]
- - - - -
ac9a3d62 by Simon Peyton Jones at 2026-04-23T20:51:24+03:00
Don't generate $trModule bindings if no type decls!
- - - - -
c22938b6 by Simon Peyton Jones at 2026-04-23T20:51:24+03:00
Much progress
- - - - -
d08ee8a5 by Simon Peyton Jones at 2026-04-23T20:51:24+03:00
Add Builtin/Modules.hs
- - - - -
6c7473f2 by Simon Peyton Jones at 2026-04-23T20:53:36+03:00
More and more
- - - - -
1b8f5195 by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Final wibbles
This actually bootstraps
- - - - -
4d8f8699 by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Wibbles
- - - - -
115781f0 by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Wibbles
- - - - -
bf72b00f by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Onwards [skip ci]
- - - - -
759998c6 by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Onward
This version bootstraps. And the documentation in GHC.Builtin is much
better
- - - - -
815bbe3d by Simon Peyton Jones at 2026-04-23T20:53:38+03:00
Knot-tying nonsense [skip ci]
I ended up extending KKKNS_InScope
- - - - -
0ed1858b by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Onward!
Some renaming, immprove docs
More more things out of known-key into known-occ
- - - - -
0885333c by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Wibbles
- - - - -
70b80050 by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Put all wired-in stuff under GHC.Builtin
* Move the wired-in Ids from GHC.Types.Id.Make to the new module
GHC.Builtin.WiredIn.Ids
* Move GHC.Builtin.Types -> GHC.Builtin.WiredIn.Types
GHC.Builtin.Types.Prim -> GHC.Builtin.WiredIn.Prim
GHC.Builtin.Types.Literals -> GHC.Builtin.WiredIn.TypeLits
- - - - -
66d181da by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Wibble docs
- - - - -
91f71843 by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
More
- - - - -
3f4cc282 by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Wibble
- - - - -
a4d6e38f by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Wibbles
... around (>>>) and Floating class
- - - - -
4c9c6673 by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Small changes in response to reviews
- - - - -
d8cf7ea8 by Simon Peyton Jones at 2026-04-23T20:53:39+03:00
Spelling error [skip ci]
- - - - -
7d98e51c by Wolfgang Jeltsch at 2026-04-23T20:54:57+03:00
Correct and improve the terminology
- - - - -
d9f1f58a by Wolfgang Jeltsch at 2026-04-23T20:54:58+03:00
Perform some documentation fixes
- - - - -
26d77eb6 by Wolfgang Jeltsch at 2026-04-23T22:54:50+03:00
Fix flag names in documentation
- - - - -
2d331e27 by Wolfgang Jeltsch at 2026-04-24T17:17:59+03:00
Add missing import of `GHC.Essentials` into `System.IO`
- - - - -
583 changed files:
- + changelog.d/fix-finalizers-27072
- + changelog.d/refactor-known-names
- + changelog.d/simd_constant_folding
- compiler/GHC.hs
- + compiler/GHC/Builtin.hs
- compiler/GHC/Builtin/Names.hs → compiler/GHC/Builtin/KnownKeys.hs
- + compiler/GHC/Builtin/KnownOccs.hs
- + compiler/GHC/Builtin/Modules.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/PrimOps/Casts.hs
- compiler/GHC/Builtin/PrimOps/Ids.hs
- compiler/GHC/Builtin/Names/TH.hs → compiler/GHC/Builtin/TH.hs
- compiler/GHC/Builtin/Uniques.hs
- − compiler/GHC/Builtin/Utils.hs
- + compiler/GHC/Builtin/WiredIn/Ids.hs
- compiler/GHC/Builtin/Types/Prim.hs → compiler/GHC/Builtin/WiredIn/Prim.hs
- compiler/GHC/Builtin/Types/Literals.hs → compiler/GHC/Builtin/WiredIn/TypeLits.hs
- compiler/GHC/Builtin/Types.hs → compiler/GHC/Builtin/WiredIn/Types.hs
- compiler/GHC/Builtin/Types.hs-boot → compiler/GHC/Builtin/WiredIn/Types.hs-boot
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/LiberateCase.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/Pair.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/Tidy.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Env/KnotVars.hs
- compiler/GHC/Driver/Env/Types.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Utils.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Check.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Ppr.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Types.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Binary.hs
- compiler/GHC/Iface/Env.hs
- − compiler/GHC/Iface/Env.hs-boot
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Types.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Linker/Executable.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Header.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Plugins.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Lit.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Context.hs
- compiler/GHC/Runtime/Debugger.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Loader.hs
- compiler/GHC/Stg/BcPrep.hs
- compiler/GHC/Stg/Unarise.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/DataCon.hs
- compiler/GHC/StgToCmm/Env.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Lit.hs
- compiler/GHC/StgToCmm/Ticky.hs
- compiler/GHC/StgToJS/Apply.hs
- compiler/GHC/StgToJS/Arg.hs
- compiler/GHC/StgToJS/Expr.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/StgToJS/Linker/Utils.hs
- compiler/GHC/StgToJS/Utils.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Functor.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Deriv/Infer.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/FunDeps.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Rewrite.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Build.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Backpack.hs
- compiler/GHC/Tc/Utils/Concrete.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/DefaultEnv.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/ForeignStubs.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Cache.hs
- compiler/GHC/Types/Name/Ppr.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Unique.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Types/Unique/FM.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/External.hs
- compiler/GHC/Unit/Module/ModSummary.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Misc.hs
- compiler/GHC/Utils/Ppr/Colour.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- compiler/ghc.cabal.in
- docs/users_guide/separate_compilation.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Monad.hs
- hadrian/doc/flavours.md
- libraries/base/base.cabal.in
- libraries/base/src/Control/Applicative.hs
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/Control/Concurrent/Chan.hs
- libraries/base/src/Control/Concurrent/QSem.hs
- libraries/base/src/Control/Concurrent/QSemN.hs
- libraries/base/src/Data/Array/Byte.hs
- libraries/base/src/Data/Bifoldable.hs
- libraries/base/src/Data/Bifoldable1.hs
- libraries/base/src/Data/Bifunctor.hs
- libraries/base/src/Data/Bitraversable.hs
- libraries/base/src/Data/Bool.hs
- libraries/base/src/Data/Complex.hs
- libraries/base/src/Data/Enum.hs
- libraries/base/src/Data/Fixed.hs
- libraries/base/src/Data/Foldable1.hs
- libraries/base/src/Data/Functor/Classes.hs
- libraries/base/src/Data/Functor/Compose.hs
- libraries/base/src/Data/Functor/Contravariant.hs
- libraries/base/src/Data/Functor/Product.hs
- libraries/base/src/Data/Functor/Sum.hs
- libraries/base/src/Data/List.hs
- libraries/base/src/Data/List/NubOrdSet.hs
- libraries/base/src/Data/Semigroup.hs
- libraries/base/src/GHC/Base.hs
- + libraries/base/src/GHC/Essentials.hs
- libraries/base/src/GHC/Fingerprint.hs
- libraries/base/src/GHC/IO/Handle.hs
- libraries/base/src/GHC/RTS/Flags.hs
- libraries/base/src/GHC/ResponseFile.hs
- libraries/base/src/GHC/Stats.hs
- libraries/base/src/GHC/Weak/Finalize.hs
- libraries/base/src/Prelude.hs
- libraries/base/src/System/CPUTime/Posix/ClockGetTime.hsc
- libraries/base/src/System/Console/GetOpt.hs
- libraries/base/src/System/Exit.hs
- libraries/base/src/System/IO.hs
- libraries/base/src/System/IO/OS.hs
- libraries/base/src/System/IO/Unsafe.hs
- libraries/base/src/System/Info.hs
- libraries/base/src/System/Timeout.hs
- libraries/base/src/Text/Printf.hs
- libraries/ghc-experimental/src/Data/Tuple/Experimental.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/AllocationLimitHandler.hs
- libraries/ghc-internal/src/GHC/Internal/Arr.hs
- libraries/ghc-internal/src/GHC/Internal/ArrayArray.hs
- libraries/ghc-internal/src/GHC/Internal/Base.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Backend.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Backend/Native.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/BigNat.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/BigNat.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Integer.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Bignum/Natural.hs
- libraries/ghc-internal/src/GHC/Internal/Bignum/Natural.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/ByteOrder.hs
- libraries/ghc-internal/src/GHC/Internal/CString.hs
- libraries/ghc-internal/src/GHC/Internal/Char.hs
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- libraries/ghc-internal/src/GHC/Internal/Clock.hsc
- libraries/ghc-internal/src/GHC/Internal/ClosureTypes.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/Bound.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/Signal.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/Sync.hs
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/Control/Arrow.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Category.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Concurrent/MVar.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/IO/Class.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Coerce.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Dynamic.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Either.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Function.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Const.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Utils.hs
- libraries/ghc-internal/src/GHC/Internal/Data/IORef.hs
- libraries/ghc-internal/src/GHC/Internal/Data/List.hs
- libraries/ghc-internal/src/GHC/Internal/Data/List/NonEmpty.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Maybe.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Monoid.hs
- libraries/ghc-internal/src/GHC/Internal/Data/NonEmpty.hs
- libraries/ghc-internal/src/GHC/Internal/Data/OldList.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Ord.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Proxy.hs
- libraries/ghc-internal/src/GHC/Internal/Data/STRef.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Semigroup/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/Data/String.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Traversable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Coercion.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Equality.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Ord.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Typeable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Typeable/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Unique.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Version.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Void.hs
- libraries/ghc-internal/src/GHC/Internal/Debug/Trace.hs
- libraries/ghc-internal/src/GHC/Internal/Desugar.hs
- libraries/ghc-internal/src/GHC/Internal/Enum.hs
- libraries/ghc-internal/src/GHC/Internal/Enum.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Environment.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Arr.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Array.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
- libraries/ghc-internal/src/GHC/Internal/Event/EPoll.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/IntTable.hs
- libraries/ghc-internal/src/GHC/Internal/Event/IntVar.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Internal/Types.hs
- libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/Manager.hs
- libraries/ghc-internal/src/GHC/Internal/Event/PSQ.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Poll.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/Thread.hs
- libraries/ghc-internal/src/GHC/Internal/Event/TimeOut.hs
- libraries/ghc-internal/src/GHC/Internal/Event/TimerManager.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Unique.hs
- libraries/ghc-internal/src/GHC/Internal/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot
- libraries/ghc-internal/src/GHC/Internal/ExecutionStack.hs
- libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Fingerprint.hs
- libraries/ghc-internal/src/GHC/Internal/Fingerprint/Type.hs
- libraries/ghc-internal/src/GHC/Internal/Float.hs
- libraries/ghc-internal/src/GHC/Internal/Float/ConversionUtils.hs
- libraries/ghc-internal/src/GHC/Internal/Float/RealFracMethods.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/ConstPtr.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/String.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/String/Encoding.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/C/Types.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/ForeignPtr/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Marshal/Alloc.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Marshal/Array.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Marshal/Error.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Marshal/Pool.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Marshal/Utils.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Ptr.hs
- libraries/ghc-internal/src/GHC/Internal/Foreign/Storable.hs
- libraries/ghc-internal/src/GHC/Internal/ForeignPtr.hs
- libraries/ghc-internal/src/GHC/Internal/ForeignSrcLang.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- libraries/ghc-internal/src/GHC/Internal/GHCi.hs
- libraries/ghc-internal/src/GHC/Internal/GHCi/Helpers.hs
- libraries/ghc-internal/src/GHC/Internal/Generics.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/Closures.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/Constants.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable/Types.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/ProfInfo/Types.hs
- libraries/ghc-internal/src/GHC/Internal/IO.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Buffer.hs
- libraries/ghc-internal/src/GHC/Internal/IO/BufferedIO.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Device.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/CodePage.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/Failure.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/Iconv.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/Latin1.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/Types.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/UTF16.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/UTF32.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/UTF8.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/FD.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Internals.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Common.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Flock.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/LinuxOFD.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/NoOp.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Windows.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Text.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Types.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO/IOMode.hs
- libraries/ghc-internal/src/GHC/Internal/IO/SubSystem.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Unsafe.hs
- libraries/ghc-internal/src/GHC/Internal/IOArray.hs
- libraries/ghc-internal/src/GHC/Internal/IORef.hs
- libraries/ghc-internal/src/GHC/Internal/InfoProv.hs
- libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc
- libraries/ghc-internal/src/GHC/Internal/Int.hs
- libraries/ghc-internal/src/GHC/Internal/IsList.hs
- libraries/ghc-internal/src/GHC/Internal/Ix.hs
- libraries/ghc-internal/src/GHC/Internal/LanguageExtensions.hs
- libraries/ghc-internal/src/GHC/Internal/Lexeme.hs
- libraries/ghc-internal/src/GHC/Internal/List.hs
- libraries/ghc-internal/src/GHC/Internal/MVar.hs
- libraries/ghc-internal/src/GHC/Internal/Magic.hs
- libraries/ghc-internal/src/GHC/Internal/Magic/Dict.hs
- libraries/ghc-internal/src/GHC/Internal/Maybe.hs
- libraries/ghc-internal/src/GHC/Internal/Num.hs
- libraries/ghc-internal/src/GHC/Internal/Num.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Numeric.hs
- libraries/ghc-internal/src/GHC/Internal/OverloadedLabels.hs
- libraries/ghc-internal/src/GHC/Internal/Pack.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/Ext.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/Panic.hs
- libraries/ghc-internal/src/GHC/Internal/Prim/PtrEq.hs
- libraries/ghc-internal/src/GHC/Internal/Profiling.hs
- libraries/ghc-internal/src/GHC/Internal/Ptr.hs
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
- libraries/ghc-internal/src/GHC/Internal/Read.hs
- libraries/ghc-internal/src/GHC/Internal/Real.hs
- libraries/ghc-internal/src/GHC/Internal/Real.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Records.hs
- libraries/ghc-internal/src/GHC/Internal/ST.hs
- libraries/ghc-internal/src/GHC/Internal/STM.hs
- libraries/ghc-internal/src/GHC/Internal/STRef.hs
- libraries/ghc-internal/src/GHC/Internal/Show.hs
- libraries/ghc-internal/src/GHC/Internal/Stable.hs
- libraries/ghc-internal/src/GHC/Internal/StableName.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/CloneStack.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Constants.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/ConstantsProf.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Types.hs
- libraries/ghc-internal/src/GHC/Internal/StaticPtr.hs
- libraries/ghc-internal/src/GHC/Internal/StaticPtr/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/Stats.hsc
- libraries/ghc-internal/src/GHC/Internal/Storable.hs
- libraries/ghc-internal/src/GHC/Internal/System/Environment.hs
- libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- libraries/ghc-internal/src/GHC/Internal/System/IO/Error.hs
- libraries/ghc-internal/src/GHC/Internal/System/Mem.hs
- libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
- libraries/ghc-internal/src/GHC/Internal/System/Posix/Types.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lib.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lift.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Syntax.hs
- libraries/ghc-internal/src/GHC/Internal/Text/ParserCombinators/ReadP.hs
- libraries/ghc-internal/src/GHC/Internal/Text/ParserCombinators/ReadPrec.hs
- libraries/ghc-internal/src/GHC/Internal/Text/Read.hs
- libraries/ghc-internal/src/GHC/Internal/Text/Read/Lex.hs
- libraries/ghc-internal/src/GHC/Internal/TopHandler.hs
- libraries/ghc-internal/src/GHC/Internal/Tuple.hs
- libraries/ghc-internal/src/GHC/Internal/Type/Reflection.hs
- libraries/ghc-internal/src/GHC/Internal/Type/Reflection/Unsafe.hs
- libraries/ghc-internal/src/GHC/Internal/TypeError.hs
- libraries/ghc-internal/src/GHC/Internal/TypeLits.hs
- libraries/ghc-internal/src/GHC/Internal/TypeLits/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/TypeNats.hs
- libraries/ghc-internal/src/GHC/Internal/TypeNats/Internal.hs
- libraries/ghc-internal/src/GHC/Internal/Types.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Bits.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Char/DerivedCoreProperties.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Char/UnicodeData/GeneralCategory.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Char/UnicodeData/SimpleLowerCaseMapping.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Char/UnicodeData/SimpleTitleCaseMapping.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Char/UnicodeData/SimpleUpperCaseMapping.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Version.hs
- libraries/ghc-internal/src/GHC/Internal/Unsafe/Coerce.hs
- libraries/ghc-internal/src/GHC/Internal/Weak.hs
- libraries/ghc-internal/src/GHC/Internal/Weak/Finalize.hs
- libraries/ghc-internal/src/GHC/Internal/Word.hs
- libraries/ghc-prim/Dummy.hs
- libraries/ghc-prim/ghc-prim.cabal
- rts/Linker.c
- rts/LinkerInternals.h
- rts/linker/Elf.c
- + testsuite/tests/codeGen/should_run/T27072d.hs
- + testsuite/tests/codeGen/should_run/T27072d.stdout
- + testsuite/tests/codeGen/should_run/T27072d_c.c
- + testsuite/tests/codeGen/should_run/T27072d_check.c
- + testsuite/tests/codeGen/should_run/T27072w.hs
- + testsuite/tests/codeGen/should_run/T27072w.stdout
- + testsuite/tests/codeGen/should_run/T27072w_c.c
- testsuite/tests/codeGen/should_run/all.T
- + testsuite/tests/driver/T10531/A.hs
- + testsuite/tests/driver/T10531/B.hs
- + testsuite/tests/driver/T10531/C.hs
- + testsuite/tests/driver/T10531/Makefile
- + testsuite/tests/driver/T10531/all.T
- testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/parser/should_fail/T16270h.hs
- + testsuite/tests/rts/linker/T27072/Lib.c
- + testsuite/tests/rts/linker/T27072/Makefile
- + testsuite/tests/rts/linker/T27072/T27072.stdout
- + testsuite/tests/rts/linker/T27072/all.T
- + testsuite/tests/rts/linker/T27072/main.c
- + testsuite/tests/simd/should_run/Makefile
- + testsuite/tests/simd/should_run/T25030.hs
- + testsuite/tests/simd/should_run/T25030.stdout
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/th/T26568.stderr
- testsuite/tests/th/all.T
- testsuite/tests/typecheck/should_compile/T9497a.stderr
- testsuite/tests/typecheck/should_compile/holes.stderr
- testsuite/tests/typecheck/should_compile/holes3.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- testsuite/tests/typecheck/should_fail/T9497d.stderr
- testsuite/tests/typecheck/should_run/T9497a-run.stderr
- testsuite/tests/typecheck/should_run/T9497b-run.stderr
- testsuite/tests/typecheck/should_run/T9497c-run.stderr
- utils/check-exact/Utils.hs
- utils/genprimopcode/Main.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface.hs
- utils/haddock/haddock-api/src/Haddock/Interface/AttachInstances.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/html-test/ref/Bug1004.html
- utils/haddock/html-test/ref/Bug973.html
- utils/haddock/html-test/ref/ConstructorPatternExport.html
- utils/haddock/html-test/ref/DefaultSignatures.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/PatternSyns.html
- utils/haddock/html-test/ref/PatternSyns2.html
- utils/haddock/html-test/ref/QuasiExpr.html
- utils/haddock/html-test/ref/Test.html
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/19eed9010a5b9464dc698d59af54d2…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/19eed9010a5b9464dc698d59af54d2…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Pushed new branch wip/dcoutts/windows-refptr-mechanism
by Duncan Coutts (@dcoutts) 24 Apr '26
by Duncan Coutts (@dcoutts) 24 Apr '26
24 Apr '26
Duncan Coutts pushed new branch wip/dcoutts/windows-refptr-mechanism at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/dcoutts/windows-refptr-mechan…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: compiler: avoid unused temporary `appendFS` operands
by Marge Bot (@marge-bot) 24 Apr '26
by Marge Bot (@marge-bot) 24 Apr '26
24 Apr '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
5574ee10 by Cheng Shao at 2026-04-24T08:24:30-04:00
compiler: avoid unused temporary `appendFS` operands
This patch fixes unused temporary `appendFS` operands in the codebase
that are retained in the `FastString` table after concatenation.
Rewrite rules are added so that if an operand is
`fsLit`/`mkFastString`, the `appendFS` application is rewritten to
append the `ShortByteString` operands first. The patch also fixes
`sconcat` behavior to align with `mconcat` for the same reason. Fixes #27205.
- - - - -
4ed78760 by mangoiv at 2026-04-24T08:25:13-04:00
contributing: adjust MR template to be less verbose
- MR template only shows text that is relevant for submissiong
- MR template was rewritten so it's readable from a user's and reviewer's
perspective
Resolves #27165
Co-Authored-By: @sheaf
- - - - -
a03df654 by Cheng Shao at 2026-04-24T08:56:47-04:00
ci: bump freebsd boot ghc to 9.10.3
This commit bumps freebsd boot ghc to 9.10.3 to align with other
platforms and prevent outdated boot libs in boot ghc to block the
freebsd job.
- - - - -
b1ae23de by Cheng Shao at 2026-04-24T08:56:47-04:00
compiler: improve Binary instance of Array
This patch improves the `Binary` instance of `Array`:
- We no longer allocate intermediate lists. When serializing an
`Array`, we iterate over the elements directly; when deserializing
it, we allocate the result `Array` and fill it in a loop.
- Now we only serialize the array bounds tuple; the length field is
not needed.
Closes #27109.
- - - - -
e45b5522 by sheaf at 2026-04-24T08:57:02-04:00
Vendor mini-QuickCheck for testsuite
This commit extracts the vendored QuickCheck implementation from the
foundation testsuite to make it more broadly available in the GHC
testsuite, and makes use of it in the simd006 test (which also used
a vendored QuickCheck implementation).
On the way, we update the linear congruential generator to avoid the
shortcoming of only generating 31 bit large numbers.
Fixes #25990 and #25969.
- - - - -
12 changed files:
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/merge_request_templates/Default.md
- + changelog.d/binary-array-no-list
- compiler/GHC/Data/FastString.hs
- compiler/GHC/Utils/Binary.hs
- testsuite/driver/testlib.py
- + testsuite/tests/MiniQuickCheck.hs
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/numeric/should_run/foundation.hs
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/simd/should_run/simd006.hs
Changes:
=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -445,7 +445,7 @@ opsysVariables _ FreeBSD14 = mconcat
-- Prefer to use the system's clang-based toolchain and not gcc
, "CC" =: "cc"
, "CXX" =: "c++"
- , "FETCH_GHC_VERSION" =: "9.10.1"
+ , "FETCH_GHC_VERSION" =: "9.10.3"
, "CABAL_INSTALL_VERSION" =: "3.14.2.0"
]
opsysVariables arch (Linux distro) = distroVariables arch distro
=====================================
.gitlab/jobs.yaml
=====================================
@@ -1721,7 +1721,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-freebsd14-validate",
@@ -4543,7 +4543,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
@@ -5643,7 +5643,7 @@
"CC": "cc",
"CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
"CXX": "c++",
- "FETCH_GHC_VERSION": "9.10.1",
+ "FETCH_GHC_VERSION": "9.10.3",
"INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-freebsd14-validate"
=====================================
.gitlab/merge_request_templates/Default.md
=====================================
@@ -1,43 +1,47 @@
+
+<!--
Thank you for your contribution to GHC!
-**Please read the checklist below to make sure your contribution fulfills these
-expectations. Also please answer the following question in your MR description:**
-
-**Where is the key part of this patch? That is, what should reviewers look at first?**
-
-Please take a few moments to address the following points:
-
- * [ ] if your MR touches `base` (or touches parts of `ghc-internal` used
- or re-exported by `base`) more substantially than just amending comments
- or documentation, you likely need to raise a
- [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package)
- before merging it.
- * [ ] if your MR may break existing programs (e.g. causes the
- compiler to reject programs), please describe the expected breakage and add
- the ~"user-facing" label. This will run ghc/head.hackage> to characterise
- the effect of your change on Hackage.
- * [ ] ensure that your commits are either individually buildable or squashed
- * [ ] ensure that your commit messages describe *what they do*
- (referring to tickets using `#NNNN` syntax when appropriate)
- * [ ] have added source comments describing your change. For larger changes you
- likely should add a [Note][notes] and cross-reference it from the relevant
- places.
- * [ ] add a [testcase to the testsuite][adding test].
- * [ ] updates the users guide if applicable
- * [ ] add a changelog entry in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
- If this MR does not need a changelog entry, apply the ~"no-changelog" label.
+Please read the checklist below to make sure your contribution fulfills these
+expectations.
If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
-title with `WIP:`.
+title with Draft:
+
+To make your contribution experience as smooth as possible, also check out
+https://gitlab.haskell.org/ghc/ghc/-/wikis/Contributing-a-Patch
+-->
+
+## Changes contained in this patch
+<!-- Where is the key part of this patch? That is, what should reviewers look at first? -->
+
+
+## MR Checklist
+<!-- Please take a few moments to address the following points: -->
+
+- [ ] This MR solves the problem described in the following issue: <!-- issue number here (please open a new issue if there isn't one) -->
+- [ ] A changelog entry was added in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
+ If this MR does not need a changelog entry, the ~"no-changelog" label was applied.
+- [ ] This MR does not make any significant changes to `base`, or it has an accompanying [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package).
+- [ ] If this MR has the potential to break user programs, the ~"user-facing" label was applied to
+ test against head.hackage.
+- [ ] All commits are either individually buildable or squashed.
+- [ ] Commit messages describe *what they do*, referring to tickets using `#NNNNN` syntax.
+- [ ] Source comments describing the change were added. For larger changes [notes][notes] and
+ cross-references from the relevant places were added (as applicable).
+- [ ] [Testcases to the testsuite][adding test] were added (as applicable).
+- [ ] The users guide was updated (as applicable).
+<!--
By default a minimal validation pipeline is run on each merge request, the ~full-ci
label can be applied to perform additional validation checks if your MR affects a more
unusual configuration.
-Once your change is ready please remove the `WIP:` tag and wait for review. If
+Once your change is ready please remove the `Draft:` tag and wait for review. If
no one has offered a review in a few days then please leave a comment mentioning
@triagers and apply the ~"Blocked on Review" label.
+-->
[notes]: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/coding-style#comments-i…
[adding test]: https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding
=====================================
changelog.d/binary-array-no-list
=====================================
@@ -0,0 +1,13 @@
+section: compiler
+synopsis: Reduce allocations when (de)serialising `Array` in the `ghc` library.
+issues: #27109
+mrs: !15805
+
+description: {
+ The `ghc` library's `Binary` instance for `Array` was changed to
+ avoid allocating an intermediate list and to omit a redundant length
+ field during (de)serialisation.
+
+ This should only affect the `ghc` library's (de)serialisation code paths,
+ primarily when parsing HIE files and bytecode objects.
+}
=====================================
compiler/GHC/Data/FastString.hs
=====================================
@@ -139,6 +139,7 @@ import Foreign.C
import System.IO
import Data.Data
import Data.IORef
+import qualified Data.List.NonEmpty as NE
import Data.Semigroup as Semi
import Foreign
@@ -232,6 +233,7 @@ instance IsString FastString where
instance Semi.Semigroup FastString where
(<>) = appendFS
+ sconcat = concatFS . NE.toList
instance Monoid FastString where
mempty = nilFS
@@ -619,6 +621,42 @@ unpackFS fs = utf8DecodeShortByteString $ fs_sbs fs
zEncodeFS :: FastString -> FastZString
zEncodeFS fs = fs_zenc fs
+-- Sometimes an `appendFS` operand is temporarily constructed, and we
+-- should avoid retaining the unused `FastString` operand in the
+-- table. The RULES below mitigate the issue by concatenating the
+-- `ShortByteString`s instead when an operand is `fsLit` or
+-- `mkFastString`, which cover most such `appendFS` use cases. See
+-- #27205.
+
+{-# RULES
+"appendFS/fsLit y" forall x y.
+ appendFS x (fsLit y) =
+ mkFastStringShortByteString $
+ fs_sbs x Semi.<> utf8EncodeShortByteString y
+ #-}
+
+{-# RULES
+"appendFS/fsLit x" forall x y.
+ appendFS (fsLit x) y =
+ mkFastStringShortByteString $
+ utf8EncodeShortByteString x Semi.<> fs_sbs y
+ #-}
+
+{-# RULES
+"appendFS/mkFastString y" forall x y.
+ appendFS x (mkFastString y) =
+ mkFastStringShortByteString $
+ fs_sbs x Semi.<> utf8EncodeShortByteString y
+ #-}
+
+{-# RULES
+"appendFS/mkFastString x" forall x y.
+ appendFS (mkFastString x) y =
+ mkFastStringShortByteString $
+ utf8EncodeShortByteString x Semi.<> fs_sbs y
+ #-}
+
+{-# INLINE[1] appendFS #-}
appendFS :: FastString -> FastString -> FastString
appendFS fs1 fs2 = mkFastStringShortByteString
$ (Semi.<>) (fs_sbs fs1) (fs_sbs fs2)
=====================================
compiler/GHC/Utils/Binary.hs
=====================================
@@ -142,6 +142,8 @@ import Control.DeepSeq
import Control.Monad ( when, (<$!>), unless, forM_, void )
import Foreign hiding (bit, setBit, clearBit, shiftL, shiftR, void)
import Data.Array
+import Data.Array.Base (unsafeFreezeIOArray)
+import Data.Array.IArray (traverseArray_)
import Data.Array.IO
import Data.Array.Unsafe
import qualified Data.Binary as Binary
@@ -970,11 +972,12 @@ instance Binary a => Binary (NonEmpty a) where
instance (Ix a, Binary a, Binary b) => Binary (Array a b) where
put_ bh arr = do
put_ bh $ bounds arr
- put_ bh $ elems arr
+ traverseArray_ (put_ bh) arr
+
get bh = do
- bounds <- get bh
- xs <- get bh
- return $ listArray bounds xs
+ (l, u) <- get bh
+ marr <- newGenArray (l, u) $ \_ -> get bh
+ unsafeFreezeIOArray marr
instance Binary a => Binary (SmallArray a) where
put_ bh sa = do
=====================================
testsuite/driver/testlib.py
=====================================
@@ -13,6 +13,7 @@ import time
import datetime
import copy
import glob
+import random
import sys
from math import ceil, trunc, floor, log
from pathlib import Path, PurePath
@@ -648,6 +649,11 @@ def extra_files(files):
def _extra_files(name, opts, files):
opts.extra_files.extend(files)
+def mini_quickcheck(name, opts):
+ miniqc = os.path.relpath(config.top / 'tests' / 'MiniQuickCheck.hs', opts.srcdir)
+ opts.extra_files.extend([miniqc])
+ opts.extra_run_opts += ' ' + str(random.getrandbits(64))
+
# Record the size of a specific file
def collect_size ( deviation, path ):
return collect_size_func(deviation, lambda: path)
=====================================
testsuite/tests/MiniQuickCheck.hs
=====================================
@@ -0,0 +1,395 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE GeneralisedNewtypeDeriving #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TypeFamilies #-}
+
+-- | A minimal QuickCheck-like property testing framework for use in the GHC
+-- test suite.
+--
+-- We vendor this package to avoid depending on the real QuickCheck package,
+-- as the latter (or one of its dependencies) may not build with the GHC version
+-- being tested.
+module MiniQuickCheck
+ ( -- * QuickCheck generator
+ Gen(..)
+
+ -- * QuickCheck typeclasses
+ , Arbitrary(..)
+ , IsProperty(..)
+
+ -- * QuickCheck properties
+ , PropertyCheck(..)
+ , PropertyTestArg(..)
+ , Property(..)
+ , forAll
+ , (===)
+ , propertyCompare
+ , propertyAnd
+ , getCheck
+
+ -- * QuickCheck test tree
+ , Test(..)
+
+ -- * Running QuickCheck tests
+ , Result(..)
+ , Iterations(..)
+ , runTestsMain
+ , runTests
+ , runTestInternal
+
+ -- * QuickCheck primitive generators
+ , arbitraryInt64
+ , arbitraryWord64
+ , integralDownsize
+ , wordDownsize
+
+ -- * QuickCheck newtypes
+ , NonZero(..)
+ , nonZero
+ , BoundedShiftAmount(..)
+ , BoundedBy(..)
+ ) where
+
+-- base
+import Control.Monad.IO.Class
+ ( liftIO )
+import Data.Bits
+ ( (.|.), shiftL, shiftR
+ , FiniteBits, finiteBitSize
+ )
+import Data.Int
+ ( Int8, Int16, Int32, Int64 )
+import Data.IORef
+ ( newIORef, atomicModifyIORef' )
+import Data.Kind
+ ( Type )
+import Data.List
+ ( intercalate )
+import Data.Proxy
+ ( Proxy(..) )
+import Data.Word
+ ( Word8, Word16, Word32, Word64 )
+import GHC.TypeNats
+ ( Nat, KnownNat, natVal )
+import Numeric.Natural
+ ( Natural )
+import System.Environment
+ ( getArgs )
+import System.Exit
+ ( die, exitFailure )
+import Text.Read
+ ( readMaybe )
+
+-- transformers
+import Control.Monad.Trans.Reader
+ ( ReaderT, runReaderT, ask, local )
+import Control.Monad.Trans.State.Strict
+ ( State, state, runState )
+
+--------------------------------------------------------------------------------
+-- Core framework
+
+newtype Gen a = Gen { runGen :: State Word64 a }
+ deriving newtype ( Functor, Applicative, Monad )
+
+class Arbitrary a where
+ arbitrary :: Gen a
+
+class IsProperty p where
+ property :: p -> Property
+
+data PropertyCheck
+ = PropertyBinaryOp Bool String String String
+ | PropertyAnd PropertyCheck PropertyCheck
+
+instance IsProperty PropertyCheck where
+ property check = Prop (pure (PropertyEOA check))
+
+data PropertyTestArg
+ = PropertyEOA PropertyCheck
+ | PropertyArg String PropertyTestArg
+
+getCheck :: PropertyTestArg -> ([String], PropertyCheck)
+getCheck (PropertyEOA pc) = ([], pc)
+getCheck (PropertyArg s pta) = let (ss, pc) = getCheck pta in (s:ss, pc)
+
+data Property = Prop { unProp :: Gen PropertyTestArg }
+
+instance (Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) where
+ property p = forAll arbitrary p
+
+-- | Run a generator for a value of the given type and add it as an argument
+-- to the property test.
+forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
+forAll generator tst = Prop $ do
+ a <- generator
+ augment a <$> unProp (property (tst a))
+ where
+ augment a arg = PropertyArg (show a) arg
+
+-- | Build a @PropertyCheck@ by comparing two values with a named predicate.
+propertyCompare :: Show a => String -> (a -> a -> Bool) -> a -> a -> PropertyCheck
+propertyCompare s f a b = PropertyBinaryOp (f a b) s (show a) (show b)
+
+-- | Check that two values are equal (by '==').
+(===) :: (Show a, Eq a) => a -> a -> PropertyCheck
+(===) = propertyCompare "==" (==)
+infix 4 ===
+
+-- | Conjunction of two property checks.
+propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck
+propertyAnd = PropertyAnd
+
+--------------------------------------------------------------------------------
+-- Test tree
+
+-- | A named test or group of tests.
+data Test where
+ Group :: String -> [Test] -> Test
+ Property :: IsProperty prop => String -> prop -> Test
+
+--------------------------------------------------------------------------------
+-- Test runner
+
+newtype Iterations = Iterations { nbIterations :: Word }
+ deriving newtype ( Show, Eq, Ord )
+
+-- | Outcome of running a test suite.
+data Result = Success | Failure [[String]]
+
+instance Semigroup Result where
+ Success <> y = y
+ x <> Success = x
+ Failure xs <> Failure ys = Failure (xs ++ ys)
+
+instance Monoid Result where
+ mempty = Success
+
+data RunS = RunS
+ { depth :: Int
+ , currentSeed :: Word64
+ , context :: [String]
+ }
+
+putMsg :: String -> ReaderT RunS IO ()
+putMsg s = do
+ n <- depth <$> ask
+ liftIO . putStrLn $ replicate (n * 2) ' ' ++ s
+
+nest :: String -> ReaderT RunS IO a -> ReaderT RunS IO a
+nest c = local (\s -> s { depth = depth s + 1, context = c : context s })
+
+runPropertyCheck :: PropertyCheck -> ReaderT RunS IO Result
+runPropertyCheck (PropertyBinaryOp ok desc s1 s2) =
+ if ok
+ then return Success
+ else do
+ ctx <- context <$> ask
+ let msg = "Failure: " ++ s1 ++ " " ++ desc ++ " " ++ s2
+ putMsg msg
+ return (Failure [msg : ctx])
+runPropertyCheck (PropertyAnd a b) =
+ (<>) <$> runPropertyCheck a <*> runPropertyCheck b
+
+runProperty :: Iterations -> Property -> ReaderT RunS IO Result
+runProperty (Iterations iters) (Prop p) = do
+ startingSeed <- currentSeed <$> ask
+ loop iters startingSeed
+ where
+ loop 0 _ = do
+ putMsg ("Passed " ++ show iters ++ " iterations")
+ return Success
+ loop n s = do
+ let (pt, s') = runState (runGen p) s
+ (ss, pc) = getCheck pt
+ res <- runPropertyCheck pc
+ case res of
+ Success -> loop (n - 1) s'
+ Failure msgs -> do
+ let msg = "With arguments " ++ intercalate ", " ss ++ " (Seed: " ++ show s ++ ")"
+ putMsg msg
+ return (Failure (map (msg :) msgs))
+
+-- | Run a single 'Test', accumulating all failures.
+runTestInternal :: Iterations -> Test -> ReaderT RunS IO Result
+runTestInternal iters (Group name tests) = do
+ let label = "Group " ++ name
+ putMsg label
+ env <- ask
+ nest label $ do
+ -- Compute initial seed for each test in the group, based on the
+ -- index of the test in the group.
+ let runOne idx t = do
+ let !s = snd $ stepLCG (currentSeed env + fromIntegral idx)
+ local (\e -> e { currentSeed = s }) (runTestInternal iters t)
+ mconcat <$> traverse (uncurry runOne) (zip [1..] tests)
+
+runTestInternal iters (Property name p) = do
+ let label = "Running " ++ name
+ putMsg label
+ nest label (runProperty iters (property p))
+
+showStack :: Int -> [String] -> String
+showStack _ [] = ""
+showStack n (s:ss) = replicate n ' ' ++ s ++ "\n" ++ showStack (n + 2) ss
+
+-- | Standard @main@ entry point for tests using 'MiniQuickCheck'.
+--
+-- Reads a 'Word64' seed from the first command-line argument, then
+-- delegates to 'runTests'.
+runTestsMain :: Iterations -> Test -> IO ()
+runTestsMain iters t = do
+ args <- getArgs
+ seed <- case args of
+ [arg] -> case readMaybe arg of
+ Just s -> pure s
+ Nothing -> die $ "Invalid seed: " ++ show arg
+ _ -> die "Usage: <test-name> <seed>"
+ runTests iters seed t
+
+runTests :: Iterations -> Word64 -> Test -> IO ()
+runTests iters seed t = do
+ res <- runReaderT (runTestInternal iters t) (RunS 0 seed [])
+ case res of
+ Success -> return ()
+ Failure tests -> do
+ putStrLn $ "Seed: " ++ show seed
+ putStrLn $ "These tests failed:\n"
+ ++ intercalate "\n" (map (showStack 0 . reverse) tests)
+ exitFailure
+
+--------------------------------------------------------------------------------
+-- Random number generation (linear congruences)
+
+-- Constants from Knuth's MMIX
+
+lcgMultiplier :: Word64
+lcgMultiplier = 6364136223846793005
+lcgIncrement :: Word64
+lcgIncrement = 1442695040888963407
+
+-- | Pure step function for the linear congruential generator
+stepLCG :: Word64 -> (Word64, Word64)
+stepLCG s =
+ let s' = s * lcgMultiplier + lcgIncrement
+ in (s', s')
+
+--------------------------------------------------------------------------------
+-- Primitive generators
+
+-- | Generate a uniformly random 'Word64'.
+arbitraryWord64 :: Gen Word64
+arbitraryWord64 = Gen $ state stepLCG
+
+-- | Generate a uniformly random 'Int64' (bit-reinterpretation of a Word64).
+arbitraryInt64 :: Gen Int64
+arbitraryInt64 = fromIntegral <$> arbitraryWord64
+
+-- | Shrink a random 'Int64' down to a smaller integral type.
+integralDownsize :: (Integral a, FiniteBits a) => Int64 -> a
+integralDownsize = wordDownsize . fromIntegral
+
+-- | Shrink a random 'Word64' down to a smaller integral type.
+wordDownsize :: forall a. (Integral a, FiniteBits a) => Word64 -> a
+wordDownsize w =
+ fromIntegral (w `shiftR` (64 - finiteBitSize (undefined :: a)))
+ -- take the higher bits (more random with our LCG)
+
+--------------------------------------------------------------------------------
+-- Basic Arbitrary instances
+
+instance Arbitrary Bool where
+ arbitrary = ( == 1 ) . ( `shiftR` 63 ) <$> arbitraryWord64
+
+instance Arbitrary Word64 where
+ arbitrary = arbitraryWord64
+instance Arbitrary Word32 where
+ arbitrary = wordDownsize <$> arbitraryWord64
+instance Arbitrary Word16 where
+ arbitrary = wordDownsize <$> arbitraryWord64
+instance Arbitrary Word8 where
+ arbitrary = wordDownsize <$> arbitraryWord64
+instance Arbitrary Word where
+ arbitrary = fromIntegral <$> arbitraryWord64
+
+instance Arbitrary Int64 where
+ arbitrary = arbitraryInt64
+instance Arbitrary Int32 where
+ arbitrary = integralDownsize <$> arbitraryInt64
+instance Arbitrary Int16 where
+ arbitrary = integralDownsize <$> arbitraryInt64
+instance Arbitrary Int8 where
+ arbitrary = integralDownsize <$> arbitraryInt64
+instance Arbitrary Int where
+ arbitrary = fromIntegral <$> arbitraryInt64
+
+-- | Generates a natural number with at most 192 bits set.
+instance Arbitrary Natural where
+ arbitrary = do
+ cx <- ( `shiftR` 62 ) <$> arbitraryWord64
+ n1 <- fromIntegral <$> arbitraryWord64
+ n2 <- fromIntegral <$> arbitraryWord64
+ n3 <- fromIntegral <$> arbitraryWord64
+
+ pure $ case cx of
+ 0 -> n1
+ 1 -> (n1 `shiftL` 64) .|. n2
+ _ -> (n1 `shiftL` 128) .|. (n2 `shiftL` 64) .|. n3
+
+-- | Generates an integer with at most 192 bits set.
+instance Arbitrary Integer where
+ arbitrary = do
+ nat <- arbitrary @Natural
+ neg <- arbitrary @Bool
+
+ pure $
+ if neg
+ then negate (fromIntegral nat)
+ else fromIntegral nat
+
+instance Arbitrary Char where
+ arbitrary = do
+ let high = fromIntegral (fromEnum (maxBound :: Char)) :: Word
+ x <- arbitrary
+ return (toEnum . fromIntegral $ x `mod` (high + 1))
+
+--------------------------------------------------------------------------------
+-- Useful newtypes for different Arbitrary instances
+
+-- | Wrapper for non-zero values.
+newtype NonZero a = NonZero { getNonZero :: a }
+ deriving (Eq, Ord, Bounded, Show)
+
+-- | Generator that rejects zero values.
+nonZero :: (Arbitrary a, Num a, Eq a) => Gen (NonZero a)
+nonZero = do
+ x <- arbitrary
+ if x == 0 then nonZero else pure (NonZero x)
+
+instance (Arbitrary a, Num a, Eq a) => Arbitrary (NonZero a) where
+ arbitrary = nonZero
+
+-- | Shift amount bounded to @[0, finiteBitSize - 1]@.
+newtype BoundedShiftAmount a = BoundedShiftAmount { getBoundedShiftAmount :: Int }
+ deriving (Eq, Ord, Show)
+
+instance FiniteBits a => Arbitrary (BoundedShiftAmount a) where
+ arbitrary = do
+ x <- arbitrary
+ let w = finiteBitSize (undefined :: a)
+ pure $ BoundedShiftAmount (abs x `mod` w)
+
+-- | @a `BoundedBy` n@ represents numbers with maximum absolute value @n@ (inclusive).
+type BoundedBy :: Type -> Nat -> Type
+newtype BoundedBy a n = BoundedBy { getBoundedBy :: a }
+ deriving (Eq, Ord, Show)
+
+instance
+ forall n a
+ . ( KnownNat n, Integral a, Arbitrary a )
+ => Arbitrary ( a `BoundedBy` n ) where
+ arbitrary = BoundedBy . (`rem` (n + 1)) <$> arbitrary
+ where
+ n :: a
+ n = fromIntegral $ natVal @n Proxy
=====================================
testsuite/tests/numeric/should_run/all.T
=====================================
@@ -3,8 +3,6 @@
# extra run flags
# expected process return value, if not zero
-import random
-
# some bugs only surface with -O, omitting optasm may cause them to
# slip into releases! (e.g. #26711)
setTestOpts(when(have_ncg(), extra_ways(['optasm'])))
@@ -89,7 +87,14 @@ test('T20291', normal, compile_and_run, [''])
test('T22282', normal, compile_and_run, [''])
test('T22671', js_fragile(24259), compile_and_run, [''])
# the high run timeout multiplier exists because of timeouts with the wasm backend
-test('foundation', [run_timeout_multiplier(4), js_fragile(24259), extra_ways(['optasm','ghci','ghci-opt']), extra_run_opts(str(random.getrandbits(64)))], compile_and_run, ['-fno-break-points'])
+test('foundation',
+ [ mini_quickcheck
+ , run_timeout_multiplier(4)
+ , js_fragile(24259)
+ , extra_ways(['optasm','ghci','ghci-opt'])
+ ]
+ , multimod_compile_and_run
+ , ['foundation', '-fno-break-points'])
test('T24066', normal, compile_and_run, [''])
test('div01', normal, compile_and_run, [''])
test('T24245', normal, compile_and_run, [''])
=====================================
testsuite/tests/numeric/should_run/foundation.hs
=====================================
@@ -23,252 +23,20 @@ module Main
( main
) where
-import Data.Array.Byte
-import Data.Bits (Bits((.&.), bit), FiniteBits, finiteBitSize)
-import Data.Word
+import Data.Bits (Bits((.&.), bit))
+import Data.Function (on)
import Data.Int
-import GHC.Natural
import Data.Typeable
+import Data.Word
import GHC.Int
-import GHC.Word
-import Data.Function
+import GHC.Natural
import GHC.Prim
-import Control.Monad.Reader
-import Data.List (intercalate)
-import System.Environment (getArgs)
-import Text.Read (readMaybe)
-import Unsafe.Coerce
import GHC.Types
-import Data.Char
-import System.Exit
-
+import GHC.Word
import qualified GHC.Internal.PrimopWrappers as Wrapper
-import qualified GHC.Internal.Prim as Primop
-
-newtype Gen a = Gen { runGen :: (ReaderT LCGGen IO a) }
- deriving newtype (Functor, Applicative, Monad)
-
-class Arbitrary a where
- arbitrary :: Gen a
-
-class IsProperty p where
- property :: p -> Property
+import qualified GHC.Internal.Prim as Primop
-data PropertyCheck = PropertyBinaryOp Bool String String String
- | PropertyAnd PropertyCheck PropertyCheck
-
-instance IsProperty PropertyCheck where
- property check = Prop $ pure (PropertyEOA check)
-
-data PropertyTestArg = PropertyEOA PropertyCheck
- | PropertyArg String PropertyTestArg
-
-getCheck :: PropertyTestArg -> ([String], PropertyCheck)
-getCheck (PropertyEOA pc) = ([], pc)
-getCheck (PropertyArg s pta ) = let (ss, pc) = getCheck pta in (s:ss, pc)
-
-data Property = Prop { unProp :: Gen PropertyTestArg }
-
-instance (Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) where
- property p = forAll arbitrary p
-
--- | Running a generator for a specific type under a property
-forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
-forAll generator tst = Prop $ do
- a <- generator
- augment a <$> unProp (property (tst a))
- where
- augment a arg = PropertyArg (show a) arg
-
--- | A property that check for equality of its 2 members.
-propertyCompare :: (Show a) => String -> (a -> a -> Bool) -> a -> a -> PropertyCheck
-propertyCompare s f a b =
- let sa = show a
- sb = show b
- in PropertyBinaryOp (a `f` b) s sa sb
-
-(===) :: (Show a, Eq a) => a -> a -> PropertyCheck
-(===) = propertyCompare "==" (==)
-infix 4 ===
-
-propertyAnd = PropertyAnd
-
-
-data Test where
- Group :: String -> [Test] -> Test
- Property :: IsProperty prop => String -> prop -> Test
-
-
-arbitraryInt64 :: Gen Int64
-arbitraryInt64 = Gen $ do
- h <- ask
- W64# w <- liftIO (randomWord64 h)
- return (I64# (unsafeCoerce# w))
-
-integralDownsize :: (Integral a) => Int64 -> a
-integralDownsize = fromIntegral
-
-wordDownsize :: (Integral a) => Word64 -> a
-wordDownsize = fromIntegral
-
-arbitraryWord64 :: Gen Word64
-arbitraryWord64 = Gen $ do
- h <- ask
- liftIO (randomWord64 h)
-
-nonZero :: (Arbitrary a, Num a, Eq a) => Gen (NonZero a)
-nonZero = do
- x <- arbitrary
- if x == 0 then nonZero else pure $ NonZero x
-
-newtype NonZero a = NonZero { getNonZero :: a }
- deriving (Eq,Ord,Bounded,Show)
-
-instance (Arbitrary a, Num a, Eq a) => Arbitrary (NonZero a) where
- arbitrary = nonZero
-
--- | A newtype for shift amounts that are bounded by @wordSize - 1@
-newtype BoundedShiftAmount a = BoundedShiftAmount {getBoundedShiftAmount :: Int}
- deriving (Eq, Ord, Show)
-
-instance (FiniteBits a) => Arbitrary (BoundedShiftAmount a) where
- arbitrary = do
- x <- arbitrary
- let widthBits = finiteBitSize (undefined :: a)
- pure $ BoundedShiftAmount (abs x `mod` widthBits)
-
-instance Arbitrary Natural where
- arbitrary = integralDownsize . (`mod` 10000) . abs <$> arbitraryInt64
-
--- Bounded by Int64
-instance Arbitrary Integer where
- arbitrary = fromIntegral <$> arbitraryInt64
-
-instance Arbitrary Int where
- arbitrary = int64ToInt <$> arbitraryInt64
-instance Arbitrary Word where
- arbitrary = word64ToWord <$> arbitraryWord64
-instance Arbitrary Word64 where
- arbitrary = arbitraryWord64
-instance Arbitrary Word32 where
- arbitrary = wordDownsize <$> arbitraryWord64
-instance Arbitrary Word16 where
- arbitrary = wordDownsize <$> arbitraryWord64
-instance Arbitrary Word8 where
- arbitrary = wordDownsize <$> arbitraryWord64
-instance Arbitrary Int64 where
- arbitrary = arbitraryInt64
-instance Arbitrary Int32 where
- arbitrary = integralDownsize <$> arbitraryInt64
-instance Arbitrary Int16 where
- arbitrary = integralDownsize <$> arbitraryInt64
-instance Arbitrary Int8 where
- arbitrary = integralDownsize <$> arbitraryInt64
-
-instance Arbitrary Char where
- arbitrary = do
- let high = fromIntegral $ fromEnum (maxBound :: Char) :: Word
- (x::Word) <- arbitrary
- let x' = mod x high
- return (chr $ fromIntegral x')
-
-int64ToInt :: Int64 -> Int
-int64ToInt (I64# i) = I# (int64ToInt# i)
-
-
-word64ToWord :: Word64 -> Word
-word64ToWord (W64# i) = W# (word64ToWord# i)
-
-
-data RunS = RunS { depth :: Int, rg :: LCGGen, context :: [String] }
-
-newtype LCGGen = LCGGen { randomWord64 :: IO Word64 }
-
-data LCGParams = LCGParams { seed :: Word64, a :: Word64, c :: Word64, m :: Word64 }
-
-newLCGGen :: LCGParams -> IO LCGGen
-newLCGGen LCGParams {seed = W64# seed#, ..} = do
- MutableByteArray mba# <- IO $ \s0 -> case newByteArray# 8# s0 of
- (# s1, mba# #) -> case writeWord64Array# mba# 0# seed# s1 of
- s2 -> (# s2, MutableByteArray mba# #)
- pure $ LCGGen $ IO $ \s0 -> case readWord64Array# mba# 0# s0 of
- (# s1, old_val# #) ->
- let old_val = W64# old_val#
- !new_val@(W64# new_val#) = (old_val * a + c) `mod` m
- in case writeWord64Array# mba# 0# new_val# s1 of
- s2 -> (# s2, new_val #)
-
-runPropertyCheck (PropertyBinaryOp res desc s1 s2) =
- if res then return Success
- else do
- ctx <- context <$> ask
- let msg = "Failure: " ++ s1 ++ desc ++ s2
- putMsg msg
- return (Failure [msg : ctx])
-runPropertyCheck (PropertyAnd a1 a2) = (<>) <$> runPropertyCheck a1 <*> runPropertyCheck a2
-
-runProperty :: Property -> ReaderT RunS IO Result
-runProperty (Prop p) = do
- let iterations = 1000 :: Int
- loop iterations iterations
- where
- loop iterations 0 = do
- putMsg ("Passed " ++ show iterations ++ " iterations")
- return Success
- loop iterations n = do
- h <- rg <$> ask
- p <- liftIO (runReaderT (runGen p) h)
- let (ss, pc) = getCheck p
- res <- runPropertyCheck pc
- case res of
- Success -> loop iterations (n-1)
- Failure msgs -> do
- let msg = ("With arguments " ++ intercalate ", " ss)
- putMsg msg
- return (Failure (map (msg :) msgs))
-
-data Result = Success | Failure [[String]]
-
-instance Semigroup Result where
- Success <> x = x
- x <> Success = x
- (Failure xs) <> (Failure ys) = Failure (xs ++ ys)
-
-instance Monoid Result where
- mempty = Success
-
-putMsg s = do
- n <- depth <$> ask
- liftIO . putStrLn $ replicate (n * 2) ' ' ++ s
-
-
-nest c = local (\s -> s { depth = depth s + 1, context = c : context s })
-
-runTestInternal :: Test -> ReaderT RunS IO Result
-runTestInternal (Group name tests) = do
- let label = ("Group " ++ name)
- putMsg label
- nest label (mconcat <$> mapM runTestInternal tests)
-runTestInternal (Property name p) = do
- let label = ("Running " ++ name)
- putMsg label
- nest label $ runProperty (property p)
-
-
-runTests :: Word64 -> Test -> IO ()
-runTests seed t = do
- -- These params are the same ones as glibc uses.
- h <- newLCGGen (LCGParams { seed, m = 2 ^ (31 :: Int), a = 1103515245, c = 12345 })
- res <- runReaderT (runTestInternal t) (RunS 0 h [])
- case res of
- Success -> return ()
- Failure tests -> do
- putStrLn $ "Seed: " ++ show seed
- putStrLn $ "These tests failed: \n" ++ intercalate " \n" (map (showStack 0 . reverse) tests)
- exitFailure
-
-showStack _ [] = ""
-showStack n (s:ss) = replicate n ' ' ++ s ++ "\n" ++ showStack (n + 2) ss
+import MiniQuickCheck
-------------------------------------------------------------------------------
@@ -325,8 +93,11 @@ testOperatorPrecedence _ = Group "Precedence"
, Property "+ and * (2)" $ \(a :: a) (b :: a) (c :: a) -> (a * b + c) === ((a * b) + c)
, Property "- and * (1)" $ \(a :: a) (b :: a) (c :: a) -> (a - b * c) === (a - (b * c))
, Property "- and * (2)" $ \(a :: a) (b :: a) (c :: a) -> (a * b - c) === ((a * b) - c)
- , Property "* and ^ (1)" $ \(a :: a) (b :: Natural) (c :: a) -> (a ^ b * c) === ((a ^ b) * c)
- , Property "* and ^ (2)" $ \(a :: a) (c :: Natural) (b :: a) -> (a * b ^ c) === (a * (b ^ c))
+
+ -- Bound the exponent to avoid OOM errors e.g.
+ -- GNU MP: Cannot allocate memory (size=4294938656)
+ , Property "* and ^ (1)" $ \(a :: a) (BoundedBy b :: Natural `BoundedBy` 100) (c :: a) -> (a ^ b * c) === ((a ^ b) * c)
+ , Property "* and ^ (2)" $ \(a :: a) (BoundedBy c :: Natural `BoundedBy` 100) (b :: a) -> (a * b ^ c) === (a * (b ^ c))
]
@@ -454,19 +225,8 @@ instance TestPrimop LowerBitsAreDefined where
twoNonZero :: (a -> a -> b) -> a -> NonZero a -> b
twoNonZero f x (NonZero y) = f x y
-getSeedFromArgs :: IO Word64
-getSeedFromArgs = do
- args <- getArgs
- case args of
- [arg] -> case readMaybe arg of
- Just seed -> pure seed
- Nothing -> die $ "Invalid seed (expected Word64): " ++ show arg
- _ -> die "Usage: foundation <seed>"
-
main :: IO ()
-main = do
- seed <- getSeedFromArgs
- runTests seed (Group "ALL" [testNumberRefs, testPrimops])
+main = runTestsMain (Iterations 1000) (Group "ALL" [testNumberRefs, testPrimops])
-- Test an interpreted primop vs a compiled primop
testPrimops = Group "primop"
=====================================
testsuite/tests/simd/should_run/all.T
=====================================
@@ -80,7 +80,7 @@ test('simd002', [], compile_and_run, [''])
test('simd003', [], compile_and_run, [''])
test('simd004', [], compile_and_run, ['-O2'])
test('simd005', [], compile_and_run, [''])
-test('simd006', [], compile_and_run, [''])
+test('simd006', [mini_quickcheck], multimod_compile_and_run, ['simd006', ''])
test('simd007', [], compile_and_run, [''])
test('simd008', [], compile_and_run, [''])
test('simd009', [ req_th
=====================================
testsuite/tests/simd/should_run/simd006.hs
=====================================
@@ -1,161 +1,79 @@
-{-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
-{-# LANGUAGE MagicHash #-}
-{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE ScopedTypeVariables #-}
--- QuickCheck testing for SIMD operations
+-- QuickCheck-like property tests for SIMD vector operations.
-module Main
- ( main
- ) where
+module Main (main) where
-import Data.Word
-import Data.Int
-import GHC.Natural
import Data.Coerce
-import Data.Typeable
-import Data.Proxy
-import GHC.Int
-import GHC.Word
-import Data.Function
+import Data.Word
import GHC.Prim
-import Control.Monad.Reader
-import System.IO
-import Foreign.Marshal.Alloc
-import Foreign.Storable
-import Foreign.Ptr
-import Data.List (intercalate)
-import Data.IORef
-import Unsafe.Coerce
import GHC.Exts
import GHC.Float
( castFloatToWord32 , castWord32ToFloat
, castDoubleToWord64, castWord64ToDouble
)
+import MiniQuickCheck
+--------------------------------------------------------------------------------
+-- Scalar wrappers that use bit-equality to test for equality.
-newtype Gen a = Gen { runGen :: (ReaderT LCGGen IO a) }
- deriving newtype (Functor, Applicative, Monad)
-
-class Arbitrary a where
- arbitrary :: Gen a
-
-class IsProperty p where
- property :: p -> Property
-
-data PropertyCheck = PropertyBinaryOp Bool String String String
- | PropertyAnd PropertyCheck PropertyCheck
-
-instance IsProperty PropertyCheck where
- property check = Prop $ pure (PropertyEOA check)
-
-data PropertyTestArg = PropertyEOA PropertyCheck
- | PropertyArg String PropertyTestArg
-
-getCheck :: PropertyTestArg -> ([String], PropertyCheck)
-getCheck (PropertyEOA pc) = ([], pc)
-getCheck (PropertyArg s pta ) = let (ss, pc) = getCheck pta in (s:ss, pc)
-
-data Property = Prop { unProp :: Gen PropertyTestArg }
-
-instance (Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) where
- property p = forAll arbitrary p
-
--- | Running a generator for a specific type under a property
-forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
-forAll generator tst = Prop $ do
- a <- generator
- augment a <$> unProp (property (tst a))
- where
- augment a arg = PropertyArg (show a) arg
-
--- | A property that check for equality of its 2 members.
-propertyCompare :: (Show a) => String -> (a -> a -> Bool) -> a -> a -> PropertyCheck
-propertyCompare s f a b =
- let sa = show a
- sb = show b
- in PropertyBinaryOp (a `f` b) s sa sb
-
-(===) :: (Show a, Eq a) => a -> a -> PropertyCheck
-(===) = propertyCompare "==" (==)
-infix 4 ===
-
-propertyAnd = PropertyAnd
-
-
-data Test where
- Group :: String -> [Test] -> Test
- Property :: IsProperty prop => String -> prop -> Test
-
+newtype FloatNT = FloatNT Float
+ deriving newtype (Show, Num)
-arbitraryInt64 :: Gen Int64
-arbitraryInt64 = Gen $ do
- h <- ask
- W64# w <- liftIO (randomWord64 h)
- return (I64# (unsafeCoerce# w))
+instance Eq FloatNT where
+ FloatNT f1 == FloatNT f2 = castFloatToWord32 f1 == castFloatToWord32 f2
-integralDownsize :: (Integral a) => Int64 -> a
-integralDownsize = fromIntegral
+instance Arbitrary FloatNT where
+ arbitrary = FloatNT . castWord32ToFloat <$> arbitrary
-wordDownsize :: (Integral a) => Word64 -> a
-wordDownsize = fromIntegral
+newtype DoubleNT = DoubleNT Double
+ deriving newtype (Show, Num)
-arbitraryWord64 :: Gen Word64
-arbitraryWord64 = Gen $ do
- h <- ask
- liftIO (randomWord64 h)
+instance Eq DoubleNT where
+ DoubleNT d1 == DoubleNT d2 = castDoubleToWord64 d1 == castDoubleToWord64 d2
+instance Arbitrary DoubleNT where
+ arbitrary = DoubleNT . castWord64ToDouble <$> arbitrary
-instance Arbitrary Word64 where
- arbitrary = arbitraryWord64
-instance Arbitrary Word32 where
- arbitrary = wordDownsize <$> arbitraryWord64
+--------------------------------------------------------------------------------
+-- Min/max for the types under test
class HasMinMax a where
mini, maxi :: a -> a -> a
+
instance HasMinMax FloatNT where
mini (FloatNT (F# f1)) (FloatNT (F# f2)) = FloatNT (F# (minFloat# f1 f2))
maxi (FloatNT (F# f1)) (FloatNT (F# f2)) = FloatNT (F# (maxFloat# f1 f2))
+
instance HasMinMax DoubleNT where
mini (DoubleNT (D# d1)) (DoubleNT (D# d2)) = DoubleNT (D# (minDouble# d1 d2))
maxi (DoubleNT (D# d1)) (DoubleNT (D# d2)) = DoubleNT (D# (maxDouble# d1 d2))
-newtype FloatNT = FloatNT Float
- deriving newtype (Show, Num)
-instance Eq FloatNT where
- FloatNT f1 == FloatNT f2 =
- castFloatToWord32 f1 == castFloatToWord32 f2
-instance Arbitrary FloatNT where
- arbitrary = FloatNT . castWord32ToFloat <$> arbitrary
-newtype DoubleNT = DoubleNT Double
- deriving newtype (Show, Num)
-instance Eq DoubleNT where
- DoubleNT d1 == DoubleNT d2 =
- castDoubleToWord64 d1 == castDoubleToWord64 d2
-instance Arbitrary DoubleNT where
- arbitrary = DoubleNT . castWord64ToDouble <$> arbitrary
-
+--------------------------------------------------------------------------------
+-- SIMD vector types
data FloatX4 = FX4# FloatX4#
+
instance Show FloatX4 where
- show (FX4# f) = case (unpackFloatX4# f) of
- (# a, b, c, d #) -> show ((F# a), (F# b), (F# c), (F# d))
+ show (FX4# f) = case unpackFloatX4# f of
+ (# a, b, c, d #) -> show (F# a, F# b, F# c, F# d)
+
instance Eq FloatX4 where
- (FX4# a) == (FX4# b)
- = case (unpackFloatX4# a) of
+ FX4# a == FX4# b
+ = case unpackFloatX4# a of
(# a1, a2, a3, a4 #) ->
- case (unpackFloatX4# b) of
- (# b1, b2, b3, b4 #) -> FloatNT (F# a1) == FloatNT (F# b1) &&
- FloatNT (F# a2) == FloatNT (F# b2) &&
- FloatNT (F# a3) == FloatNT (F# b3) &&
- FloatNT (F# a4) == FloatNT (F# b4)
+ case unpackFloatX4# b of
+ (# b1, b2, b3, b4 #) ->
+ FloatNT (F# a1) == FloatNT (F# b1) &&
+ FloatNT (F# a2) == FloatNT (F# b2) &&
+ FloatNT (F# a3) == FloatNT (F# b3) &&
+ FloatNT (F# a4) == FloatNT (F# b4)
+
instance Arbitrary FloatX4 where
arbitrary = do
FloatNT (F# f1) <- arbitrary
@@ -163,52 +81,59 @@ instance Arbitrary FloatX4 where
FloatNT (F# f3) <- arbitrary
FloatNT (F# f4) <- arbitrary
return $ FX4# (packFloatX4# (# f1, f2, f3, f4 #))
+
instance Num FloatX4 where
- FX4# x + FX4# y =
- FX4# ( x `plusFloatX4#` y )
- FX4# x - FX4# y =
- FX4# ( x `minusFloatX4#` y )
- negate ( FX4# x ) = FX4# ( negateFloatX4# x )
- FX4# x * FX4# y =
- FX4# ( x `timesFloatX4#` y )
- abs = error "no"
- signum = error "no"
- fromInteger = error "no"
+ FX4# x + FX4# y = FX4# (x `plusFloatX4#` y)
+ FX4# x - FX4# y = FX4# (x `minusFloatX4#` y)
+ negate (FX4# x) = FX4# (negateFloatX4# x)
+ FX4# x * FX4# y = FX4# (x `timesFloatX4#` y)
+ abs = error "FloatX4: no abs"
+ signum = error "FloatX4: no signum"
+ fromInteger = error "FloatX4: no fromInteger"
+
instance HasMinMax FloatX4 where
mini (FX4# a) (FX4# b) = FX4# (minFloatX4# a b)
maxi (FX4# a) (FX4# b) = FX4# (maxFloatX4# a b)
+--------------------------------------------------------------------------------
+
data DoubleX2 = DX2# DoubleX2#
+
instance Show DoubleX2 where
- show (DX2# d) = case (unpackDoubleX2# d) of
- (# a, b #) -> show ((D# a), (D# b))
+ show (DX2# d) = case unpackDoubleX2# d of
+ (# a, b #) -> show (D# a, D# b)
+
instance Eq DoubleX2 where
- (DX2# a) == (DX2# b)
- = case (unpackDoubleX2# a) of
+ DX2# a == DX2# b
+ = case unpackDoubleX2# a of
(# a1, a2 #) ->
- case (unpackDoubleX2# b) of
- (# b1, b2 #) -> DoubleNT (D# a1) == DoubleNT (D# b1) &&
- DoubleNT (D# a2) == DoubleNT (D# b2)
+ case unpackDoubleX2# b of
+ (# b1, b2 #) ->
+ DoubleNT (D# a1) == DoubleNT (D# b1) &&
+ DoubleNT (D# a2) == DoubleNT (D# b2)
+
instance Arbitrary DoubleX2 where
arbitrary = do
DoubleNT (D# d1) <- arbitrary
DoubleNT (D# d2) <- arbitrary
return $ DX2# (packDoubleX2# (# d1, d2 #))
+
instance Num DoubleX2 where
- DX2# x + DX2# y =
- DX2# ( x `plusDoubleX2#` y )
- DX2# x - DX2# y =
- DX2# ( x `minusDoubleX2#` y )
- negate ( DX2# x ) = DX2# ( negateDoubleX2# x )
- DX2# x * DX2# y =
- DX2# ( x `timesDoubleX2#` y )
- abs = error "no"
- signum = error "no"
- fromInteger = error "no"
+ DX2# x + DX2# y = DX2# (x `plusDoubleX2#` y)
+ DX2# x - DX2# y = DX2# (x `minusDoubleX2#` y)
+ negate (DX2# x) = DX2# (negateDoubleX2# x)
+ DX2# x * DX2# y = DX2# (x `timesDoubleX2#` y)
+ abs = error "DoubleX2: no abs"
+ signum = error "DoubleX2: no signum"
+ fromInteger = error "DoubleX2: no fromInteger"
+
instance HasMinMax DoubleX2 where
mini (DX2# a) (DX2# b) = DX2# (minDoubleX2# a b)
maxi (DX2# a) (DX2# b) = DX2# (maxDoubleX2# a b)
+--------------------------------------------------------------------------------
+-- Expression language for generating random expressions over vector types.
+
data Expr a where
Lit :: a -> Expr a
Add :: Expr a -> Expr a -> Expr a
@@ -218,11 +143,12 @@ data Expr a where
Min :: Expr a -> Expr a -> Expr a
Max :: Expr a -> Expr a -> Expr a
deriving (Show, Eq)
+
fmapExpr :: (a -> b) -> Expr a -> Expr b
-fmapExpr f (Lit a) = Lit (f a)
+fmapExpr f (Lit a) = Lit (f a)
fmapExpr f (Add a b) = Add (fmapExpr f a) (fmapExpr f b)
fmapExpr f (Sub a b) = Sub (fmapExpr f a) (fmapExpr f b)
-fmapExpr f (Neg a) = Neg (fmapExpr f a)
+fmapExpr f (Neg a) = Neg (fmapExpr f a)
fmapExpr f (Mul a b) = Mul (fmapExpr f a) (fmapExpr f b)
fmapExpr f (Min a b) = Min (fmapExpr f a) (fmapExpr f b)
fmapExpr f (Max a b) = Max (fmapExpr f a) (fmapExpr f b)
@@ -240,75 +166,16 @@ instance Arbitrary a => Arbitrary (Expr a) where
_ -> Lit <$> arbitrary
eval :: (Num a, HasMinMax a) => Expr a -> a
-eval (Lit a) = a
+eval (Lit a) = a
eval (Add a b) = eval a + eval b
eval (Sub a b) = eval a - eval b
-eval (Neg a) = negate (eval a)
+eval (Neg a) = negate (eval a)
eval (Mul a b) = eval a * eval b
eval (Min a b) = mini (eval a) (eval b)
eval (Max a b) = maxi (eval a) (eval b)
-int64ToInt :: Int64 -> Int
-int64ToInt (I64# i) = I# (int64ToInt# i)
-
-
-word64ToWord :: Word64 -> Word
-word64ToWord (W64# i) = W# (word64ToWord# i)
-
-
-data RunS = RunS { depth :: Int, rg :: LCGGen }
-
-newtype LCGGen = LCGGen { randomWord64 :: IO Word64 }
-
-data LCGParams = LCGParams { seed :: Word64, a :: Word64, c :: Word64, m :: Word64 }
-
-newLCGGen :: LCGParams -> IO LCGGen
-newLCGGen LCGParams{..} = do
- var <- newIORef (fromIntegral seed)
- return $ LCGGen $ do
- atomicModifyIORef' var (\old_v -> let new_val = (old_v * a + c) `mod` m in (new_val, new_val))
-
-
-runPropertyCheck (PropertyBinaryOp res desc s1 s2) =
- if res then return True else (putMsg ("Failure: " ++ s1 ++ desc ++ s2) >> return False)
-runPropertyCheck (PropertyAnd a1 a2) = (&&) <$> runPropertyCheck a1 <*> runPropertyCheck a2
-
-runProperty :: Property -> ReaderT RunS IO ()
-runProperty (Prop p) = do
- let iterations = 100
- loop iterations iterations
- where
- loop iterations 0 = putMsg ("Passed " ++ show iterations ++ " iterations")
- loop iterations n = do
- h <- rg <$> ask
- p <- liftIO (runReaderT (runGen p) h)
- let (ss, pc) = getCheck p
- res <- runPropertyCheck pc
- if res then loop iterations (n-1)
- else putMsg ("With arguments " ++ intercalate ", " ss)
-
-putMsg s = do
- n <- depth <$> ask
- liftIO . putStrLn $ replicate (n * 2) ' ' ++ s
-
-nest = local (\s -> s { depth = depth s + 1 })
-
-runTestInternal :: Test -> ReaderT RunS IO ()
-runTestInternal (Group name tests) = do
- putMsg ("Group " ++ name)
- nest (mapM_ runTestInternal tests)
-runTestInternal (Property name p) = do
- putMsg ("Running " ++ name)
- nest $ runProperty (property p)
-
-
-runTests :: Test -> IO ()
-runTests t = do
- -- These params are the same ones as glibc uses.
- h <- newLCGGen (LCGParams { seed = 1238123213, m = 2^31, a = 1103515245, c = 12345 })
- runReaderT (runTestInternal t) (RunS 0 h)
-
--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+-- Test groups
testFloatX4 :: Test
testFloatX4 = Group "FloatX4"
@@ -324,15 +191,12 @@ testFloatX4 = Group "FloatX4"
unpack :: FloatX4 -> ( FloatNT, FloatNT, FloatNT, FloatNT )
unpack (FX4# f) = case unpackFloatX4# f of
(# f1, f2, f3, f4 #) -> coerce ( F# f1, F# f2, F# f3, F# f4 )
+
get1, get2, get3, get4 :: FloatX4 -> FloatNT
- get1 (FX4# f) = case unpackFloatX4# f of
- (# f1, _, _, _ #) -> FloatNT (F# f1)
- get2 (FX4# f) = case unpackFloatX4# f of
- (# _, f2, _, _ #) -> FloatNT (F# f2)
- get3 (FX4# f) = case unpackFloatX4# f of
- (# _, _, f3, _ #) -> FloatNT (F# f3)
- get4 (FX4# f) = case unpackFloatX4# f of
- (# _, _, _, f4 #) -> FloatNT (F# f4)
+ get1 (FX4# f) = case unpackFloatX4# f of (# f1, _, _, _ #) -> FloatNT (F# f1)
+ get2 (FX4# f) = case unpackFloatX4# f of (# _, f2, _, _ #) -> FloatNT (F# f2)
+ get3 (FX4# f) = case unpackFloatX4# f of (# _, _, f3, _ #) -> FloatNT (F# f3)
+ get4 (FX4# f) = case unpackFloatX4# f of (# _, _, _, f4 #) -> FloatNT (F# f4)
testDoubleX2 :: Test
testDoubleX2 = Group "DoubleX2"
@@ -346,16 +210,15 @@ testDoubleX2 = Group "DoubleX2"
unpack :: DoubleX2 -> ( DoubleNT, DoubleNT )
unpack (DX2# d) = case unpackDoubleX2# d of
(# d1, d2 #) -> coerce ( D# d1, D# d2 )
+
get1, get2 :: DoubleX2 -> DoubleNT
get1 (DX2# d) = case unpackDoubleX2# d of
- (# d1, _ #) -> DoubleNT (D# d1)
+ (# d1, _ #) -> DoubleNT (D# d1)
get2 (DX2# d) = case unpackDoubleX2# d of
- (# _, d2 #) -> DoubleNT (D# d2)
+ (# _, d2 #) -> DoubleNT (D# d2)
testSIMD :: Test
-testSIMD = Group "ALL"
- [ testFloatX4
- , testDoubleX2
- ]
+testSIMD = Group "ALL" [testFloatX4, testDoubleX2]
-main = runTests testSIMD
+main :: IO ()
+main = runTestsMain (Iterations 100) testSIMD
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b44d4322cb7e8a87259336ab7e06d9…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b44d4322cb7e8a87259336ab7e06d9…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] contributing: adjust MR template to be less verbose
by Marge Bot (@marge-bot) 24 Apr '26
by Marge Bot (@marge-bot) 24 Apr '26
24 Apr '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
4ed78760 by mangoiv at 2026-04-24T08:25:13-04:00
contributing: adjust MR template to be less verbose
- MR template only shows text that is relevant for submissiong
- MR template was rewritten so it's readable from a user's and reviewer's
perspective
Resolves #27165
Co-Authored-By: @sheaf
- - - - -
1 changed file:
- .gitlab/merge_request_templates/Default.md
Changes:
=====================================
.gitlab/merge_request_templates/Default.md
=====================================
@@ -1,43 +1,47 @@
+
+<!--
Thank you for your contribution to GHC!
-**Please read the checklist below to make sure your contribution fulfills these
-expectations. Also please answer the following question in your MR description:**
-
-**Where is the key part of this patch? That is, what should reviewers look at first?**
-
-Please take a few moments to address the following points:
-
- * [ ] if your MR touches `base` (or touches parts of `ghc-internal` used
- or re-exported by `base`) more substantially than just amending comments
- or documentation, you likely need to raise a
- [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package)
- before merging it.
- * [ ] if your MR may break existing programs (e.g. causes the
- compiler to reject programs), please describe the expected breakage and add
- the ~"user-facing" label. This will run ghc/head.hackage> to characterise
- the effect of your change on Hackage.
- * [ ] ensure that your commits are either individually buildable or squashed
- * [ ] ensure that your commit messages describe *what they do*
- (referring to tickets using `#NNNN` syntax when appropriate)
- * [ ] have added source comments describing your change. For larger changes you
- likely should add a [Note][notes] and cross-reference it from the relevant
- places.
- * [ ] add a [testcase to the testsuite][adding test].
- * [ ] updates the users guide if applicable
- * [ ] add a changelog entry in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
- If this MR does not need a changelog entry, apply the ~"no-changelog" label.
+Please read the checklist below to make sure your contribution fulfills these
+expectations.
If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
-title with `WIP:`.
+title with Draft:
+
+To make your contribution experience as smooth as possible, also check out
+https://gitlab.haskell.org/ghc/ghc/-/wikis/Contributing-a-Patch
+-->
+
+## Changes contained in this patch
+<!-- Where is the key part of this patch? That is, what should reviewers look at first? -->
+
+
+## MR Checklist
+<!-- Please take a few moments to address the following points: -->
+
+- [ ] This MR solves the problem described in the following issue: <!-- issue number here (please open a new issue if there isn't one) -->
+- [ ] A changelog entry was added in `changelog.d/` for user-facing changes (see [changelog guide][changelog]).
+ If this MR does not need a changelog entry, the ~"no-changelog" label was applied.
+- [ ] This MR does not make any significant changes to `base`, or it has an accompanying [CLC proposal](https://github.com/haskell/core-libraries-committee#base-package).
+- [ ] If this MR has the potential to break user programs, the ~"user-facing" label was applied to
+ test against head.hackage.
+- [ ] All commits are either individually buildable or squashed.
+- [ ] Commit messages describe *what they do*, referring to tickets using `#NNNNN` syntax.
+- [ ] Source comments describing the change were added. For larger changes [notes][notes] and
+ cross-references from the relevant places were added (as applicable).
+- [ ] [Testcases to the testsuite][adding test] were added (as applicable).
+- [ ] The users guide was updated (as applicable).
+<!--
By default a minimal validation pipeline is run on each merge request, the ~full-ci
label can be applied to perform additional validation checks if your MR affects a more
unusual configuration.
-Once your change is ready please remove the `WIP:` tag and wait for review. If
+Once your change is ready please remove the `Draft:` tag and wait for review. If
no one has offered a review in a few days then please leave a comment mentioning
@triagers and apply the ~"Blocked on Review" label.
+-->
[notes]: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/coding-style#comments-i…
[adding test]: https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/adding
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ed78760a5e1c303b0bb7bbf111dff5…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ed78760a5e1c303b0bb7bbf111dff5…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] compiler: avoid unused temporary `appendFS` operands
by Marge Bot (@marge-bot) 24 Apr '26
by Marge Bot (@marge-bot) 24 Apr '26
24 Apr '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
5574ee10 by Cheng Shao at 2026-04-24T08:24:30-04:00
compiler: avoid unused temporary `appendFS` operands
This patch fixes unused temporary `appendFS` operands in the codebase
that are retained in the `FastString` table after concatenation.
Rewrite rules are added so that if an operand is
`fsLit`/`mkFastString`, the `appendFS` application is rewritten to
append the `ShortByteString` operands first. The patch also fixes
`sconcat` behavior to align with `mconcat` for the same reason. Fixes #27205.
- - - - -
1 changed file:
- compiler/GHC/Data/FastString.hs
Changes:
=====================================
compiler/GHC/Data/FastString.hs
=====================================
@@ -139,6 +139,7 @@ import Foreign.C
import System.IO
import Data.Data
import Data.IORef
+import qualified Data.List.NonEmpty as NE
import Data.Semigroup as Semi
import Foreign
@@ -232,6 +233,7 @@ instance IsString FastString where
instance Semi.Semigroup FastString where
(<>) = appendFS
+ sconcat = concatFS . NE.toList
instance Monoid FastString where
mempty = nilFS
@@ -619,6 +621,42 @@ unpackFS fs = utf8DecodeShortByteString $ fs_sbs fs
zEncodeFS :: FastString -> FastZString
zEncodeFS fs = fs_zenc fs
+-- Sometimes an `appendFS` operand is temporarily constructed, and we
+-- should avoid retaining the unused `FastString` operand in the
+-- table. The RULES below mitigate the issue by concatenating the
+-- `ShortByteString`s instead when an operand is `fsLit` or
+-- `mkFastString`, which cover most such `appendFS` use cases. See
+-- #27205.
+
+{-# RULES
+"appendFS/fsLit y" forall x y.
+ appendFS x (fsLit y) =
+ mkFastStringShortByteString $
+ fs_sbs x Semi.<> utf8EncodeShortByteString y
+ #-}
+
+{-# RULES
+"appendFS/fsLit x" forall x y.
+ appendFS (fsLit x) y =
+ mkFastStringShortByteString $
+ utf8EncodeShortByteString x Semi.<> fs_sbs y
+ #-}
+
+{-# RULES
+"appendFS/mkFastString y" forall x y.
+ appendFS x (mkFastString y) =
+ mkFastStringShortByteString $
+ fs_sbs x Semi.<> utf8EncodeShortByteString y
+ #-}
+
+{-# RULES
+"appendFS/mkFastString x" forall x y.
+ appendFS (mkFastString x) y =
+ mkFastStringShortByteString $
+ utf8EncodeShortByteString x Semi.<> fs_sbs y
+ #-}
+
+{-# INLINE[1] appendFS #-}
appendFS :: FastString -> FastString -> FastString
appendFS fs1 fs2 = mkFastStringShortByteString
$ (Semi.<>) (fs_sbs fs1) (fs_sbs fs2)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5574ee101d22fa61d90f9d4d4a71be8…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5574ee101d22fa61d90f9d4d4a71be8…
You're receiving this email because of your account on gitlab.haskell.org.
1
0