[Git][ghc/ghc][wip/T23034] 32 commits: Make flip representation polymorphic, similar to ($) and (&)
Peter Trommler (@trommler)
gitlab at gitlab.haskell.org
Fri Jun 21 10:18:28 UTC 2024
Peter Trommler pushed to branch wip/T23034 at Glasgow Haskell Compiler / GHC
Commits:
e0099721 by Andrew Lelechenko at 2024-06-16T17:57:38-04:00
Make flip representation polymorphic, similar to ($) and (&)
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/245
- - - - -
118a1292 by Alan Zimmerman at 2024-06-16T17:58:15-04:00
EPA: Add location to Match Pats list
So we can freely modify the pats and the following item spacing will
still be valid when exact printing.
Closes #24862
- - - - -
db343324 by Fabricio de Sousa Nascimento at 2024-06-17T10:01:51-04:00
compiler: Rejects RULES whose LHS immediately fails to type-check
Fixes GHC crashing on `decomposeRuleLhs` due to ignoring coercion values. This
happens when we have a RULE that does not type check, and enable
`-fdefer-type-errors`. We prevent this to happen by rejecting RULES with an
immediately LHS type error.
Fixes #24026
- - - - -
e7a95662 by Dylan Thinnes at 2024-06-17T10:02:35-04:00
Add hscTypecheckRenameWithDiagnostics, for HLS (#24996)
Use runHsc' in runHsc so that both functions can't fall out of sync
We're currently copying parts of GHC code to get structured warnings
in HLS, so that we can recreate `hscTypecheckRenameWithDiagnostics`
locally. Once we get this function into GHC we can drop the copied code
in future versions of HLS.
- - - - -
d70abb49 by sheaf at 2024-06-18T18:47:20-04:00
Clarify -XGADTs enables existential quantification
Even though -XGADTs does not turn on -XExistentialQuantification,
it does allow the user of existential quantification syntax, without
needing to use GADT-style syntax.
Fixes #20865
- - - - -
13fdf788 by David Binder at 2024-06-18T18:48:02-04:00
Add RTS flag --read-tix-file (GHC Proposal 612)
This commit introduces the RTS flag `--read-tix-file=<yes|no>` which
controls whether a preexisting .tix file is read in at the beginning
of a program run. The default is currently `--read-tix-file=yes` but
will change to `--read-tix-file=no` in a future release of GHC. For
this reason, whenever a .tix file is read in a warning is emitted to
stderr. This warning can be silenced by explicitly passing the
`--read-tix-file=yes` option. Details can be found in the GHC proposal
cited below.
Users can query whether this flag has been used with the help of the
module `GHC.RTS.Flags`. A new field `readTixFile` was added to the
record `HpcFlags`.
These changes have been discussed and approved in
- GHC proposal 612: https://github.com/ghc-proposals/ghc-proposals/pull/612
- CLC proposal 276: https://github.com/haskell/core-libraries-committee/issues/276
- - - - -
f0e3cb6a by Fendor at 2024-06-18T18:48:38-04:00
Improve sharing of duplicated values in `ModIface`, fixes #24723
As a `ModIface` often contains duplicated values that are not
necessarily shared, we improve sharing by serialising the `ModIface`
to an in-memory byte array. Serialisation uses deduplication tables, and
deserialisation implicitly shares duplicated values.
This helps reducing the peak memory usage while compiling in
`--make` mode. The peak memory usage is especially smaller when
generating interface files with core expressions
(`-fwrite-if-simplified-core`).
On agda, this reduces the peak memory usage:
* `2.2 GB` to `1.9 GB` for a ghci session.
On `lib:Cabal`, we report:
* `570 MB` to `500 MB` for a ghci session
* `790 MB` to `667 MB` for compiling `lib:Cabal` with ghc
There is a small impact on execution time, around 2% on the agda code
base.
- - - - -
1bab7dde by Fendor at 2024-06-18T18:48:38-04:00
Avoid unneccessarily re-serialising the `ModIface`
To reduce memory usage of `ModIface`, we serialise `ModIface` to an
in-memory byte array, which implicitly shares duplicated values.
This serialised byte array can be reused to avoid work when we actually
write the `ModIface` to disk.
We introduce a new field to `ModIface` which allows us to save the byte
array, and write it direclty to disk if the `ModIface` wasn't changed
after the initial serialisation.
This requires us to change absolute offsets, for example to jump to the
deduplication table for `Name` or `FastString` with relative offsets, as
the deduplication byte array doesn't contain header information, such as
fingerprints.
To allow us to dump the binary blob to disk, we need to replace all
absolute offsets with relative ones.
We introduce additional helpers for `ModIface` binary serialisation, which
construct relocatable binary blobs. We say the binary blob is relocatable,
if the binary representation can be moved and does not contain any
absolute offsets.
Further, we introduce new primitives for `Binary` that allow to create
relocatable binaries, such as `forwardGetRel` and `forwardPutRel`.
-------------------------
Metric Decrease:
MultiLayerModulesDefsGhcWithCore
Metric Increase:
MultiComponentModules
MultiLayerModules
T10421
T12150
T12234
T12425
T13035
T13253-spj
T13701
T13719
T14697
T15703
T16875
T18698b
T18140
T18304
T18698a
T18730
T18923
T20049
T24582
T5837
T6048
T9198
T9961
mhu-perf
-------------------------
These metric increases may look bad, but they are all completely benign,
we simply allocate 1 MB per module for `shareIface`. As this allocation
is quite quick, it has a negligible impact on run-time performance.
In fact, the performance difference wasn't measurable on my local
machine. Reducing the size of the pre-allocated 1 MB buffer avoids these
test failures, but also requires us to reallocate the buffer if the
interface file is too big. These reallocations *did* have an impact on
performance, which is why I have opted to accept all these metric
increases, as the number of allocated bytes is merely a guidance.
This 1MB allocation increase causes a lot of tests to fail that
generally have a low allocation number. E.g., increasing from 40MB to
41MB is a 2.5% increase.
In particular, the tests T12150, T13253-spj, T18140, T18304, T18698a,
T18923, T20049, T24582, T5837, T6048, and T9961 only fail on i386-darwin
job, where the number of allocated bytes seems to be lower than in other
jobs.
The tests T16875 and T18698b fail on i386-linux for the same reason.
- - - - -
099992df by Andreas Klebinger at 2024-06-18T18:49:14-04:00
Improve documentation of @Any@ type.
In particular mention possible uses for non-lifted types.
Fixes #23100.
- - - - -
5e75412b by Jakob Bruenker at 2024-06-18T18:49:51-04:00
Update user guide to indicate support for 64-tuples
- - - - -
4f5da595 by Andreas Klebinger at 2024-06-18T18:50:28-04:00
lint notes: Add more info to notes.stdout
When fixing a note reference CI fails with a somewhat confusing diff.
See #21123. This commit adds a line to the output file being compared
which hopefully makes it clear this is the list of broken refs, not all
refs.
Fixes #21123
- - - - -
1eb15c61 by Jakob Bruenker at 2024-06-18T18:51:04-04:00
docs: Update mention of ($) type in user guide
Fixes #24909
- - - - -
1d66c9e3 by Jan Hrček at 2024-06-18T18:51:47-04:00
Remove duplicate Anno instances
- - - - -
8ea0ba95 by Sven Tennie at 2024-06-18T18:52:23-04:00
AArch64: Delete unused RegNos
This has the additional benefit of getting rid of the -1 encoding (real
registers start at 0.)
- - - - -
325422e0 by Sjoerd Visscher at 2024-06-18T18:53:04-04:00
Bump stm submodule to current master
- - - - -
64fba310 by Cheng Shao at 2024-06-18T18:53:40-04:00
testsuite: bump T17572 timeout on wasm32
- - - - -
eb612fbc by Sven Tennie at 2024-06-19T06:46:00-04:00
AArch64: Simplify BL instruction
The BL constructor carried unused data in its third argument.
- - - - -
b0300503 by Alan Zimmerman at 2024-06-19T06:46:36-04:00
TTG: Move SourceText from `Fixity` to `FixitySig`
It is only used there, simplifies the use of `Fixity` in the rest of
the code, and is moved into a TTG extension point.
Precedes !12842, to simplify it
- - - - -
842e119b by Rodrigo Mesquita at 2024-06-19T06:47:13-04:00
base: Deprecate some .Internal modules
Deprecates the following modules according to clc-proposal #217:
https://github.com/haskell/core-libraries-committee/issues/217
* GHC.TypeNats.Internal
* GHC.TypeLits.Internal
* GHC.ExecutionStack.Internal
Closes #24998
- - - - -
24e89c40 by Jacco Krijnen at 2024-06-20T07:21:27-04:00
ttg: Use List instead of Bag in AST for LHsBindsLR
Considering that the parser used to create a Bag of binds using a
cons-based approach, it can be also done using lists. The operations in
the compiler don't really require Bag.
By using lists, there is no dependency on GHC.Data.Bag anymore from the
AST.
Progress towards #21592
- - - - -
04f5bb85 by Simon Peyton Jones at 2024-06-20T07:22:03-04:00
Fix untouchability test
This MR fixes #24938. The underlying problem was tha the test for
"does this implication bring in scope any equalities" was plain wrong.
See
Note [Tracking Given equalities] and
Note [Let-bound skolems]
both in GHC.Tc.Solver.InertSet.
Then
* Test LocalGivenEqs succeeds for a different reason than before;
see (LBS2) in Note [Let-bound skolems]
* New test T24938a succeeds because of (LBS2), whereas it failed
before.
* Test LocalGivenEqs2 now fails, as it should.
* Test T224938, the repro from the ticket, fails, as it should.
- - - - -
9a757a27 by Simon Peyton Jones at 2024-06-20T07:22:40-04:00
Fix demand signatures for join points
This MR tackles #24623 and #23113
The main change is to give a clearer notion of "worker/wrapper arity", esp
for join points. See GHC.Core.Opt.DmdAnal
Note [Worker/wrapper arity and join points]
This Note is a good summary of what this MR does:
(1) The "worker/wrapper arity" of an Id is
* For non-join-points: idArity
* The join points: the join arity (Id part only of course)
This is the number of args we will use in worker/wrapper.
See `ww_arity` in `dmdAnalRhsSig`, and the function `workWrapArity`.
(2) A join point's demand-signature arity may exceed the Id's worker/wrapper
arity. See the `arity_ok` assertion in `mkWwBodies`.
(3) In `finaliseArgBoxities`, do trimBoxity on any argument demands beyond
the worker/wrapper arity.
(4) In WorkWrap.splitFun, make sure we split based on the worker/wrapper
arity (re)-computed by workWrapArity.
- - - - -
5e8faaf1 by Jan Hrček at 2024-06-20T07:23:20-04:00
Update haddocks of Import/Export AST types
- - - - -
cd512234 by Hécate Kleidukos at 2024-06-20T07:24:02-04:00
haddock: Update bounds in cabal files and remove allow-newer stanza in cabal.project
- - - - -
8a8ff8f2 by Rodrigo Mesquita at 2024-06-20T07:24:38-04:00
cmm: Don't parse MO_BSwap for W8
Don't support parsing bswap8, since bswap8 is not really an operation
and would have to be implemented as a no-op (and currently is not
implemented at all).
Fixes #25002
- - - - -
5cc472f5 by sheaf at 2024-06-20T07:25:14-04:00
Delete unused testsuite files
These files were committed by mistake in !11902.
This commit simply removes them.
- - - - -
7b079378 by Matthew Pickering at 2024-06-20T07:25:50-04:00
Remove left over debugging pragma from 2016
This pragma was accidentally introduced in 648fd73a7b8fbb7955edc83330e2910428e76147
The top-level cost centres lead to a lack of optimisation when compiling
with profiling.
- - - - -
c872e09b by Hécate Kleidukos at 2024-06-20T19:28:36-04:00
haddock: Remove unused pragmata, qualify usages of Data.List functions, add more sanity checking flags by default
This commit enables some extensions and GHC flags in the cabal file in a way
that allows us to reduce the amount of prologuing on top of each file.
We also prefix the usage of some List functions that removes ambiguity
when they are also exported from the Prelude, like foldl'.
In general, this has the effect of pointing out more explicitly
that a linked list is used.
Metric Increase:
haddock.Cabal
haddock.base
haddock.compiler
- - - - -
8c87d4e1 by Arnaud Spiwack at 2024-06-20T19:29:12-04:00
Add test case for #23586
- - - - -
568de8a5 by Arnaud Spiwack at 2024-06-20T19:29:12-04:00
When matching functions in rewrite rules: ignore multiplicity
When matching a template variable to an expression, we check that it
has the same type as the matched expression. But if the variable `f` has
type `A -> B` while the expression `e` has type `A %1 -> B`, the match was
previously rejected.
A principled solution would have `f` substituted by `\(%Many x) -> e
x` or some other appropriate coercion. But since linearity is not
properly checked in Core, we can be cheeky and simply ignore
multiplicity while matching. Much easier.
This has forced a change in the linter which, when `-dlinear-core-lint`
is off, must consider that `a -> b` and `a %1 -> b` are equal. This is
achieved by adding an argument to configure the behaviour of
`nonDetCmpTypeX` and modify `ensureEqTys` to call to the new behaviour
which ignores multiplicities when comparing two `FunTy`.
Fixes #24725.
- - - - -
c8a8727e by Simon Peyton Jones at 2024-06-20T19:29:12-04:00
Faster type equality
This MR speeds up type equality, triggered by perf regressions that
showed up when fixing #24725 by parameterising type equality over
whether to ignore multiplicity.
The changes are:
* Do not use `nonDetCmpType` for type /equality/. Instead use a specialised
type-equality function, which we have always had!
`nonDetCmpType` remains, but I did not invest effort in refactoring
or optimising it.
* Type equality is parameterised by
- whether to expand synonyms
- whether to respect multiplicities
- whether it has a RnEnv2 environment
In this MR I systematically specialise it for static values of these
parameters. Much more direct and predictable than before. See
Note [Specialising type equality]
* We want to avoid comparing kinds if possible. I refactored how this
happens, at least for `eqType`.
See Note [Casts and coercions in type comparison]
* To make Lint fast, we want to avoid allocating a thunk for <msg> in
ensureEqTypes ty1 ty2 <msg>
because the test almost always succeeds, and <msg> isn't needed.
See Note [INLINE ensureEqTys]
Metric Decrease:
T13386
T5030
- - - - -
9dfa0846 by Peter Trommler at 2024-06-21T12:17:32+02:00
PPC NCG: Fix sign hints in C calls
Sign hints for parameters are in the second component of the pair.
Fixes #23034
- - - - -
30 changed files:
- compiler/GHC.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Utils.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6d3d8a7a7045813d8d9583851738ccb44a6b6e3c...9dfa08465d28755afe77d2edf57457ed6366aef5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6d3d8a7a7045813d8d9583851738ccb44a6b6e3c...9dfa08465d28755afe77d2edf57457ed6366aef5
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240621/c8b731f1/attachment-0001.html>
More information about the ghc-commits
mailing list