[Git][ghc/ghc][wip/T21623] 32 commits: Fix binder-swap bug
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Wed Oct 26 10:26:21 UTC 2022
Simon Peyton Jones pushed to branch wip/T21623 at Glasgow Haskell Compiler / GHC
Commits:
41406da5 by Simon Peyton Jones at 2022-10-25T18:07:03-04:00
Fix binder-swap bug
This patch fixes #21229 properly, by avoiding doing a
binder-swap on dictionary Ids. This is pretty subtle, and explained
in Note [Care with binder-swap on dictionaries].
Test is already in simplCore/should_run/T21229
This allows us to restore a feature to the specialiser that we had
to revert: see Note [Specialising polymorphic dictionaries].
(This is done in a separate patch.)
I also modularised things, using a new function scrutBinderSwap_maybe
in all the places where we are (effectively) doing a binder-swap,
notably
* Simplify.Iteration.addAltUnfoldings
* SpecConstr.extendCaseBndrs
In Simplify.Iteration.addAltUnfoldings I also eliminated a guard
Many <- idMult case_bndr
because we concluded, in #22123, that it was doing no good.
- - - - -
5a997e16 by Simon Peyton Jones at 2022-10-25T18:07:03-04:00
Make the specialiser handle polymorphic specialisation
Ticket #13873 unexpectedly showed that a SPECIALISE pragma made a
program run (a lot) slower, because less specialisation took place
overall. It turned out that the specialiser was missing opportunities
because of quantified type variables.
It was quite easy to fix. The story is given in
Note [Specialising polymorphic dictionaries]
Two other minor fixes in the specialiser
* There is no benefit in specialising data constructor /wrappers/.
(They can appear overloaded because they are given a dictionary
to store in the constructor.) Small guard in canSpecImport.
* There was a buglet in the UnspecArg case of specHeader, in the
case where there is a dead binder. We need a LitRubbish filler
for the specUnfolding stuff. I expanded
Note [Drop dead args from specialisations] to explain.
There is a 4% increase in compile time for T15164, because we generate
more specialised code. This seems OK.
Metric Increase:
T15164
- - - - -
7f203d00 by Sylvain Henry at 2022-10-25T18:07:43-04:00
Numeric exceptions: replace FFI calls with primops
ghc-bignum needs a way to raise numerical exceptions defined in base
package. At the time we used FFI calls into primops defined in the RTS.
These FFI calls had to be wrapped into hacky bottoming functions because
"foreign import prim" syntax doesn't support giving a bottoming demand
to the foreign call (cf #16929).
These hacky wrapper functions trip up the JavaScript backend (#21078)
because they are polymorphic in their return type. This commit
replaces them with primops very similar to raise# but raising predefined
exceptions.
- - - - -
0988a23d by Sylvain Henry at 2022-10-25T18:08:24-04:00
Enable popcount rewrite rule when cross-compiling
The comment applies only when host's word size < target's word size.
So we can relax the guard.
- - - - -
a2f53ac8 by Sylvain Henry at 2022-10-25T18:09:05-04:00
Add GHC.SysTools.Cpp module
Move doCpp out of the driver to be able to use it in the upcoming JS backend.
- - - - -
1fd7f201 by Ben Gamari at 2022-10-25T18:09:42-04:00
llvm-targets: Add datalayouts for big-endian AArch64 targets
Fixes #22311.
Thanks to @zeldin for the patch.
- - - - -
f5a486eb by Krzysztof Gogolewski at 2022-10-25T18:10:19-04:00
Cleanup String/FastString conversions
Remove unused mkPtrString and isUnderscoreFS.
We no longer use mkPtrString since 1d03d8bef96.
Remove unnecessary conversions between FastString and String and back.
- - - - -
f7bfb40c by Ryan Scott at 2022-10-26T00:01:24-04:00
Broaden the in-scope sets for liftEnvSubst and composeTCvSubst
This patch fixes two distinct (but closely related) buglets that were uncovered
in #22235:
* `liftEnvSubst` used an empty in-scope set, which was not wide enough to cover
the variables in the range of the substitution. This patch fixes this by
populating the in-scope set from the free variables in the range of the
substitution.
* `composeTCvSubst` applied the first substitution argument to the range of the
second substitution argument, but the first substitution's in-scope set was
not wide enough to cover the range of the second substutition. We similarly
fix this issue in this patch by widening the first substitution's in-scope set
before applying it.
Fixes #22235.
- - - - -
0270cc54 by Vladislav Zavialov at 2022-10-26T00:02:01-04:00
Introduce TcRnWithHsDocContext (#22346)
Before this patch, GHC used withHsDocContext to attach an HsDocContext
to an error message:
addErr $ mkTcRnUnknownMessage $ mkPlainError noHints (withHsDocContext ctxt msg)
The problem with this approach is that it only works with
TcRnUnknownMessage. But could we attach an HsDocContext to a
structured error message in a generic way? This patch solves
the problem by introducing a new constructor to TcRnMessage:
data TcRnMessage where
...
TcRnWithHsDocContext :: !HsDocContext -> !TcRnMessage -> TcRnMessage
...
- - - - -
dc98d0c5 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Start work
Not ready for review
More progress
Wibbles
Stage1 compiles
More wibbles
More wibbles
More -- almost working
Comments
Wibbles
Wibbles
Wibble inlineId
Wibbles
Infinite loop somewhere
More wibbles. Maybe can build stage2
Make FuNCo a thing by itself
Wibble
Wibble
Wibbles
Fix OptCoercion
Wibble
Wibble to optCoercion
Replace SORT with TYPE and CONSTRAINT
Wibble
Delete unused import
Delete TypeOrConstraint from ghc-prim:GHC.Types
Move from NthCo to SelCo
Wibbles
Wibbles in RepType
Wibble
Add mkWpEta
Really add mkWpEta
Wibble Typeable binds etc
Improve error messages
More wibbles, mainly to error messages
Wibbles
Wibbles to errors
Wibbles
But especially: treat Constraint as Typeable
More wibbles
More changes
* Move role into SelTyCon
* Get rid of mkTcSymCo and friends
Unused variable
Wibbles
Wibble
Accept error message changes
Refactoring...
Remove tc functions like tcKind, tcGetTyVar.
Move tyConsOfType, occCheckExpand to TyCo.FVs.
Introduce GHC.Core.TyCo.Compare
Lots of import changes!
Update haddock submodule (I hope)
Wibbles (notably: actually add GHC.Core.TyCo.Compare)
Wibbles
Wibble output of T16575
Wibbles
More wibbles
Remove infinite loop in T1946
See Note [ForAllTy and type equality]
Deal with rejigConRes
Needs a Note to be written by Richard
Some renaming
AnonArgFlag --> FunTyFlag
ArgFlag --> ForAllTyFlag
Update haddock submodule
Rename TyCoBinder to ForAllTyBinder
Wibbles
Update haddock
Wibble
Update unix submodule
I think I accidentally got it out of sync with HEAD;
this puts it back.
Rename TyCoBinder to PiTyBinder
Update Haddock submodule
Wrap dictionaries in tuples
This fixes the kind bugs in arrow desugaring. Needs some Notes,
but I want to try CI.
More on boxing data cons
Rebase and update GHC.Tc.Errors/GHC.Tc.Errors.Ppr
Revert accidental changes in SameOccInfo
fixes mod180, tcfail182
Wibbles in error messages
..plus eqType comes from GHC.Core.TyCo.Compare
Wibbles
More wibbles
Reaedy for RAE review
Fix fragile rule setup in GHC.Float
See Note [realToFrac natural-to-float]
Wibbles
More wibbles
Remove unused import
Remove another unused import
Wibbles
Update haddock submodule
Respond to Sam's suggestions
Wibbles
Wibbles
- - - - -
472ff387 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles
- - - - -
15432edd by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Unused import
- - - - -
a5282189 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Better boxingCon_maybe
- - - - -
5853dc90 by Richard Eisenberg at 2022-10-26T08:38:39+01:00
Improvements to comments, etc., from Richard
- - - - -
a40da463 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Respond to Richard
- - - - -
52fa246b by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Improve boxing-data-con API
- - - - -
0f4fbd7f by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Update error messages
- - - - -
f2990240 by Richard Eisenberg at 2022-10-26T08:38:39+01:00
Fix the equality constraint problem
- - - - -
9622ea5d by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles
- - - - -
2f72fb7e by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Add isCovertGadtDataCon, fixing build
- - - - -
1f8e0a3e by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles
- - - - -
2d03da78 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles
- - - - -
cfbd424d by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Move RoughMatch code out of Unify into RoughMatch
- - - - -
ca4ae946 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibble
- - - - -
03c45b68 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles
- - - - -
5d2bc664 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Update haddock submodule again
- - - - -
a51582d4 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Wibbles, esp in RoughMap
- - - - -
91ce1b3e by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Upate haddock submodule
- - - - -
b6a84652 by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Define eqType using tcEqType
A one-line change
- - - - -
825f39ee by Simon Peyton Jones at 2022-10-26T08:38:39+01:00
Revert "Define eqType using tcEqType"
This reverts commit eaf04c17c6a159ddb70eedd6fb8ab0b4fc180b7a.
Performance got worse!
T18223 was 60% worse
T8095 75%
T12227 9%
T13386 6%
T15703 7%
T5030 8%
- - - - -
5c5d11e4 by Simon Peyton Jones at 2022-10-26T08:38:40+01:00
Refactor FunTyFlag
Mostly just renaming stuff
- - - - -
42196a76 by Simon Peyton Jones at 2022-10-26T11:27:59+01:00
Wibbles
- - - - -
13 changed files:
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Builtin/Types/Prim.hs
- − compiler/GHC/Builtin/Types/Prim.hs-boot
- compiler/GHC/Builtin/Uniques.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/ConLike.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b5ff0bcbe5c274f010ffd1b4c424786f0dd39839...42196a762dfe3317c9fe4fc0e8daa7394189eb8b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b5ff0bcbe5c274f010ffd1b4c424786f0dd39839...42196a762dfe3317c9fe4fc0e8daa7394189eb8b
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/20221026/dd583108/attachment-0001.html>
More information about the ghc-commits
mailing list