| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the `.debug-ghc-link-info` section was of type `SHT_NOTE` but
this is not compliant with the ELF specification, which requires that
`NOTE` sections are in a particular record-based format. We mark this
section as `PROGBITS` instead, which is defined as implying no
particular format.
Fixes #11022.
Reviewers: bgamari, austin
Reviewed By: bgamari, austin
Subscribers: thomie, hsyl20
Differential Revision: https://phabricator.haskell.org/D1375
GHC Trac Issues: #11022
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: simonpj, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1389
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Simplifier and desugarer do this already)
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1395
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make various population count operations available via C-- syntax
under the names %popcnt{8,16,32,64}. Fixes #11037.
Reviewers: simonmar, austin, ekmett
Reviewed By: austin, ekmett
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1402
GHC Trac Issues: #11037
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes DuplicateRecordFields more liberal in when it will
accept ambiguous record selectors, making use of type information in a
similar way to updates. See Note [Disambiguating record fields] for more
details. I've also refactored how record updates are disambiguated.
Test Plan: New and amended tests in overloadedrecflds
Reviewers: simonpj, goldfire, bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1391
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I don't really understand this. GHC.hs had:
module GHC( ..., module HsSyn, ... ) where
import HsSyn
import qualified HsSyn -- hack as we want to reexport the whole module
GHC now reports the 'import qualified' line as redundant; and it certainly
is, because 'import HsSyn' brings everything into scope qualified *and*
unqualified. I have no idea why the "hack" was necessary before, but
following my refactoring of tcg_used_gres (previous commit), it's reported
as redundant, so I've deleted it.
I'm making it a separate commit because it seems a bit mysterious and I
wanted to draw attention to it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements an improvment that I've wanted to do for ages, but
never gotten around to.
Unused imports are computed based on how imported entities occur (qualified,
unqualified). This info was accumulated in tcg_used_rdrnames :: Set RdrName.
But that was a huge pain, and it got worse when we introduced duplicate
record fields.
The Right Thing is to record tcg_used_gres :: [GlobalRdrElt], which records
the GRE *after* filtering with pickGREs. See Note [GRE filtering] in RdrName.
This is much, much bette. This patch deletes quite a bit of code, and is
conceptually much easier to follow.
Hooray. There should be no change in functionality.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fix for Trac #10890 in commit 1818b48, namely
Fix incorrect import warnings when methods with identical names are imported
was wrong, as demonstrated by the new test T10890_2. It suppressed
far too many warnings!
This patch fixes the original problem in a different way, by making
RdrName.greUsedRdrName a bit cleverer.
But this too is not really the Right Thing. I think the Right Thing is
to store the /GRE/ in the tcg_used_rdrnames, not the /RdrName/. That
would be a lot simpler and more direct.
But one step at a time.
|
|
|
|
|
| |
This is a follow on to the patch for Trac #10928.
It's a local renaming of variables only; no change in behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following source snippet 'module A where x */* y = 42'
when being compiled with '-g' option emits syntactically
invalid comment for GNU as:
.text
.align 8
.loc 1 3 1 /* */* */
Fixed by not emitting comments at all. We already suppress
all asm comments in 'X86/Ppr.hs'.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: added test and check it works
Reviewers: scpmw, simonmar, austin, bgamari
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1386
GHC Trac Issues: #10667
|
|
|
|
|
|
|
|
| |
This reverts commit bef2f03e4d56d88a7e9752a7afd6a0a35616da6c.
This merge was botched
Also reverts haddock submodule.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements the idea floated in Trac #9858, namely that we
should generate type-representation information at the data type
declaration site, rather than when solving a Typeable constraint.
However, this turned out quite a bit harder than I expected. I still
think it's the right thing to do, and it's done now, but it was quite
a struggle.
See particularly
* Note [Grand plan for Typeable] in TcTypeable (which is a new module)
* Note [The overall promotion story] in DataCon (clarifies existing stuff)
The most painful bit was that to generate Typeable instances (ie
TyConRepName bindings) for every TyCon is tricky for types in ghc-prim
etc:
* We need to have enough data types around to *define* a TyCon
* Many of these types are wired-in
Also, to minimise the code generated for each data type, I wanted to
generate pure data, not CAFs with unpackCString# stuff floating about.
Performance
~~~~~~~~~~~
Three perf/compiler tests start to allocate quite a bit more. This isn't
surprising, because they all allocate zillions of data types, with
practically no other code, esp. T1969
* T3294: GHC allocates 110% more (filed #11030 to track this)
* T1969: GHC allocates 30% more
* T4801: GHC allocates 14% more
* T5321FD: GHC allocates 13% more
* T783: GHC allocates 12% more
* T9675: GHC allocates 12% more
* T5642: GHC allocates 10% more
* T9961: GHC allocates 6% more
* T9203: Program allocates 54% less
I'm treating this as acceptable. The payoff comes in Typeable-heavy
code.
Remaining to do
~~~~~~~~~~~~~~~
* I think that "TyCon" and "Module" are over-generic names to use for
the runtime type representations used in GHC.Typeable. Better might be
"TrTyCon" and "TrModule". But I have not yet done this
* Add more info the the "TyCon" e.g. source location where it was
defined
* Use the new "Module" type to help with Trac Trac #10068
* It would be possible to generate TyConRepName (ie Typeable
instances) selectively rather than all the time. We'd need to persist
the information in interface files. Lacking a motivating reason I have
not done this, but it would not be difficult.
Refactoring
~~~~~~~~~~~
As is so often the case, I ended up refactoring more than I intended.
In particular
* In TyCon, a type *family* (whether type or data) is repesented by a
FamilyTyCon
* a algebraic data type (including data/newtype instances) is
represented by AlgTyCon This wasn't true before; a data family
was represented as an AlgTyCon. There are some corresponding
changes in IfaceSyn.
* Also get rid of the (unhelpfully named) tyConParent.
* In TyCon define 'Promoted', isomorphic to Maybe, used when things are
optionally promoted; and use it elsewhere in GHC.
* Cleanup handling of knownKeyNames
* Each TyCon, including promoted TyCons, contains its TyConRepName, if
it has one. This is, in effect, the name of its Typeable instance.
Requires update of the haddock submodule.
Differential Revision: https://phabricator.haskell.org/D757
|
|
|
|
| |
What a disaster this merge was.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements an extension to pattern synonyms which allows user
to specify pattern synonyms using record syntax. Doing so generates
appropriate selectors and update functions.
=== Interaction with Duplicate Record Fields ===
The implementation given here isn't quite as general as it could be with
respect to the recently-introduced `DuplicateRecordFields` extension.
Consider the following module:
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE PatternSynonyms #-}
module Main where
pattern S{a, b} = (a, b)
pattern T{a} = Just a
main = do
print S{ a = "fst", b = "snd" }
print T{ a = "a" }
In principle, this ought to work, because there is no ambiguity. But at
the moment it leads to a "multiple declarations of a" error. The problem
is that pattern synonym record selectors don't do the same name mangling
as normal datatypes when DuplicateRecordFields is enabled. They could,
but this would require some work to track the field label and selector
name separately.
In particular, we currently represent datatype selectors in the third
component of AvailTC, but pattern synonym selectors are just represented
as Avails (because they don't have a corresponding type constructor).
Moreover, the GlobalRdrElt for a selector currently requires it to have
a parent tycon.
(example due to Adam Gundry)
=== Updating Explicitly Bidirectional Pattern Synonyms ===
Consider the following
```
pattern Silly{a} <- [a] where
Silly a = [a, a]
f1 = a [5] -- 5
f2 = [5] {a = 6} -- currently [6,6]
```
=== Fixing Polymorphic Updates ===
They were fixed by adding these two lines in `dsExpr`. This might break
record updates but will be easy to fix.
```
+ ; let req_wrap = mkWpTyApps (mkTyVarTys univ_tvs)
- , pat_wrap = idHsWrapper }
+, pat_wrap = req_wrap }
```
=== Mixed selectors error ===
Note [Mixed Record Field Updates]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following pattern synonym.
data MyRec = MyRec { foo :: Int, qux :: String }
pattern HisRec{f1, f2} = MyRec{foo = f1, qux=f2}
This allows updates such as the following
updater :: MyRec -> MyRec
updater a = a {f1 = 1 }
It would also make sense to allow the following update (which we
reject).
updater a = a {f1 = 1, qux = "two" } ==? MyRec 1 "two"
This leads to confusing behaviour when the selectors in fact refer the
same field.
updater a = a {f1 = 1, foo = 2} ==? ???
For this reason, we reject a mixture of pattern synonym and normal
record selectors in the same update block. Although of course we still
allow the following.
updater a = (a {f1 = 1}) {foo = 2}
> updater (MyRec 0 "str")
MyRec 2 "str"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch swaps the order of provided and required constraints in
a pattern signature, so it now goes
pattern P :: req => prov => t1 -> ... tn -> res_ty
See the long discussion in Trac #10928.
I think I have found all the places, but I could have missed something
particularly in comments.
There is a Haddock changes; so a submodule update.
|
|
|
|
|
| |
Previously unboundKey and fromIntegerClassOpKey were sharing a Unique
Reassign unboundKey to `mkPreludeMiscIdUnique 158`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add -fworker-wrapper flag which enables the worker-wrapper transformation. It
is implied by -O.
The expected users of this flag, which includes myself, are GHC API users. In
my Haskell-to-Hardware compiler, which uses the GHC API, I have seen no
benifits of the worker-wrapper transformation. It does however induce longer
compilation times.
Further discussion can be seen here:
https://mail.haskell.org/pipermail/ghc-devs/2015-October/010096.html
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1372
GHC Trac Issues: #11020
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`fsEnvElts :: FastStringEnv a -> [a]` returns a list of `[a]` in the order of
`Unique`s which is arbitrary. In this case it gives a list of record fields in
arbitrary order, from which we then extract the field labels to contribute to
the record fingerprint. The arbitrary ordering of field labels introduces
unnecessary nondeterminism in interface files as demonstrated by the test case.
We sort `FastString` here. It's safe, because the only way that the `Unique`
associated with the `FastString` is used in comparison is for equality. If the
`Unique`s are different it fallbacks to comparing the actual `ByteString`.
Reviewed By: ezyang, thomie, bgamari, austin
Differential Revision: https://phabricator.haskell.org/D1373
GHC Trac Issues: #4012
|
| |
|
|
|
|
|
| |
This fixes commit d1d8704cb3d003315177fad1394fce49f98fb1a2,
which somehow was mangled during merge.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To get reproducible/deterministic builds, the way that the Uniques are
assigned shouldn't matter. This allows to test for that.
It add 2 new flags:
* `-dinitial-unique`
* `-dunique-increment`
And by varying these you can get interesting effects:
* `-dinitial-unique=0 -dunique-increment 1` - current sequential
UniqSupply
* `-dinitial-unique=16777215 -dunique-increment -1` - UniqSupply that
generates in decreasing order
* `-dinitial-unique=1 -dunique-increment PRIME` - where PRIME big enough
to overflow often - nonsequential order
I haven't proven the usefullness of the last one yet and it's the reason
why we have to mask the bits with `0xFFFFFF` in `genSym`, so I can
remove it if it becomes contentious.
Test Plan: validate on harbormaster
Reviewers: simonmar, austin, ezyang, bgamari
Reviewed By: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1360
GHC Trac Issues: #4012
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, thomie, bgamari
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1376
GHC Trac Issues: #10848
|
|
|
|
|
|
| |
Fixes Trac #10997
Merge to stable branch
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: austin, thomie, bgamari
Reviewed By: thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1349
GHC Trac Issues: #10970
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1367
GHC Trac Issues: #10848
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1363
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes it so the result of computing SCC's depends on the order
the nodes were passed to it, but not on the order on the user provided
key type.
The key type is usually `Unique` which is known to be nondeterministic.
Test Plan:
`text` and `aeson` become deterministic after this
./validate
Compare compile time for `text`:
```
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real 0m59.459s
user 0m57.862s
sys 0m1.185s
$ cabal clean && time cabal build
real 1m0.037s
user 0m58.350s
sys 0m1.199s
$ cabal clean && time cabal build
real 0m57.634s
user 0m56.118s
sys 0m1.202s
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real 0m59.867s
user 0m58.176s
sys 0m1.188s
$ cabal clean && time cabal build
real 1m0.157s
user 0m58.622s
sys 0m1.177s
$ cabal clean && time cabal build
real 1m0.950s
user 0m59.397s
sys 0m1.083s
```
Reviewers: ezyang, simonmar, austin, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1268
GHC Trac Issues: #4012
|
|
|
|
|
|
|
|
|
| |
Suggest enabling PatternSynonyms if we find an invalid
signature that looks like a pattern synonym.
Reviewed By: austin, thomie
Differential Revision: https://phabricator.haskell.org/D1347
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
There was a broken offset calculation that only worked when the
sections of the binary were in a particular order, and this
broke (sometimes) after we started mapping the sections separately in
the linker (see D975).
Test Plan: ghci debugger tests now work with DYNAMIC_GHC_PROGRAMS=NO
Reviewers: austin, hvr, bgamari, erikd
Reviewed By: bgamari
Subscribers: Phyx, thomie, trommler
Differential Revision: https://phabricator.haskell.org/D1346
GHC Trac Issues: #10994
|
|
|
|
|
|
|
|
| |
Default rules deliberately accept any kind.
Reviewed By: simonpj, thomie, goldfire
Differential Revision: https://phabricator.haskell.org/D1329
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When TemplateHaskell language extension is enabled it is valid to have
top-level expressions. Each such expression is treated as a contents
of a splice. The problem arises with typed splices. They are not valid
at the top level and therefore we should interpret them not as a splice
but as a top-level expression (aka. implicit splice). So saying:
$$foo
is equivalent of:
$( $$foo )
This patch makes sure that this is indeed the case. Until now we
incorrectly treated typed splices as explicit splices.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Build on Debian using `--with-gcc=clang`
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1336
GHC Trac Issues: #10981
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e.
such that the explicit definitions for `return` and `(>>)` match the
MRP-style default-implementation, i.e.
return = pure
and
(>>) = (*>)
This way, e.g. all `return = pure` definitions can easily be grepped and
removed in GHC 8.1;
Test Plan: Harbormaster
Reviewers: goldfire, alanz, bgamari, quchen, austin
Reviewed By: quchen, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1312
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds basic support to the RTS for DWARF-assisted unwinding of the
Haskell and C stack via libdw. This only adds the infrastructure;
consumers of this functionality will be introduced in future diffs.
Currently we are carrying the initial register collection code in
Libdw.c but this will eventually make its way upstream to libdw.
Test Plan: See future patches
Reviewers: Tarrasch, scpmw, austin, simonmar
Reviewed By: austin, simonmar
Subscribers: simonmar, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1196
GHC Trac Issues: #10656
|
|
|
|
|
| |
Fixes #10267. Typed holes in typed Template Haskell currently don't work.
See #10945 and #10946.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements DuplicateRecordFields, the first part of the
OverloadedRecordFields extension, as described at
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields
This includes fairly wide-ranging changes in order to allow multiple
records within the same module to use the same field names. Note that
it does *not* allow record selector functions to be used if they are
ambiguous, and it does not have any form of type-based disambiguation
for selectors (but it does for updates). Subsequent parts will make
overloading selectors possible using orthogonal extensions, as
described on the wiki pages. This part touches quite a lot of the
codebase, and requires changes to several GHC API datatypes in order
to distinguish between field labels (which may be overloaded) and
selector function names (which are always unique).
The Haddock submodule has been adapted to compile with the GHC API
changes, but it will need further work to properly support modules
that use the DuplicateRecordFields extension.
Test Plan: New tests added in testsuite/tests/overloadedrecflds; these
will be extended once the other parts are implemented.
Reviewers: goldfire, bgamari, simonpj, austin
Subscribers: sjcjoosten, haggholm, mpickering, bgamari, tibbe, thomie,
goldfire
Differential Revision: https://phabricator.haskell.org/D761
|
|
|
|
|
| |
And that allows us to remove the nasty import of HsBinds,
which has no business in this module.
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
| |
Comes with Haddock submodule update.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit contains a Cabal submodule update which unifies installed
package IDs and package keys under a single notion, a Component ID.
We update GHC to keep follow this unification. However, this commit
does NOT rename installed package ID to component ID and package key to
unit ID; the plan is to do that in a companion commit.
- Compiler info now has "Requires unified installed package IDs"
- 'exposed' is now expected to contain unit keys, not IPIDs.
- Shadowing is no more. We now just have a very simple strategy
to deal with duplicate unit keys in combined package databases:
if their ABIs are the same, use the latest one; otherwise error.
Package databases maintain the invariant that there can only
be one entry of a unit ID.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari, hvr, goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1184
GHC Trac Issues: #10714
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Arm has two instruction sets, Arm and Thumb, and an execution mode for each.
Executing Arm code in Thumb mode or vice-versa will likely result in an
Illegal instruction exception.
Furthermore, Haskell code compiled via LLVM was generating Arm instructions
while C code compiled via GCC was generating Thumb code by default. When
these two object code types were being linked by the system linker, all was
fine, because the system linker knows how to jump and call from one
instruction set to the other.
The first problem was with GHCi's object code loader which did not know
about Thumb vs Arm. When loading an object file `StgCRun` would jump
into the loaded object which could change the mode causing a crash after
it returned. This was fixed by forcing all C code to generate Arm
instructions by passing `-marm` to GCC.
The second problem was the `mkJumpToAddr` function which was generating
Thumb instructions. Changing that to generate Arm instructions instead
results in a working GHCi on Arm.
Test Plan: validate on x86_64 and arm
Reviewers: bgamari, austin, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1323
GHC Trac Issues: #10375
|