[Git][ghc/ghc][wip/T23070-dicts] 14 commits: Use setSrcSpan rather than setLclEnv in solveForAll
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Fri May 19 23:24:15 UTC 2023
Simon Peyton Jones pushed to branch wip/T23070-dicts at Glasgow Haskell Compiler / GHC
Commits:
5fe1d3e6 by Matthew Pickering at 2023-05-17T21:42:00-04:00
Use setSrcSpan rather than setLclEnv in solveForAll
In subsequent MRs (#23409) we want to remove the TcLclEnv argument from
a CtLoc. This MR prepares us for that by removing the one place where
the entire TcLclEnv is used, by using it more precisely to just set the
contexts source location.
Fixes #23390
- - - - -
385edb65 by Torsten Schmits at 2023-05-17T21:42:40-04:00
Update the users guide paragraph on -O in GHCi
In relation to #23056
- - - - -
87626ef0 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Add test for #13660
- - - - -
9eef53b1 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Move implementation of GHC.Foreign to GHC.Internal
- - - - -
174ea2fa by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Introduce {new,with}CStringLen0
These are useful helpers for implementing the internal-NUL code unit
check needed to fix #13660.
- - - - -
a46ced16 by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Clean up documentation
- - - - -
b98d99cc by Ben Gamari at 2023-05-18T15:18:53-04:00
base: Ensure that FilePaths don't contain NULs
POSIX filepaths may not contain the NUL octet but previously we did not
reject such paths. This could be exploited by untrusted input to cause
discrepancies between various `FilePath` queries and the opened
filename. For instance, `readFile "hello.so\x00.txt"` would open the
file `"hello.so"` yet `takeFileExtension` would return `".txt"`.
The same argument applies to Windows FilePaths
Fixes #13660.
- - - - -
7ae45459 by Simon Peyton Jones at 2023-05-18T15:19:29-04:00
Allow the demand analyser to unpack tuple and equality dictionaries
Addresses #23398. The demand analyser usually does not unpack class
dictionaries: see Note [Do not unbox class dictionaries] in
GHC.Core.Opt.DmdAnal.
This patch makes an exception for tuple dictionaries and equality
dictionaries, for reasons explained in wrinkles (DNB1) and (DNB2) of
the above Note.
Compile times fall by 0.1% for some reason (max 0.7% on T18698b).
- - - - -
b53a9086 by Greg Steuck at 2023-05-18T15:20:08-04:00
Use a simpler and more portable construct in ld.ldd check
printf '%q\n' is a bash extension which led to incorrectly
failing an ld.lld test on OpenBSD which uses pdksh as /bin/sh
- - - - -
dd5710af by Torsten Schmits at 2023-05-18T15:20:50-04:00
Update the warning about interpreter optimizations
to reflect that they're not incompatible anymore, but guarded by a flag
- - - - -
4f6dd999 by Matthew Pickering at 2023-05-18T15:21:26-04:00
Remove stray dump flags in GHC.Rename.Names
- - - - -
4bca0486 by Oleg Grenrus at 2023-05-19T11:51:33+03:00
Make Warn = Located DriverMessage
This change makes command line argument parsing use diagnostic
framework for producing warnings.
- - - - -
525ed554 by Simon Peyton Jones at 2023-05-19T10:09:15-04:00
Type inference for data family newtype instances
This patch addresses #23408, a tricky case with data family
newtype instances. Consider
type family TF a where TF Char = Bool
data family DF a
newtype instance DF Bool = MkDF Int
and [W] Int ~R# DF (TF a), with a Given (a ~# Char). We must fully
rewrite the Wanted so the tpye family can fire; that wasn't happening.
- - - - -
0771121e by Simon Peyton Jones at 2023-05-20T00:23:53+01:00
Add the SolverStage monad
This refactoring makes a substantial improvement in the
structure of the type-checker's constraint solver: #23070.
Specifically:
* Introduced the SolverStage monad. See GHC.Tc.Solver.Monad
Note [The SolverStage monad]
* Combined the remnants of GHC.Tc.Solver.Canonical and
GHC.Tc.Solver.Interact into a new module GHC.Tc.Solver.Solve.
(Interact and Canonical are removed.)
* Gave the same treatment to dictionary and irred constraints
as I have already done for equality constraints:
* New types (akin to EqCt): IrredCt and DictCt
* Ct is now just a simple sum type
data Ct
= CDictCan DictCt
| CIrredCan IrredCt
| CEqCan EqCt
| CQuantCan QCInst
| CNonCanonical CtEvidence
* Significantly simplified the treatment of implicit parameters.
Previously we had a number of special cases
* interactGivenIP, an entire function
* special case in maybeKickOut
* special case in findDict, when looking up dictionaries
But actually it's simpler than that. When adding a new Given, implicit
parameter constraint to the InertSet, we just need to kick out any
existing inert constraints that mention that implicit parameter.
See Note [Shadowing of implicit parameters] in GHC.Tc.Solver.Dict.
* Add a new fast-path in GHC.Tc.Errors.Hole.tcCheckHoleFit.
See Note [Fast path for tcCheckHoleFit]. This is a big win in some cases:
test hard_hole_fits gets nearly 40% faster (at compile time).
* Add a new fast-path for solving /boxed/ equality constraints
(t1 ~ t2). See Note [Solving equality classes] in GHC.Tc.Solver.Dict.
This makes a big difference too: test T17836 compiles 40% faster.
..maybe more to come..
Smaller points:
* In `GHC.Tc.Errors.misMatchOrCND` instead of having a special case for
insoluble /occurs/ checks, broaden in to all insouluble constraints.
Just generally better. See Note [Insoluble mis-match] in that module.
As noted above, compile time perf gets better:
Metrics: compile_time/bytes allocated
-------------------------------------
CoOpt_Read(normal) +0.4%
LargeRecord(normal) +0.7%
T12227(normal) -1.8% GOOD
T13035(normal) -0.6%
T15703(normal) -1.4% GOOD
T17836(normal) -40.7% GOOD
T17836b(normal) -12.3% GOOD
T8095(normal) -2.7% GOOD
T9020(optasm) -1.1%
hard_hole_fits(normal) -36.9% GOOD
geo. mean -1.3%
minimum -40.7%
maximum +0.7%
Metric Decrease:
T12227
T15703
T17836
T17836b
T8095
hard_hole_fits
- - - - -
30 changed files:
- compiler/GHC.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CmdLine.hs
- compiler/GHC/Driver/Errors.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Errors/Types.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Pipeline/Phases.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Pat.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6aab81509fc261cc986dde5c2c619140ad226667...0771121e40f2d04a99a8002223e925d685562a1d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6aab81509fc261cc986dde5c2c619140ad226667...0771121e40f2d04a99a8002223e925d685562a1d
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/20230519/e03e90b3/attachment-0001.html>
More information about the ghc-commits
mailing list