15 months agoBump Cabal submodule
Ben Gamari [Thu, 4 Oct 2018 16:44:49 +0000 (12:44 -0400)] 
Bump Cabal submodule

15 months agoDon't leak internal commentary into HasField's Haddocks
Ryan Scott [Thu, 4 Oct 2018 22:56:50 +0000 (18:56 -0400)] 
Don't leak internal commentary into HasField's Haddocks

In commit 2f09753f9620, some internal comments about the kind
signature of the HasField class accidentially leaked into its
publicly exported Haddocks.

15 months agoSet `infixr -1 ->`
Alec Theriault [Thu, 4 Oct 2018 22:13:28 +0000 (18:13 -0400)] 
Set `infixr -1 ->`

This simply makes explicit what is already the case. Due to special
treatment in the parser, `->` has the lowest fixity. This patch propagates
that information to:

  * GHCi, where `:info ->` now return the right fixity
  * TH, where `reifyFixity` returns the right fixity
  * the generated sources for `GHC.Prim`

See #15235.

Test Plan: make test

Reviewers: bgamari, alanz, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: int-index, RyanGlScott, rwbarton, mpickering, carter

GHC Trac Issues: #15235

Differential Revision:

15 months agoDon't drop arguments in TH type arguments
Alec Theriault [Thu, 4 Oct 2018 22:13:15 +0000 (18:13 -0400)] 
Don't drop arguments in TH type arguments

When converting from TH AST back to HsType, we were occasionally
dropping type arguments. This resulted in incorrectly accepted programs
as well as incorrectly rejected programs.

Test Plan: make TEST=T15360a && make TEST=T15360b

Reviewers: goldfire, bgamari, tdammers

Reviewed By: bgamari, tdammers

Subscribers: RyanGlScott, rwbarton, carter

GHC Trac Issues: #15360

Differential Revision:

15 months agoAllow (unparenthesized) kind signatures
Alec Theriault [Thu, 4 Oct 2018 22:10:21 +0000 (18:10 -0400)] 
Allow (unparenthesized) kind signatures

Summary: This allows for things like `[t :: MyKind]`, `(a :: k, b)`, and so on.

Test Plan: make TEST=T11622 && make TEST=T8708

Reviewers: RyanGlScott, bgamari, simonpj, goldfire, alanz

Reviewed By: RyanGlScott, simonpj

Subscribers: alanz, simonpj, rwbarton, mpickering, carter

GHC Trac Issues: #11622, #8708

Differential Revision:

15 months agoDocumentation fixes in 'template-haskell'
Alec Theriault [Thu, 4 Oct 2018 15:19:46 +0000 (11:19 -0400)] 
Documentation fixes in 'template-haskell'

 * Clarify the non-presence of derived classes in reified decls (#15167)
 * Clarify the shallowness of "reifyInstances" (#7066)
 * Mention that 'Typeable' instances are not found by reifyInstances (#11251)
 * Various Haddock markup issues fixed

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15167, #7066, #11251

Differential Revision:

15 months agoImprove generated `GHC.Prim` docs
Alec Theriault [Thu, 4 Oct 2018 15:18:54 +0000 (11:18 -0400)] 
Improve generated `GHC.Prim` docs

* Extended `genprimcode` to generate Haddock-compatible deprecations,
  as well as displaying information about which functions are LLVM-only
  and which functions can fail with an unchecked exception.

* Ported existing deprecations to the new format, and also added a
  deprecation on `par#` (see Trac #15227).

* Emit an error on fixity/deprecation of builtins, unless we are
  processing the module in which that name is defined (see Trac #15233).
  That means the following is no longer accepted (outside of `GHC.Types`):

infixr 7 :
{-# DEPRECATED (:) "cons is deprecated" #-}

* Generate `data (->) a b` with docs and fixity in `GHC.Prim`. This
  means: GHC can now parse `data (->) a b` and `infixr 0 ->` (only in
  `GHC.Prim`) and `genprimcode` can digest `primtype (->) a b` (See Trac

as well as some misc fixes along the way.

Reviewers: bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, mpickering, carter

GHC Trac Issues: #15227, #15233, #4861

Differential Revision:

15 months agoDocument the list data type
Alec Theriault [Thu, 4 Oct 2018 15:18:32 +0000 (11:18 -0400)] 
Document the list data type

Summary: Also qualified some identifier hyperlinks along the way.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #4861

Differential Revision:

15 months agotc-trace changes only
Simon Peyton Jones [Thu, 4 Oct 2018 14:30:04 +0000 (15:30 +0100)] 
tc-trace changes only

15 months agoDistinguish Inferred from Specified tyvars
Simon Peyton Jones [Wed, 3 Oct 2018 15:35:09 +0000 (16:35 +0100)] 
Distinguish Inferred from Specified tyvars

In a declared type we need to distinguish between Inferred
and Specified type variables. This was exposed by Trac #15592.

See Note [Work out final tyConBinders] in TcTyClsDecls.

I had to change the definition of HasField in GHC.Records to
   class HasField x r a | x r -> a where
so as to have an /inferred/ kind argument rather than a
specfied one.  So
   HasField :: forall {k}. k -> * -> * -> Constraint

15 months agoBetter pretty-printing of forall types
Simon Peyton Jones [Wed, 3 Oct 2018 14:58:13 +0000 (15:58 +0100)] 
Better pretty-printing of forall types

Currently forall-types with a lot of type variables,
or type variables with big kinds, are pretty-printed too
horizontally, and dribble off to the right in an illegible

This patch treats the type variables as a group, and uses
'fsep' to lay them out decently.

15 months agoFail fast on pattern synonyms
Simon Peyton Jones [Wed, 3 Oct 2018 14:53:59 +0000 (15:53 +0100)] 
Fail fast on pattern synonyms

We were recovering too eagerly from errors in pattern-synonym
type inference, leading to a cascade of confusing follow up errors
(Trac #15685, #15692).

The underlying issue is that a pattern synonym should have a closed,
fixed type, with no unification variables in it.  But it wasn't!

Fixing this made me change the interface to simplifyInfer slightly.
Instead of /emitting/ a residual implication constraint, it
now /returns/ it, so that the caller can decide what to do.

15 months agoDo not mark CoVars as dead in the occur-anal
Simon Peyton Jones [Wed, 3 Oct 2018 14:41:43 +0000 (15:41 +0100)] 
Do not mark CoVars as dead in the occur-anal

For years we have been marking CoVars as dead, becuase we
don't gather occurrence info from types.  This is obviously
wrong and caused Trac #15695.

See Note [Do not mark CoVars as dead] in OccurAnal.

15 months agoMake Lint check that for CoVars more carefully
Simon Peyton Jones [Wed, 3 Oct 2018 12:28:04 +0000 (13:28 +0100)] 
Make Lint check that for CoVars more carefully

Check than an Id of type (t1 ~# t2) is a CoVar; if not,
it ends up in the wrong simplifier environment, with
strange consequences. (Trac #15648)

15 months agoBetter comments and debug-print only
Simon Peyton Jones [Wed, 3 Oct 2018 12:27:06 +0000 (13:27 +0100)] 
Better comments and debug-print only

15 months agoBetter -ddump-types
Simon Peyton Jones [Wed, 3 Oct 2018 12:24:11 +0000 (13:24 +0100)] 
Better -ddump-types

The debug flag -ddump-types is supposed to show the type
of Ids, and the kinds of type constructors.  It was doing
the former but not the latter -- instead it was using
showTyTying, which is actually less helpful when debugging.

This patch changes it to print the kind and roles of the thing.

I also made -ddump-types show pattern synonyms

15 months agoParse the (!) type operator and allow type operators in existential context
Vladislav Zavialov [Thu, 4 Oct 2018 13:17:55 +0000 (09:17 -0400)] 
Parse the (!) type operator and allow type operators in existential context

Improve the way `(!)`, `(~)`, and other type operators are handled in the parser,
fixing two issues at once:

1. `(!)` can now be used as a type operator
   that respects fixity and precedence (#15457)
2. Existential context of a data constructor
   no longer needs parentheses (#15675)

In addition to that, with this patch it is now trivial to adjust precedence of
the `{-# UNPACK #-}` pragma, as suggested in

There was a small change to API Annotations. Before this patch, `(~)` was a
strange special case that produced an annotation unlike any other type
operator. After this patch, when `(~)` or `(!)` are used to specify strictness they
produce AnnTilde and AnnBang annotations respectively, and when they are used
as type operators, they produce no annotations.

Test Plan: Validate

Reviewers: simonpj, bgamari, alanz, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, mpickering, carter

GHC Trac Issues: #15457, #15675

Differential Revision:

15 months agoMake GHC (the library) flexible in the choice of integer library
Joachim Breitner [Wed, 3 Oct 2018 13:36:55 +0000 (15:36 +0200)] 
Make GHC (the library) flexible in the choice of integer library

We have more and more users of GHC as a library, for example the
These need to make different decisions about various aspects of
code generation than the host compiler, and ideally GHC-the-library
allows them to set the `DynFlags` as needed.

This patch adds a new `DynFlag` that configures which `integer`
library to use. This flag is initialized by `cIntegerLibraryType`
(as before), and is only used in `CorePrep` to decide whether to
use `S#` or not.

The other code paths that were varying based on `cIntegerLibraryType`
are no now longer varying: The trick is to use `integer-wired-in`
as the `-this-unit-id` when compiling either `integer-gmp` or

Test Plan: Validate is happy.

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: TerrorJack, adamse, simonpj, rwbarton, carter

GHC Trac Issues: #13477

Differential Revision:

15 months agodistrib: Remove mention of no-longer-existent make target
Ben Gamari [Wed, 3 Oct 2018 13:35:32 +0000 (15:35 +0200)] 
distrib: Remove mention of no-longer-existent make target

`show-install-setup` used to be defined by `distrib/Makefile` which hasn't been
used in a very long time and was removed from the tree in

Reviewers: monoidal

Reviewed By: monoidal

Subscribers: rwbarton, carter

Differential Revision:

15 months agoDrop accidental write-attributes request
Tamar Christina [Wed, 3 Oct 2018 13:34:56 +0000 (15:34 +0200)] 
Drop accidental write-attributes request

The new filesystem code accidentally asks for write attributes
permissions when doing read-only access.

I believe this is what's causing the GHC 8.6.1 tarballs to fail
when installed to a privileged location.
I haven't been able to reproduce the issue yet, but this permission
bit is wrong anyway.

Test Plan: I'm still trying to workout how to test that this works,
changing the permissions on the folder doesn't seem to reproduce
the error on a tarball I made from before the change.

Reviewers: bgamari, tdammers

Reviewed By: bgamari

Subscribers: tdammers, monoidal, rwbarton, carter

GHC Trac Issues: #15667

Differential Revision:

15 months agoDrop GHC 8.2 compatibility
Ryan Scott [Wed, 3 Oct 2018 12:41:56 +0000 (08:41 -0400)] 
Drop GHC 8.2 compatibility

GHC 8.6.1 is out, so now GHC's support window only extends
back to GHC 8.4. This means we can delete gobs of code that were
only used for GHC 8.2 support. Hooray!

Test Plan: ./validate

Reviewers: bgamari, Phyx, erikd

Reviewed By: bgamari, Phyx

Subscribers: rwbarton, erikd, carter

Differential Revision:

15 months agoGHCi should not filter instances involving cTuples
Alec Theriault [Tue, 2 Oct 2018 12:48:00 +0000 (14:48 +0200)] 
GHCi should not filter instances involving cTuples

Summary: See the new T12005 test case for an example of this.

Test Plan: make TEST=T12005

Reviewers: bgamari, osa1

Reviewed By: osa1

Subscribers: osa1, rwbarton, carter

GHC Trac Issues: #12005

Differential Revision:

15 months add more flags to control the extra flavours (for hadrian)
Alp Mestanogullari [Tue, 2 Oct 2018 12:46:28 +0000 (14:46 +0200)] add more flags to control the extra flavours (for hadrian)

In order to properly honor the different ways in which the RTS must
be built by hadrian, and in particular to have fine grained control over that,
I'm introducing new Cabal flags in rts.cabal[.in]. This should not affect the
make build system and will only be used and picked up by hadrian, which uses
Cabal directly to operate on cabal packages, including libHSrts.

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, carter

Differential Revision:

15 months agoresolve T13704
chessai [Tue, 2 Oct 2018 12:46:08 +0000 (14:46 +0200)] 
resolve T13704

Summary: allow -main-is to change export list for default module
header, allowing one to change the entry point to one's program.

Test Plan: ./validate

Reviewers: bgamari, nomeata, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, carter

GHC Trac Issues: #13704

Differential Revision:

15 months agocircleci: Create missing test-results directory
Ben Gamari [Tue, 2 Oct 2018 13:16:27 +0000 (09:16 -0400)] 
circleci: Create missing test-results directory

15 months agoQuantify class variables first in associated families' kinds
Ryan Scott [Mon, 1 Oct 2018 16:05:12 +0000 (12:05 -0400)] 
Quantify class variables first in associated families' kinds

Previously, `kcLHsQTyVars` would always quantify class-bound
variables invisibly in the kinds of associated types, resulting in
#15591. We counteract this by explicitly passing the class-bound
variables to `kcLHsQTyVars` and quantifying over the ones that are
mentioned in the associated type such that (1) they are specified,
and (2) they come before other kind variables.
See `Note [Kind variable ordering for associated types]`.

Test Plan: make test TEST=T15591

Reviewers: goldfire, simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15591

Differential Revision:

15 months agoFix #15637 by using VTA more in GND
Ryan Scott [Mon, 1 Oct 2018 16:00:52 +0000 (12:00 -0400)] 
Fix #15637 by using VTA more in GND

The code that GND was generating before could crumple over
if it derived an instance for a class with an ambiguous type variable
in the class head, such as the example in #15637. The solution is
straightforward: simply instantiate all variables bound by the class
head explicitly using visible type application, which will nip any
ambiguity in the bud.

Test Plan: make test TEST=T15637

Reviewers: bgamari, simonpj, goldfire

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #15637

Differential Revision:

15 months agocircleci: Run slowtest with multiple threads
Ben Gamari [Mon, 1 Oct 2018 15:46:54 +0000 (11:46 -0400)] 
circleci: Run slowtest with multiple threads

15 months agoghc-prim: Fix typo in traceBinaryEvent# changelog entry
Ben Gamari [Thu, 27 Sep 2018 22:46:53 +0000 (18:46 -0400)] 
ghc-prim: Fix typo in traceBinaryEvent# changelog entry

15 months agoghc-prim: Add missing changelog entry
Ben Gamari [Thu, 27 Sep 2018 22:46:37 +0000 (18:46 -0400)] 
ghc-prim: Add missing changelog entry

15 months agoprimops: Fix documentation of compactAllocateBlock#
Ben Gamari [Wed, 26 Sep 2018 20:03:44 +0000 (16:03 -0400)] 
primops: Fix documentation of compactAllocateBlock#

Pointed out by @andrewthad.

15 months add a 'threaded' flag for hadrian
Alp Mestanogullari [Mon, 1 Oct 2018 13:14:23 +0000 (15:14 +0200)] add a 'threaded' flag for hadrian

hadrian will explicitly enable this flag, but more importantly needs it
as otherwise we just never end up passing -threaded to GHC when building
a new GHC binary. We could quite likely unconditionally pass -threaded,
as the corresponding logic for GhcThreaded in mk/ seems to
always lead to it being set to True, but we instead leave a way out for
anyone in need of a GHC linked against a non-threaded runtime system in
the future.

Test Plan: T8242 (with a GHC built by hadrian)

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

Differential Revision:

15 months agoCodeGen: Teach CodeGen about aliasing of XMM/YMM/ZMM registers
Ben Gamari [Mon, 1 Oct 2018 13:13:32 +0000 (15:13 +0200)] 
CodeGen: Teach CodeGen about aliasing of XMM/YMM/ZMM registers

Reviewers: simonmar

Reviewed By: simonmar

Subscribers: rwbarton, carter

Differential Revision:

15 months agoAlways check the relocation value for x86_64
Zejun Wu [Mon, 1 Oct 2018 13:12:29 +0000 (15:12 +0200)] 
Always check the relocation value for x86_64

Always check that no overflow happens during relocation for x86_64.
It's not safe to assume the result returned by `ocAllocateSymbolExtras` is
always valid if we allocate it neither in lower 2G nor in a contiguous range
with the image.

There are also some minor fixes in this diff:

* `off >= 0x7fffffffL` should be `>`
* use of unaligned pointer is undefined behavior, use `memcpy` instead, gcc
  will be able to optimize it to `mov %edx, (%rax)`.

Test Plan:
build ghci with:


and play with it.


Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: simonmar

Subscribers: alpmestan, rwbarton, carter

Differential Revision:

15 months agoAdd -fkeep-cafs
Simon Marlow [Fri, 28 Sep 2018 12:27:22 +0000 (14:27 +0200)] 
Add -fkeep-cafs

I noticed while playing around with that the main binary needs to
have a custom main function to set `config.keep_cafs = true` when
initialising the runtime. This is pretty annoying, it means an extra
C file with some cryptic incantations in it, and a `-no-hs-main` flag.

So I've replaced this with a link-time flag to GHC, `-fkeep-cafs` that
does the same thing.

Test Plan:
New unit test that tests for the RTS's GC'd CAFs assertion, and also
the -keep-cafs flag.

Reviewers: bgamari, osa1, erikd, noamz

Reviewed By: osa1

Subscribers: rwbarton, carter

Differential Revision:

15 months agoExpose wopt_set/unset_fatal in DynFlags
Neil Mitchell [Wed, 26 Sep 2018 09:58:38 +0000 (10:58 +0100)] 
Expose wopt_set/unset_fatal in DynFlags


15 months agoNormalise EmptyCase types using the constraint solver
Ryan Scott [Fri, 28 Sep 2018 12:22:48 +0000 (14:22 +0200)] 
Normalise EmptyCase types using the constraint solver

Certain `EmptyCase` expressions were mistakently producing
warnings since their types did not have as many type families reduced
as they could have. The most direct way to fix this is to normalise
these types initially using the constraint solver to solve for any
local equalities that may be in scope.

Test Plan: make test TEST=T14813

Reviewers: simonpj, bgamari, goldfire

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #14813

Differential Revision:

15 months agoFix for recover with -fexternal-interpreter (#15418)
Simon Marlow [Wed, 26 Sep 2018 20:32:29 +0000 (15:32 -0500)] 
Fix for recover with -fexternal-interpreter (#15418)

When using -fexternal-interpreter, recover was not treating a Q
compuation that simply registered an error with addErrTc as failing.

Test Plan:
New unit tests:
* T15418 is the repro from in the ticket
* TH_recover_warns is a new test to ensure that we're keeping warnings when
  the body of recover succeeds.

Reviewers: bgamari, RyanGlScott, angerman, goldfire, erikd

Subscribers: rwbarton, carter

GHC Trac Issues: #15418

Differential Revision:

15 months agousers' guide: document -freverse-errors
quasicomputational [Wed, 26 Sep 2018 09:57:38 +0000 (10:57 +0100)] 
users' guide: document -freverse-errors

15 months agoFix constant-folding for Integer shifts
Simon Peyton Jones [Wed, 26 Sep 2018 03:29:19 +0000 (04:29 +0100)] 
Fix constant-folding for Integer shifts

In this patch
    commit 869f69fd4a78371c221e6d9abd69a71440a4679a
    Author: Simon Peyton Jones <>
    Date:   Wed Dec 11 18:19:34 2013 +0000

    Guarding against silly shifts

we deal with silly shifts like (Sll 1 9223372036854775807).  But
I only dealt with primops that Int# and Word#.

Alas, the same problem affects shifts of Integer, as Trac #15673
showed.  Fortunately, the problem is easy to fix.

15 months agoFix Lint of unsaturated type families
Simon Peyton Jones [Tue, 25 Sep 2018 14:19:22 +0000 (15:19 +0100)] 
Fix Lint of unsaturated type families

GHC allows types to have unsaturated type synonyms and type families,
provided they /are/ saturated if you expand all type synonyms.

TcValidity carefully checked this; see check_syn_tc_app.  But
Lint only did half the job, adn that led to Trac #15664.

This patch just teaches Core Lint to be as clever as TcValidity.

15 months agoExpand the Note on let-bound skolems
Simon Peyton Jones [Sun, 23 Sep 2018 14:23:09 +0000 (15:23 +0100)] 
Expand the Note on let-bound skolems

16 months agoAdd regression test for #15666
Ryan Scott [Tue, 25 Sep 2018 12:33:06 +0000 (08:33 -0400)] 
Add regression test for #15666

Commit 59f38587d44efd00b10a6d98f6a7a1b22e87f13a ended up
fixing #15666. Let's add a regression test to ensure that it stays

16 months agoDon't show constraint tuples in errors (#14907)
Alec Theriault [Tue, 25 Sep 2018 09:58:12 +0000 (11:58 +0200)] 
Don't show constraint tuples in errors (#14907)

This means that 'GHC.Classes.(%,%)' is no longer mentioned in
error messages for things like

   class (a,b,c)  -- outside of 'GHC.Classes'
   class (a,Bool)

Test Plan: make TEST=T14907a && make TEST=T14907b

Reviewers: RyanGlScott, bgamari

Reviewed By: RyanGlScott

Subscribers: rwbarton, carter

GHC Trac Issues: #14907

Differential Revision:

16 months agoaclocal.m4: fix shell comment syntax: '#', not '$'
Sergei Trofimovich [Tue, 25 Sep 2018 09:57:35 +0000 (11:57 +0200)] 
aclocal.m4: fix shell comment syntax: '#', not '$'

Reported-by: Evan Laforge
Signed-off-by: Sergei Trofimovich <>
Reviewers: bgamari

Subscribers: rwbarton, erikd, carter

Differential Revision:

16 months agoFix a MSG_BLACKHOLE sanity check, add some comments
Ömer Sinan Ağacan [Mon, 24 Sep 2018 13:21:27 +0000 (16:21 +0300)] 
Fix a MSG_BLACKHOLE sanity check, add some comments

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15508

Differential Revision:

16 months agoAdd a recursivity check in nonVoid
Ryan Scott [Sun, 23 Sep 2018 12:15:13 +0000 (08:15 -0400)] 
Add a recursivity check in nonVoid

Previously `nonVoid` outright refused to call itself
recursively to avoid the risk of hitting infinite loops when
checking recurisve types. But this is too conservative—we //can//
call `nonVoid` recursively as long as we incorporate a way to detect
the presence of recursive types, and bail out if we do detect one.
Happily, such a mechanism already exists in the form of `checkRecTc`,
so let's use it.

Test Plan: make test TEST=T15584

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15584

Differential Revision:

16 months agoFix get getIdFromTrivialExpr
Simon Peyton Jones [Sat, 22 Sep 2018 23:44:14 +0000 (00:44 +0100)] 
Fix get getIdFromTrivialExpr

This bug, discovered by Trac #15325, has been lurking since

  commit 1c9fd3f1c5522372fcaf250c805b959e8090a62c
  Author: Simon Peyton Jones <>
  Date:   Thu Dec 3 12:57:54 2015 +0000

    Case-of-empty-alts is trivial (Trac #11155)

I'd forgotttnen to modify getIdFromTrivialExpr when I
modified exprIsTrivial.   Easy to fix, though.

16 months agoComments only
Simon Peyton Jones [Thu, 20 Sep 2018 19:05:05 +0000 (20:05 +0100)] 
Comments only

16 months agoDon't look up unnecessary return in LastStmt
Simon Peyton Jones [Thu, 20 Sep 2018 19:02:39 +0000 (20:02 +0100)] 
Don't look up unnecessary return in LastStmt

This fixes Trac #15607. The general pattern is well
established (e.g. see the guard_op binding in rnStmt
of BodyStme), but we weren't using it for LastStmt.

16 months agoBuglet in reporting out of scope errors in rules
Simon Peyton Jones [Thu, 20 Sep 2018 18:53:56 +0000 (19:53 +0100)] 
Buglet in reporting out of scope errors in rules

Most out of scope errors get reported by the type checker these
days, but not all.  Example, the function on the LHS of a RULE.

Trace #15659 pointed out that this less-heavily-used code path
produce a "wacky" error message.  Indeed so.  Easily fixed.

16 months agotestsuite: Bump T9630 expected allocations
Ben Gamari [Sat, 22 Sep 2018 15:12:59 +0000 (11:12 -0400)] 
testsuite: Bump T9630 expected allocations

This failed on Darwin.

16 months agotestsuite: Bump expected allocations for T12707
Ben Gamari [Fri, 21 Sep 2018 22:51:38 +0000 (18:51 -0400)] 
testsuite: Bump expected allocations for T12707

16 months agotestsuite: Bump expected allocations of T9675
Ben Gamari [Fri, 21 Sep 2018 20:24:32 +0000 (16:24 -0400)] 
testsuite: Bump expected allocations of T9675

This inexplicably started with 989dca6cbd93, which appears to be a bump of the
`text` submodule. This is very fishy so I've opened #15663 to ensure we

16 months agotestsuite: Fix readFail048 and readFail032 brokenness declarations
Ben Gamari [Fri, 21 Sep 2018 20:18:08 +0000 (16:18 -0400)] 
testsuite: Fix readFail048 and readFail032 brokenness declarations


16 months agotestsuite: Mark readFail032 and readFail048 as broken on Darwin
Ben Gamari [Fri, 21 Sep 2018 16:16:35 +0000 (12:16 -0400)] 
testsuite: Mark readFail032 and readFail048 as broken on Darwin

It looks like Clang's CPP implementation has an off-by-one error here.

16 months agotestsuite: Don't force run of llvm ways in T14251
Ben Gamari [Fri, 21 Sep 2018 15:44:35 +0000 (11:44 -0400)] 
testsuite: Don't force run of llvm ways in T14251

This breaks if LLVM is not available.

16 months agoRemove redundant slop zeroing
Ömer Sinan Ağacan [Fri, 21 Sep 2018 07:08:18 +0000 (10:08 +0300)] 
Remove redundant slop zeroing

OVERWRITE_INFO already does zero slopping by calling OVERWRITING_CLOSURE

16 months agoFix slop zeroing for AP_STACK eager blackholes in debug build
Ömer Sinan Ağacan [Fri, 21 Sep 2018 06:33:38 +0000 (09:33 +0300)] 
Fix slop zeroing for AP_STACK eager blackholes in debug build

As #15571 reports, eager blackholing breaks sanity checks as we can't
zero the payload when eagerly blackholing (because we'll be using the
payload after blackholing), but by the time we blackhole a previously
eagerly blackholed object (in `threadPaused()`) we don't have the
correct size information for the object (because the object's type
becomes BLACKHOLE when we eagerly blackhole it) so can't properly zero
the slop.

This problem can be solved for AP_STACK eager blackholing (which unlike
eager blackholing in general, is not optional) by zeroing the payload
after entering the stack. This patch implements this idea.

Fixes #15571.

Test Plan:
Previously concprog001 when compiled and run with sanity checks

    ghc-stage2 Mult.hs -debug -rtsopts
    ./Mult +RTS -DS

was failing with

    Mult: internal error: checkClosure: stack frame
        (GHC version 8.7.20180821 for x86_64_unknown_linux)
        Please report this as a GHC bug:

thic patch fixes this panic. The test still panics, but it runs for a while
before panicking (instead of directly panicking as before), and the new problem
seems unrelated:

    Mult: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 296
        (GHC version 8.7.20180919 for x86_64_unknown_linux)
        Please report this as a GHC bug:

The new problem will be fixed in another diff.

I also tried slow validate (which requires D5164): this does not introduce any
new failures.

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15571

Differential Revision:

16 months agouser-guide: Allow build with sphinx < 1.8
Ben Gamari [Thu, 20 Sep 2018 21:35:05 +0000 (17:35 -0400)] 
user-guide: Allow build with sphinx < 1.8

Apparently the override argument to add_directive_to_domain was added in sphinx

16 months agousers_guide: fix sphinx error caused by non-explicit override
Zejun Wu [Thu, 20 Sep 2018 20:05:28 +0000 (16:05 -0400)] 
users_guide: fix sphinx error caused by non-explicit override

Encouter following error when `make`:

Extension error:
The 'ghc-flag' directive is already registered to domain std

as we register `ghc-flag` to `std` in `add_object_type` first and then
overtride it in `add_directive_to_domain`.

Test Plan:
  make -C utils/haddock/doc html SPHINX_BUILD=/usr/bin/sphinx-build

Reviewers: austin, bgamari, patrickdoc

Subscribers: rwbarton, carter

Differential Revision:

16 months agousers-guide: Fix build with sphinx 1.8
Ben Gamari [Thu, 20 Sep 2018 12:27:37 +0000 (08:27 -0400)] 
users-guide: Fix build with sphinx 1.8

It seems that both add_object_type and add_directive_to_domain both register a
directive. Previously sphinx didn't seem to mind this but as of Sphinx 1.8 it
crashes with an exception.

16 months agoRevert "adds -latomic to. ghc-prim"
Ben Gamari [Wed, 19 Sep 2018 19:23:27 +0000 (15:23 -0400)] 
Revert "adds -latomic to. ghc-prim"

This commit was never properly justified and relies on the existence of
libatomic, which doesn't appear to exist on Darwin.

This reverts commit ec9aacf3eb2975fd302609163aaef429962ecd87.

16 months agoAdd testcase for #14251
Ben Gamari [Wed, 19 Sep 2018 19:04:11 +0000 (15:04 -0400)] 
Add testcase for #14251

16 months agousers guide: Fix a few issues
Frank Steffahn [Tue, 21 Aug 2018 21:37:33 +0000 (23:37 +0200)] 
users guide: Fix a few issues

16 months agoRemove -Waggregate-return when building RTS
Ömer Sinan Ağacan [Thu, 20 Sep 2018 13:04:11 +0000 (16:04 +0300)] 
Remove -Waggregate-return when building RTS

This causes slow validate build to fail (in Profiling.c:countTickss), and
there's nothing wrong with struct returns.

Reviewers: simonmar, bgamari, erikd

Subscribers: rwbarton, carter

Differential Revision:

16 months agoUse predefined known-key names when possible
Chaitanya Koparkar [Wed, 19 Sep 2018 07:19:53 +0000 (09:19 +0200)] 
Use predefined known-key names when possible

For certain entities in 'PrelNames', we were creating new 'Name's
instead of reusing the ones already defined. Easily fixed.

Test Plan: ./validate

Reviewers: dfeuer, RyanGlScott, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #13279

Differential Revision:

16 months agodocs: fix example code
john [Mon, 17 Sep 2018 06:21:39 +0000 (06:21 +0000)] 
docs: fix example code


16 months agoDon't shortcut SRTs for static functions (#15544)
Simon Marlow [Tue, 18 Sep 2018 15:47:56 +0000 (11:47 -0400)] 
Don't shortcut SRTs for static functions (#15544)

Shortcutting the SRT for a static function can lead to resurrecting a
static object at runtime, which violates assumptions in the GC. See
comments for details.

Test Plan:
- manual testing (in progress)
- validate

Reviewers: osa1, bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15544

Differential Revision:

16 months agoBump deepseq submodule
Ben Gamari [Sun, 16 Sep 2018 20:56:16 +0000 (16:56 -0400)] 
Bump deepseq submodule

(cherry picked from commit c4209ba8a448b501a11d66640d280fe1e194f847)

16 months agoBump text submodule
Ben Gamari [Sun, 16 Sep 2018 20:55:21 +0000 (16:55 -0400)] 
Bump text submodule

(cherry picked from commit a512f1e32bd4d6079559e3172522591863321fe7)

16 months agoBump stm submodule
Ben Gamari [Sun, 16 Sep 2018 20:51:53 +0000 (16:51 -0400)] 
Bump stm submodule

(cherry picked from commit f458bca3a9667af95b8782747eab5b0e70cba4b4)

16 months agoInvert FP conditions to eliminate the explicit NaN check. [Tue, 18 Sep 2018 15:46:38 +0000 (17:46 +0200)] 
Invert FP conditions to eliminate the explicit NaN check.

Optimisation: we don't have to test the parity flag if we
know the test has already excluded the unordered case: eg >
and >= test for a zero carry flag, which can only occur for
ordered operands.

By reversing comparisons we can avoid testing the parity
for < and <= as well. This works since:
* If any of the arguments is an NaN CF gets set. Resulting in a false result.
* Since this allows us to rule out NaN we can exchange the arguments and invert the
  direction of the arrows.

Test Plan: ci/nofib

Reviewers: carter, bgamari, alpmestan

Reviewed By: alpmestan

Subscribers: alpmestan, simonpj, jmct, rwbarton, thomie

GHC Trac Issues: #15196

Differential Revision:

16 months agoFix check whether GCC supports __atomic_ builtins
Ilias Tsitsimpis [Tue, 18 Sep 2018 15:45:17 +0000 (17:45 +0200)] 
Fix check whether GCC supports __atomic_ builtins

C11 atomics are never used because:

* The program used for checking whether GCC supports
__atomic_ builtins fails with the following error:

  error: size mismatch in argument 2 of `__atomic_load`
   int test(int *x) { int y; __atomic_load(&x, &y, __ATOMIC_SEQ_CST); return x; }

* There is a typo when checking if CONF_GCC_SUPPORTS__ATOMICS equals YES,
resulting in PRIM_CFLAGS and PRIM_EXTRA_LIBRARIES never being set.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, erikd, carter

Differential Revision:

16 months agoNoImplicitPrelude in ghc-boot-th, ghc-boot, ghc-heap, ghci
Shayne Fletcher [Tue, 21 Aug 2018 11:58:16 +0000 (07:58 -0400)] 
NoImplicitPrelude in ghc-boot-th, ghc-boot, ghc-heap, ghci


16 months agoUsers guide: EmptyDataDecls on by default
Chris Martin [Thu, 30 Aug 2018 17:23:59 +0000 (13:23 -0400)] 
Users guide: EmptyDataDecls on by default

16 months agoUpdated PE linker, section alignment and cleanup.
Tamar Christina [Mon, 17 Sep 2018 21:06:05 +0000 (22:06 +0100)] 
Updated PE linker, section alignment and cleanup.

This patch is to address a couple of short comings of the PE linker.

The first thing it does is properly honor section alignments, so SSE code
will work reliably.

While doing this I've also changed how it reads and stores ObjectFile
information. Previously the entire object file was read in and treated
as one blob, including headers, symbol tables etc.

Now the ObjectFile is read in but stored in chunks, tables go into a temporary
info struct and code/data into a new private heap. This allows me to free all
meta data once we're done relocating. Which means we can reclaim this memory.

As I've mentioned above I've also moved from using VirtualAlloc to HeapAlloc.
The reason is VirtualAlloc is meant to be used for more low level memory
allocation, it's very fast because it can only allocate whole blocks,
(64k) by default, and the memory must be paged (4k) aligned.

So when you ask for e.g. 30k of memory, you're given a whole block where 34k
will be wasted memory. Nothing else can ever access that untill you free the 30k.

One downside of HeapAlloc is that you're not in control of how the heap grows,
and heap memory is always committed. So it's harder to tell how much we're
actually using now.

Another big upside of splitting off the ObjectCode tables to info structs
is that I can adjust them, so that later addressings can just use array
subscripts to index into them. This simplifies the code a lot and a lot of
complicated casts and indexing can be removed. Leaving less and more simple

This patch doesn't fix the memprotection but it doesn't regress it either.
It does however make the next changes smaller and fixes the alignments.

Test Plan: ./validate , new test T13617

Reviewers: bgamari, erikd, simonmar, hvr, angerman

Reviewed By: angerman

Subscribers: nickkuk, carter, RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13617

Differential Revision:

16 months agoMake sure forM_ and related functions fuse cleanly
Sebastian Graf [Mon, 17 Sep 2018 19:11:09 +0000 (21:11 +0200)] 
Make sure forM_ and related functions fuse cleanly

It was revealed in #8763 that it's hard to come up with a list fusion
helper for `efdtIntFB` that doesn't duplicated occurrences of `c`,
which is crucial in guaranteeing that it is inlined.

Not inlining `c` led to spoiled join points, in turn leading to unnecessary
heap allocation. This patch tackles the problem from a different angle:
Fixing all consumers instead of the less often used producer
`efdtIntFB` by inserting an INLINE pragma in the appropriate places.
See and the new
Note [List fusion and continuations in 'c'].

A quick run of NoFib revealed no regression or improvements whatsoever.

Reviewers: hvr, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #8763

Differential Revision:

16 months agousers-guide: Fix code-block layout for QuantifiedConstraints
Takenobu Tani [Mon, 17 Sep 2018 14:47:02 +0000 (16:47 +0200)] 
users-guide: Fix code-block layout for QuantifiedConstraints

Fix code-block layout for QuantifiedConstraints.

[ci skip]

Test Plan: build

Reviewers: bgamari, monoidal

Reviewed By: monoidal

Subscribers: rwbarton, carter

Differential Revision:

16 months agobase: Add bangs to GHC.IO.Handle.Text hGet* functions
Ben Gamari [Mon, 17 Sep 2018 14:46:26 +0000 (16:46 +0200)] 
base: Add bangs to GHC.IO.Handle.Text hGet* functions

I believe that demand analysis doesn't notice that these are morally strict in
the pointer argument due to the `count == 0` special case. Fixes #15638.

Test Plan: Validate

Reviewers: andrewthad, hvr

Reviewed By: andrewthad

Subscribers: rwbarton, carter

GHC Trac Issues: #15638

Differential Revision:

16 months agoStable name comment wibbles
David Feuer [Mon, 17 Sep 2018 14:46:05 +0000 (16:46 +0200)] 
Stable name comment wibbles

Some comments in the `StableName` code still referred to
stable pointer details. Fix that.

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, carter

Differential Revision:

16 months agoFix for #13862: Optional "-v" not allowed with :load in GHCi
roland [Sun, 16 Sep 2018 16:06:13 +0000 (19:06 +0300)] 
Fix for #13862: Optional "-v" not allowed with :load in GHCi

Replace the error message
    `Use -v to see a list of the files searched for.`
    `Use -v (or :set -v` in ghci) to see a list of the files searched for.`

Reviewers: bgamari, monoidal, thomie, osa1

Subscribers: rwbarton, carter

GHC Trac Issues: #13862

Differential Revision:

16 months agoCorrect submodule update for haddock
Richard Eisenberg [Sat, 15 Sep 2018 19:41:39 +0000 (15:41 -0400)] 
Correct submodule update for haddock

Previous commit (Coercion Quantification) was missing a
commit on the haddock submodule. This (hopefully) corrects it.

16 months agoCoercion Quantification
ningning [Sat, 15 Sep 2018 14:16:47 +0000 (10:16 -0400)] 
Coercion Quantification

This patch corresponds to #15497.

According to,
 we would like to have coercion quantifications back. This will
allow us to migrate (~#) to be homogeneous, instead of its current
heterogeneous definition. This patch is (lots of) plumbing only. There
should be no user-visible effects.

An overview of changes:

- Both `ForAllTy` and `ForAllCo` can quantify over coercion variables,
but only in *Core*. All relevant functions are updated accordingly.
- Small changes that should be irrelevant to the main task:
    1. removed dead code `mkTransAppCo` in Coercion
    2. removed out-dated Note Computing a coercion kind and
       roles in Coercion
    3. Added `Eq4` in Note Respecting definitional equality in
       TyCoRep, and updated `mkCastTy` accordingly.
    4. Various updates and corrections of notes and typos.
- Haddock submodule needs to be changed too.

This work was completed mostly during Ningning Xie's Google Summer
of Code, sponsored by Google. It was advised by Richard Eisenberg,
supported by NSF grant 1704041.

Test Plan: ./validate

Reviewers: goldfire, simonpj, bgamari, hvr, erikd, simonmar

Subscribers: RyanGlScott, monoidal, rwbarton, carter

GHC Trac Issues: #15497

Differential Revision:

16 months agoMark code related symbols as @function not @object
Sergei Azovskov [Fri, 14 Sep 2018 14:09:59 +0000 (15:09 +0100)] 
Mark code related symbols as @function not @object

This diff is a part of the bigger project which goal is to improve
common profiling tools support (perf) for GHC binaries.

A similar job was already done and reverted in the past:


`Perf` and similar tools build in memory symbol table from the .symtab
section of the ELF file to display human-readable function names instead
of the addresses in the output. `Perf` uses only two types of symbols:
`@function` and `@notype` but GHC is not capable to produce any
`@function` symbols so the `perf` output is pretty useless (All the
haskell symbols that you can see in `perf` now are `@notype` internal
symbols extracted by mistake/hack).

The changes:
 * mark code related symbols as @function
 * small hack to mark InfoTable symbols as code if TABLES_NEXT_TO_CODE is true

 * The perf symbolization support is not complete after this patch but
   I'm working on the second patch.
 * Constructor symbols are not supported. To fix that we can issue extra
   local symbols which mark code sections as code and will be only used
   for debug.

Test Plan:
any additional ideas?

Perf output on stock ghc 8.4.1:
     9.78%  FibbSlow  FibbSlow            [.] ckY_info
     9.59%  FibbSlow  FibbSlow            [.] cjqd_info
     7.17%  FibbSlow  FibbSlow            [.] c3sg_info
     6.62%  FibbSlow  FibbSlow            [.] c1X_info
     5.32%  FibbSlow  FibbSlow            [.] cjsX_info
     4.18%  FibbSlow  FibbSlow            [.] s3rN_info
     3.82%  FibbSlow  FibbSlow            [.] c2m_info
     3.68%  FibbSlow  FibbSlow            [.] cjlJ_info
     3.26%  FibbSlow  FibbSlow            [.] c3sb_info
     3.19%  FibbSlow  FibbSlow            [.] cjPQ_info
     3.05%  FibbSlow  FibbSlow            [.] cjQd_info
     2.97%  FibbSlow  FibbSlow            [.] cjAB_info
     2.78%  FibbSlow  FibbSlow            [.] cjzP_info
     2.40%  FibbSlow  FibbSlow            [.] cjOS_info
     2.38%  FibbSlow  FibbSlow            [.] s3rK_info
     2.27%  FibbSlow  FibbSlow            [.] cjq0_info
     2.18%  FibbSlow  FibbSlow            [.] cKQ_info
     2.13%  FibbSlow  FibbSlow            [.] cjSl_info
     1.99%  FibbSlow  FibbSlow            [.] s3rL_info
     1.98%  FibbSlow  FibbSlow            [.] c2cC_info
     1.80%  FibbSlow  FibbSlow            [.] s3rO_info
     1.37%  FibbSlow  FibbSlow            [.] c2f2_info

Perf output on patched ghc:
     7.97%  FibbSlow  FibbSlow            [.] c3rM_info
     6.75%  FibbSlow  FibbSlow            [.] 0x000000000032cfa8
     6.63%  FibbSlow  FibbSlow            [.] cifA_info
     4.98%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
     4.55%  FibbSlow  FibbSlow            [.] chXn_info
     4.52%  FibbSlow  FibbSlow            [.] c3rH_info
     4.45%  FibbSlow  FibbSlow            [.] chZB_info
     4.04%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
     4.03%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
     3.76%  FibbSlow  FibbSlow            [.] chXA_info
     3.67%  FibbSlow  FibbSlow            [.] cifu_info
     3.25%  FibbSlow  FibbSlow            [.] ci4r_info
     2.64%  FibbSlow  FibbSlow            [.] s3rf_info
     2.42%  FibbSlow  FibbSlow            [.] s3rg_info
     2.39%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
     2.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
     2.17%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
     2.09%  FibbSlow  FibbSlow            [.] cicc_info
     2.03%  FibbSlow  FibbSlow            [.] 0x0000000000331e15
     2.02%  FibbSlow  FibbSlow            [.] s3ri_info
     1.91%  FibbSlow  FibbSlow            [.] 0x0000000000331bb8
     1.89%  FibbSlow  FibbSlow            [.] ci4N_info

Reviewers: simonmar, niteria, bgamari, goldfire

Reviewed By: simonmar, bgamari

Subscribers: lelf, rwbarton, thomie, carter

GHC Trac Issues: #15501

Differential Revision:

16 months agoMark system and internal symbols as private symbols in asm
Sergei Azovskov [Fri, 14 Sep 2018 13:56:37 +0000 (14:56 +0100)] 
Mark system and internal symbols as private symbols in asm

This marks system and internal symbols as private in asm output so those
random generated sysmbols won't appear in .symtab

 * internal symbols don't help to debug because names are just random
 * the symbols style breaks perf logic
 * internal symbols can take ~75% of the .symtab. In the same time
   .symtab can take about 20% of the binary file size

This diff mostly makes sense on top of the D4713 (or similar)

Test Plan:

Perf from D4713
     7.97%  FibbSlow  FibbSlow            [.] c3rM_info
     6.75%  FibbSlow  FibbSlow            [.] 0x000000000032cfa8
     6.63%  FibbSlow  FibbSlow            [.] cifA_info
     4.98%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
     4.55%  FibbSlow  FibbSlow            [.] chXn_info
     4.52%  FibbSlow  FibbSlow            [.] c3rH_info
     4.45%  FibbSlow  FibbSlow            [.] chZB_info
     4.04%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
     4.03%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
     3.76%  FibbSlow  FibbSlow            [.] chXA_info
     3.67%  FibbSlow  FibbSlow            [.] cifu_info
     3.25%  FibbSlow  FibbSlow            [.] ci4r_info
     2.64%  FibbSlow  FibbSlow            [.] s3rf_info
     2.42%  FibbSlow  FibbSlow            [.] s3rg_info
     2.39%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
     2.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
     2.17%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
     2.09%  FibbSlow  FibbSlow            [.] cicc_info
     2.03%  FibbSlow  FibbSlow            [.] 0x0000000000331e15
     2.02%  FibbSlow  FibbSlow            [.] s3ri_info
     1.91%  FibbSlow  FibbSlow            [.] 0x0000000000331bb8
     1.89%  FibbSlow  FibbSlow            [.] ci4N_info

Perf from this patch:
    15.37%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
    15.33%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
    13.34%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
     9.24%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_plusInteger_info
     9.08%  FibbSlow  FibbSlow            [.] frame_dummy
     8.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
     4.29%  FibbSlow  FibbSlow            [.] 0x0000000000321ab0
     3.84%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
     3.07%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
     2.39%  FibbSlow  FibbSlow            [.] 0x0000000000321ab7
     1.90%  FibbSlow  FibbSlow            [.] 0x00000000003266b8
     1.88%  FibbSlow  FibbSlow            [.] base_GHCziNum_zm_info
     1.83%  FibbSlow  FibbSlow            [.] 0x0000000000326915
     1.34%  FibbSlow  FibbSlow            [.] 0x00000000003248cc
     1.07%  FibbSlow  FibbSlow            [.] base_GHCziNum_zp_info
     0.98%  FibbSlow  FibbSlow            [.] 0x00000000003247c8
     0.80%  FibbSlow  FibbSlow            [.] 0x0000000000121498
     0.79%  FibbSlow  FibbSlow            [.] stg_gc_noregs
     0.75%  FibbSlow  FibbSlow            [.] 0x0000000000321ad6
     0.67%  FibbSlow  FibbSlow            [.] 0x0000000000321aca
     0.64%  FibbSlow  FibbSlow            [.] 0x0000000000321b4a
     0.61%  FibbSlow  FibbSlow            [.] 0x00000000002ff633

Reviewers: simonmar, niteria, bgamari

Reviewed By: simonmar

Subscribers: lelf, angerman, olsner, rwbarton, thomie, carter

Differential Revision:

16 months agoFix T15502 on 32-bit
Krzysztof Gogolewski [Fri, 14 Sep 2018 12:38:42 +0000 (14:38 +0200)] 
Fix T15502 on 32-bit

The expected output uses a hardcoded value for
maxBound :: Int.

This should fix one of circleci failures on i386.

Test Plan: make test TEST=T15502

Reviewers: RyanGlScott, bgamari

Reviewed By: RyanGlScott

Subscribers: rwbarton, carter

GHC Trac Issues: #15502

Differential Revision:

16 months agotests: increase (compile) timeout multiplier for T13701 and MultiLayerModules
Alp Mestanogullari [Fri, 14 Sep 2018 12:01:09 +0000 (14:01 +0200)] 
tests: increase (compile) timeout multiplier for T13701 and MultiLayerModules

Those tests are currently making our i386 validation fail on CircleCI:

Test Plan: Using my Phab<->CircleCI bridge to run i386 validation for this diff.

Reviewers: bgamari, monoidal

Reviewed By: monoidal

Subscribers: rwbarton, carter

GHC Trac Issues: #15484, #15383

Differential Revision:

16 months agoAdd support for ImplicitParams and RecursiveDo in TH
Michael Sloan [Fri, 14 Sep 2018 10:17:13 +0000 (12:17 +0200)] 
Add support for ImplicitParams and RecursiveDo in TH

This adds TH support for the ImplicitParams and RecursiveDo extensions.

I'm submitting this as one review because I cannot cleanly make
the two commits independent.

Initially, my goal was just to add ImplicitParams support, and
I found that reasonably straightforward, so figured I might
as well use my newfound knowledge to address some other TH omissions.

Test Plan: Validate

Reviewers: goldfire, austin, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: carter, RyanGlScott, thomie

GHC Trac Issues: #1262

Differential Revision:

16 months agoUpdate hsc2hs submodule
Chaitanya Koparkar [Thu, 13 Sep 2018 22:15:18 +0000 (18:15 -0400)] 
Update hsc2hs submodule

Test Plan: ./validate

Reviewers: bgamari, hvr, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: monoidal, rwbarton, carter

Differential Revision:

16 months agobase: showEFloat: Handle negative precisions the same of zero precision
Ben Gamari [Thu, 13 Sep 2018 21:09:56 +0000 (17:09 -0400)] 
base: showEFloat: Handle negative precisions the same of zero precision

Test Plan: Validate

Reviewers: hvr, alpmestan

Reviewed By: alpmestan

Subscribers: rwbarton, carter

GHC Trac Issues: #15509

Differential Revision:

16 months agoeventlog: Factor out eventlog header generation into separate function
Ben Gamari [Thu, 13 Sep 2018 15:31:08 +0000 (11:31 -0400)] 
eventlog: Factor out eventlog header generation into separate function

16 months agoFix build
Krzysztof Gogolewski [Thu, 13 Sep 2018 20:52:05 +0000 (22:52 +0200)] 
Fix build

16 months agoRemove dead variable binding
Simon Peyton Jones [Thu, 13 Sep 2018 16:47:50 +0000 (17:47 +0100)] 
Remove dead variable binding

Fallout from earlier commit, sorry.

16 months agoMore info for Implication with -dppr-debug
Simon Peyton Jones [Thu, 13 Sep 2018 11:56:29 +0000 (12:56 +0100)] 
More info for Implication with -dppr-debug

16 months agoAdd regression test for Trac #15629
Simon Peyton Jones [Thu, 13 Sep 2018 11:56:09 +0000 (12:56 +0100)] 
Add regression test for Trac #15629

16 months agoAllow (~) in the head of a quantified constraints
Simon Peyton Jones [Thu, 13 Sep 2018 10:23:53 +0000 (11:23 +0100)] 
Allow (~) in the head of a quantified constraints

Since the introduction of quantified constraints, GHC has rejected
a quantified constraint with (~) in the head, thus
  f :: (forall a. blah => a ~ ty) => stuff

I am frankly dubious that this is ever useful.  But /is/ necessary for
Coercible (representation equality version of (~)) and it does no harm
to allow it for (~) as well.  Plus, our users are asking for it
(Trac #15359, #15625).

It was really only excluded by accident, so
this patch lifts the restriction. See TcCanonical
Note [Equality superclasses in quantified constraints]

There are a number of wrinkles:

* If the context of the quantified constraint is empty, we
  can get trouble when we get down to unboxed equality (a ~# b)
  or (a ~R# b), as Trac #15625 showed. This is even more of
  a corner case, but it produced an outright crash, so I elaborated
  the superclass machinery in TcCanonical.makeStrictSuperClasses
  to add a void argument in this case.  See
  Note [Equality superclasses in quantified constraints]

* The restriction on (~) was in TcValidity.checkValidInstHead.
  In lifting the restriction I discovered an old special case for
  (~), namely
      | clas_nm `elem` [ heqTyConName, eqTyConName]
      , nameModule clas_nm /= this_mod
  This was (solely) to support the strange instance
      instance a ~~ b => a ~ b
  in Data.Type.Equality. But happily that is no longer
  with us, since
     commit f265008fb6f70830e7e92ce563f6d83833cef071
     Refactor (~) to reduce the suerpclass stack
  So I removed the special case.

* I found that the Core invariants on when we could have
       co = <expr>
  were entirely not written down. (Getting this wrong ws
  the proximate source of the crash in Trac #15625.  So

  - Documented them better in CoreSyn
      Note [CoreSyn type and coercion invariant],
  - Modified CoreOpt and CoreLint to match
  - Modified CoreUtils.bindNonRec to match
  - Made MkCore.mkCoreLet use bindNonRec, rather
    than duplicate its logic
  - Made Simplify.rebuildCase case-to-let respect
      Note [CoreSyn type and coercion invariant],

16 months agoComments only (on IfDataInstance)
Simon Peyton Jones [Thu, 13 Sep 2018 08:18:25 +0000 (09:18 +0100)] 
Comments only (on IfDataInstance)

16 months agoDelete duplicated comment line
Simon Peyton Jones [Wed, 12 Sep 2018 12:21:19 +0000 (13:21 +0100)] 
Delete duplicated comment line

16 months agoComments about join-point return types
Simon Peyton Jones [Wed, 12 Sep 2018 12:21:02 +0000 (13:21 +0100)] 
Comments about join-point return types