[Git][ghc/ghc][wip/spj-unf-size] 15 commits: haddock: Remove unused pragmata, qualify usages of Data.List functions, add...
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Mon Jun 24 10:59:37 UTC 2024
Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC
Commits:
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
- - - - -
21fc180b by Ryan Hendrickson at 2024-06-22T10:40:55-04:00
base: Add inits1 and tails1 to Data.List
- - - - -
d640a3b6 by Sebastian Graf at 2024-06-22T10:41:32-04:00
Derive previously hand-written `Lift` instances (#14030)
This is possible now that #22229 is fixed.
- - - - -
33fee6a2 by Sebastian Graf at 2024-06-22T10:41:32-04:00
Implement the "Derive Lift instances for data types in template-haskell" proposal (#14030)
After #22229 had been fixed, we can finally derive the `Lift` instance for the
TH AST, as proposed by Ryan Scott in
https://mail.haskell.org/pipermail/libraries/2015-September/026117.html.
Fixes #14030, #14296, #21759 and #24560.
The residency of T24471 increases by 13% because we now load `AnnLookup`
from its interface file, which transitively loads the whole TH AST.
Unavoidable and not terrible, I think.
Metric Increase:
T24471
- - - - -
383c01a8 by Matthew Pickering at 2024-06-22T10:42:08-04:00
bindist: Use complete relative paths when cding to directories
If a user has configured CDPATH on their system then `cd lib` may change
into an unexpected directory during the installation process.
If you write `cd ./lib` then it will not consult `CDPATH` to determine
what you mean.
I have added a check on ghcup-ci to verify that the bindist installation
works in this situation.
Fixes #24951
- - - - -
5759133f by Hécate Kleidukos at 2024-06-22T10:42:49-04:00
haddock: Use the more precise SDocContext instead of DynFlags
The pervasive usage of DynFlags (the parsed command-line options passed
to ghc) blurs the border between different components of Haddock, and
especially those that focus solely on printing text on the screen.
In order to improve the understanding of the real dependencies of a
function, the pretty-printer options are made concrete earlier in the
pipeline instead of late when pretty-printing happens.
This also has the advantage of clarifying which functions actually
require DynFlags for purposes other than pretty-printing, thus making
the interactions between Haddock and GHC more understandable when
exploring the code base.
See Henry, Ericson, Young. "Modularizing GHC".
https://hsyl20.fr/home/files/papers/2022-ghc-modularity.pdf. 2022
- - - - -
749e089b by Alexander McKenna at 2024-06-22T10:43:24-04:00
Add INLINE [1] pragma to compareInt / compareWord
To allow rules to be written on the concrete implementation of
`compare` for `Int` and `Word`, we need to have an `INLINE [1]`
pragma on these functions, following the
`matching_overloaded_methods_in_rules` note in `GHC.Classes`.
CLC proposal https://github.com/haskell/core-libraries-committee/issues/179
Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/22643
- - - - -
573b3d0e by Simon Peyton Jones at 2024-06-24T09:34:48+01:00
Work in progress on unfoldings re-engineering
- - - - -
ad056e3a by Simon Peyton Jones at 2024-06-24T09:34:48+01:00
Fix a bad, subtle bug in exprIsConApp_maybe
In extend_in_scope We were simply overwriting useful bindings in the
in-scope set, notably ones that had unfoldings. That could lead to
repeated simplifier iterations.
- - - - -
8770e927 by Simon Peyton Jones at 2024-06-24T09:34:48+01:00
Minor refactoring...
Plus: don't be so eager to inline when argument is a non-value,
but has some struture.
We want *some* incentive though.
- - - - -
7ca3f5a4 by Simon Peyton Jones at 2024-06-24T09:34:48+01:00
Adjust
* Reduce caseElimDiscount to 10
Example: f_nand in spectral/hartel/event is quite big but was still
getting inlined; that make f_simulate too big for SpecConstr
* Increase jumpSize. Not so much cheaper than tail calls.
I'm trying making them the same size.
- - - - -
5d42a398 by Simon Peyton Jones at 2024-06-24T09:34:48+01:00
Typo
- - - - -
19 changed files:
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/LiberateCase.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Seq.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/Type.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/72d4821d36ba2730427aca15c045b3b430ae7f04...5d42a398137563837682312f2d4b409556188029
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/72d4821d36ba2730427aca15c045b3b430ae7f04...5d42a398137563837682312f2d4b409556188029
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/20240624/a8defe57/attachment-0001.html>
More information about the ghc-commits
mailing list