[Git][ghc/ghc][wip/backports] 7 commits: Make `identifier` parse unparenthesized `->` (#18060)
Ben Gamari
gitlab at gitlab.haskell.org
Sun Jul 26 19:06:02 UTC 2020
Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC
Commits:
83bcf37d by Joshua Price at 2020-07-26T15:05:52-04:00
Make `identifier` parse unparenthesized `->` (#18060)
(cherry picked from commit d6203f24cf421749616a247c047a9b44192f963a)
- - - - -
50f25994 by Simon Peyton Jones at 2020-07-26T15:05:52-04:00
Wrap an implication around class-sig kind errors
Ticket #17841 showed that we can get a kind error
in a class signature, but lack an enclosing implication
that binds its skolems.
This patch
* Adds the wrapping implication: the new call to
checkTvConstraints in tcClassDecl1
* Simplifies the API to checkTvConstraints, which
was not otherwise called at all.
* Simplifies TcErrors.report_unsolved by *not*
initialising the TidyEnv from the typechecker lexical
envt. It's enough to do so from the free vars of the
unsolved constraints; and we get silly renamings if
we add variables twice: once from the lexical scope
and once from the implication constraint.
(cherry picked from commit 3f431587c2db712136a3b5a353758ca63e1a5fd8)
- - - - -
a063768e by Simon Peyton Jones at 2020-07-26T15:05:52-04:00
Refactoring in TcSMonad
This patch is just refactoring: no change in
behaviour.
I removed the rather complicated
checkConstraintsTcS
checkTvConstraintsTcS
in favour of simpler functions
emitImplicationTcS
emitTvImplicationTcS
pushLevelNoWorkList
The last of these is a little strange, but overall
it's much better I think.
(cherry picked from commit 9d87ced6832e75fce1e01b67bc6b7d9d1cf31efb)
- - - - -
05be81e8 by Simon Peyton Jones at 2020-07-26T15:05:52-04:00
Major improvements to the specialiser
This patch is joint work of Alexis King and Simon PJ. It does some
significant refactoring of the type-class specialiser. Main highlights:
* We can specialise functions with types like
f :: Eq a => a -> Ord b => b => blah
where the classes aren't all at the front (#16473). Here we can
correctly specialise 'f' based on a call like
f @Int @Bool dEqInt x dOrdBool
This change really happened in an earlier patch
commit 2d0cf6252957b8980d89481ecd0b79891da4b14b
Author: Sandy Maguire <sandy at sandymaguire.me>
Date: Thu May 16 12:12:10 2019 -0400
work that this new patch builds directly on that work, and refactors
it a bit.
* We can specialise functions with implicit parameters (#17930)
g :: (?foo :: Bool, Show a) => a -> String
Previously we could not, but now they behave just like a non-class
argument as in 'f' above.
* We can specialise under-saturated calls, where some (but not all of
the dictionary arguments are provided (#17966). For example, we can
specialise the above 'f' based on a call
map (f @Int dEqInt) xs
even though we don't (and can't) give Ord dictionary.
This may sound exotic, but #17966 is a program from the wild, and
showed significant perf loss for functions like f, if you need
saturation of all dictionaries.
* We fix a buglet in which a floated dictionary had a bogus demand
(#17810), by using zapIdDemandInfo in the NonRec case of specBind.
* A tiny side benefit: we can drop dead arguments to specialised
functions; see Note [Drop dead args from specialisations]
* Fixed a bug in deciding what dictionaries are "interesting"; see
Note [Keep the old dictionaries interesting]
This is all achieved by by building on Sandy Macguire's work in
defining SpecArg, which mkCallUDs uses to describe the arguments of
the call. Main changes:
* Main work is in specHeader, which marched down the [InBndr] from the
function definition and the [SpecArg] from the call site, together.
* specCalls no longer has an arity check; the entire mechanism now
handles unders-saturated calls fine.
* mkCallUDs decides on an argument-by-argument basis whether to
specialise a particular dictionary argument; this is new.
See mk_spec_arg in mkCallUDs.
It looks as if there are many more lines of code, but I think that
all the extra lines are comments!
(cherry picked from commit 7052d7c7ce3418db9e66ad6ff31e80b2a2c724bb)
- - - - -
a10c6ddf by Simon Peyton Jones at 2020-07-26T15:05:52-04:00
Fix specialisation for DFuns
When specialising a DFun we must take care to saturate the
unfolding. See Note [Specialising DFuns] in Specialise.
Fixes #18120
(cherry picked from commit 88e3c8150d2b2d96c3ebc0b2942c9af44071c511)
- - - - -
5015d3ac by Ben Gamari at 2020-07-26T15:05:52-04:00
testsuite: Accept wibbles in specialiser test output
- - - - -
6471cc6a by Moritz Angermann at 2020-07-26T15:05:52-04:00
[linker] Fix out of range relocations.
mmap may return address all over the place. mmap_next will ensure we get
the next free page after the requested address.
This is especially important for linking on aarch64, where the memory model with PIC
admits relocations in the +-4GB range, and as such we can't work with
arbitrary object locations in memory.
Of note: we map the rts into process space, so any mapped objects must
not be ouside of the 4GB from the processes address space.
(cherry picked from commit aedfeb0b2b22172a0dfca0fe0c020ac80539d6ae)
- - - - -
30 changed files:
- compiler/coreSyn/CoreSubst.hs
- compiler/coreSyn/CoreUnfold.hs
- compiler/deSugar/DsBinds.hs
- compiler/parser/Parser.y
- compiler/specialise/Specialise.hs
- compiler/typecheck/TcCanonical.hs
- compiler/typecheck/TcClassDcl.hs
- compiler/typecheck/TcErrors.hs
- compiler/typecheck/TcEvidence.hs
- compiler/typecheck/TcSMonad.hs
- compiler/typecheck/TcSigs.hs
- compiler/typecheck/TcTyClsDecls.hs
- compiler/typecheck/TcUnify.hs
- rts/Linker.c
- rts/LinkerInternals.h
- rts/linker/Elf.c
- rts/linker/LoadArchive.c
- rts/linker/M32Alloc.c
- rts/linker/MachO.c
- rts/linker/SymbolExtras.c
- rts/linker/elf_got.c
- + testsuite/tests/ghci/T18060/T18060.script
- + testsuite/tests/ghci/T18060/T18060.stdout
- + testsuite/tests/ghci/T18060/all.T
- testsuite/tests/perf/compiler/T16473.stdout
- testsuite/tests/polykinds/T16902.stderr
- + testsuite/tests/polykinds/T17841.hs
- + testsuite/tests/polykinds/T17841.stderr
- testsuite/tests/polykinds/all.T
- testsuite/tests/simplCore/should_compile/Makefile
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/309cff632977d372a65c698d6cd16992558acac7...6471cc6aff80d5deebbdb1bf7b677b31ed2af3d5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/309cff632977d372a65c698d6cd16992558acac7...6471cc6aff80d5deebbdb1bf7b677b31ed2af3d5
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/20200726/cfb6a5bb/attachment.html>
More information about the ghc-commits
mailing list