ghc.git
3 years ago{,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE
Tomas Carnecky [Thu, 19 May 2016 19:04:04 +0000 (21:04 +0200)] 
{,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE

Reviewers: austin, erikd, simonmar, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2241

3 years agoGet types in osFreeMBlocks in sync with osGetMBlocks
Tomas Carnecky [Thu, 19 May 2016 19:03:42 +0000 (21:03 +0200)] 
Get types in osFreeMBlocks in sync with osGetMBlocks

The first argument of 'osFreeMBlocks' ought to have the same type as the
return value from 'osGetMBlocks'. Make it so.

Reviewers: austin, simonmar, bgamari

Reviewed By: bgamari

Subscribers: erikd, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D2235

3 years agoRemove use of caddr_t
Tomas Carnecky [Thu, 19 May 2016 19:03:32 +0000 (21:03 +0200)] 
Remove use of caddr_t

> caddr_t is a legacy BSD type associated with some low level calls like
> mmap, and it should never be used in modern code. It was rejected by
> the POSIX standard. The standardized mmap uses void *.

(http://stackoverflow.com/questions/6381526/what-is-the-significance-of-
caddr-t-and-when-is-it-used)

Reviewers: austin, simonmar, rwbarton, bgamari, erikd

Reviewed By: rwbarton, bgamari, erikd

Subscribers: erikd, thomie

Differential Revision: https://phabricator.haskell.org/D2234

3 years agoAdd libraries/ghci/GNUmakefile to .gitignore [skip ci]
Thomas Miedema [Thu, 19 May 2016 14:04:29 +0000 (16:04 +0200)] 
Add libraries/ghci/GNUmakefile to .gitignore [skip ci]

3 years agoTestsuite: fix T11827 (#11827)
Thomas Miedema [Thu, 19 May 2016 12:29:44 +0000 (14:29 +0200)] 
Testsuite: fix T11827 (#11827)

It didn't trigger the bug before.

3 years agotestsuite: Add expected output for T11108
Ben Gamari [Thu, 19 May 2016 12:14:40 +0000 (14:14 +0200)] 
testsuite: Add expected output for T11108

3 years agoComments only
Simon Peyton Jones [Thu, 19 May 2016 09:44:02 +0000 (10:44 +0100)] 
Comments only

3 years agoComments only
Simon Peyton Jones [Thu, 19 May 2016 09:43:45 +0000 (10:43 +0100)] 
Comments only

3 years agoImprove documentation for type wildcards
Simon Peyton Jones [Wed, 18 May 2016 16:13:29 +0000 (17:13 +0100)] 
Improve documentation for type wildcards

This docmentation improvement was triggered by Trac #12072

3 years agoImprove pretty-printing of equalities
Simon Peyton Jones [Mon, 16 May 2016 12:42:22 +0000 (13:42 +0100)] 
Improve pretty-printing of equalities

The previous pretty-printer didn't account for partially
applied equalities, causing Trac #12041

3 years agoFix Trac #12051
Simon Peyton Jones [Mon, 16 May 2016 12:41:06 +0000 (13:41 +0100)] 
Fix Trac #12051

A minor parser issue, allowing a mal-formed data constructor
through.

3 years agoKill varEnvElts in tcPragExpr
Bartosz Nitka [Wed, 18 May 2016 23:47:29 +0000 (16:47 -0700)] 
Kill varEnvElts in tcPragExpr

I had to refactor some things to take VarSet instead of [Var],
but I think it's more precise this way.

Test Plan: ./validate

Reviewers: simonmar, simonpj, austin, bgamari, goldfire

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2227

GHC Trac Issues: #4012

3 years agoKill varSetElems in tidyFreeTyCoVars
Bartosz Nitka [Wed, 18 May 2016 17:36:49 +0000 (10:36 -0700)] 
Kill varSetElems in tidyFreeTyCoVars

I haven't observed this to have an effect on nondeterminism,
but tidyOccName appears to modify the TidyOccEnv in a
way dependent on the order of inputs.
It's easy enough to change it to be deterministic to be on the
safe side.

Test Plan: ./validate

Reviewers: simonmar, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2238

GHC Trac Issues: #4012

3 years agorts: Add missing `const` from HashTable API
Erik de Castro Lopo [Wed, 18 May 2016 20:19:24 +0000 (06:19 +1000)] 
rts: Add missing `const` from HashTable API

Thanks to Tamar Christina (Phyx) for spotting this.

Test Plan: Validate

Reviewers: simonmar, austin, trofi, bgamari, hsyl20, Phyx

Reviewed By: Phyx

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2236

3 years agoFailing test case for #12076.
Edward Z. Yang [Tue, 17 May 2016 04:05:24 +0000 (21:05 -0700)] 
Failing test case for #12076.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2229

GHC Trac Issues: #12076

3 years agoAdd (broken) test for #12063.
Edward Z. Yang [Sun, 15 May 2016 23:29:35 +0000 (16:29 -0700)] 
Add (broken) test for #12063.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2222

GHC Trac Issues: #12063

3 years agoCLabel: Catch #11155 during C-- pretty-printing
Ben Gamari [Tue, 17 May 2016 17:16:30 +0000 (19:16 +0200)] 
CLabel: Catch #11155 during C-- pretty-printing

In #11555 we ended up generating references to the non-existence
stg_ap_0_upd. Here we add asserts to verify that we don't generate
references to non-existent selector or application symbols.

It would likely also make sense to add further asserts during code
generation, so we can catch the issue even closer to its source.

Test Plan: Validate

Reviewers: simonmar, austin, ezyang

Reviewed By: simonmar, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2230

GHC Trac Issues: #11155

3 years agorts: Add isPinnedByteArray# primop
Ben Gamari [Tue, 17 May 2016 17:05:26 +0000 (19:05 +0200)] 
rts: Add isPinnedByteArray# primop

Adds a primitive operation to determine whether a particular
`MutableByteArray#` is backed by a pinned buffer.

Test Plan: Validate with included testcase

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2217

GHC Trac Issues: #12059

3 years agoRework parser to allow use with DynFlags
Dave Laing [Tue, 17 May 2016 17:03:41 +0000 (19:03 +0200)] 
Rework parser to allow use with DynFlags

Split out the options needed by the parser from DynFlags, making the
parser more friendly to standalone usage.

Test Plan: validate

Reviewers: simonmar, alanz, bgamari, austin, thomie

Reviewed By: simonmar, alanz, bgamari, thomie

Subscribers: thomie, mpickering

Differential Revision: https://phabricator.haskell.org/D2208

GHC Trac Issues: #10961

3 years agoAdd a test for #11108
Ben Gamari [Tue, 17 May 2016 17:03:16 +0000 (19:03 +0200)] 
Add a test for #11108

Reviewers: austin, simonmar, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2196

GHC Trac Issues: #11108

3 years agoFix histograms for ticky code
Mateusz Lenik [Tue, 17 May 2016 06:33:54 +0000 (08:33 +0200)] 
Fix histograms for ticky code

This patch fixes Cmm generation required to produce histograms when
compiling with -ticky flag, strips dead code from rts/Ticky.c and
reworks it to use a shared constant in both C and Haskell code.

Fixes #8308.

Test Plan: T8308

Reviewers: jstolarek, simonpj, austin

Reviewed By: simonpj

Subscribers: mpickering, simonpj, bgamari, mlen, thomie, jstolarek

Differential Revision: https://phabricator.haskell.org/D931

GHC Trac Issues: #8308

3 years agoMake inert_model and inert_eqs deterministic sets
Bartosz Nitka [Tue, 17 May 2016 12:45:43 +0000 (05:45 -0700)] 
Make inert_model and inert_eqs deterministic sets

The order inert_model and intert_eqs fold affects the order that the
typechecker looks at things. I've been able to experimentally confirm
that the order of equalities and the order of the model matter for
determinism. This is just a straigthforward replacement of
nondeterministic VarEnv for deterministic DVarEnv.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2232

GHC Trac Issues: #4012

3 years agoUpdate .mailmap [skip ci]
Thomas Miedema [Tue, 17 May 2016 17:33:01 +0000 (19:33 +0200)] 
Update .mailmap [skip ci]

3 years agoTestsuite: don't warn when mk/ghcconfig_* hasn't been created yet
Thomas Miedema [Wed, 18 May 2016 09:08:55 +0000 (11:08 +0200)] 
Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet

[skip ci]

3 years agoTestsuite: T10052 requires interpreter (#11730)
Thomas Miedema [Wed, 18 May 2016 09:07:35 +0000 (11:07 +0200)] 
Testsuite: T10052 requires interpreter (#11730)

3 years agorts: More const correct-ness fixes
Erik de Castro Lopo [Tue, 17 May 2016 20:33:03 +0000 (06:33 +1000)] 
rts: More const correct-ness fixes

In addition to more const-correctness fixes this patch fixes an
infelicity of the previous const-correctness patch (995cf0f356) which
left `UNTAG_CLOSURE` taking a `const StgClosure` pointer parameter
but returning a non-const pointer. Here we restore the original type
signature of `UNTAG_CLOSURE` and add a new function
`UNTAG_CONST_CLOSURE` which takes and returns a const `StgClosure`
pointer and uses that wherever possible.

Test Plan: Validate on Linux, OS X and Windows

Reviewers: Phyx, hsyl20, bgamari, austin, simonmar, trofi

Reviewed By: simonmar, trofi

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2231

3 years agorules/build-prog: Ensure programs depend upon their transitive deps
Ben Gamari [Tue, 17 May 2016 16:05:24 +0000 (18:05 +0200)] 
rules/build-prog: Ensure programs depend upon their transitive deps

Previously programs only depended upon the direct dependencies; while I
would have thought that this would be sufficient, somehow we were
getting to the link step of building `ghc-pkg` before `ghc-boot-th` was
built (despite the fact that `ghc-boot` has a direct dependency on
`ghc-boot-th`).

See #12078.

3 years agorules: Fix name of ghc-boot-th library
Ben Gamari [Tue, 17 May 2016 13:18:37 +0000 (15:18 +0200)] 
rules: Fix name of ghc-boot-th library

There was a missing `#`. Hadrian couldn't come soon enough.

3 years agoDelete libraries/ghci/GNUmakefile [skip ci]
Thomas Miedema [Tue, 17 May 2016 16:05:28 +0000 (18:05 +0200)] 
Delete libraries/ghci/GNUmakefile [skip ci]

This file should not have been included in the repository, as it is
generated by `./boot`.

3 years agoTestsuite: don't skip concio001 and concio001_thr
Thomas Miedema [Mon, 25 Apr 2016 18:33:52 +0000 (20:33 +0200)] 
Testsuite: don't skip concio001 and concio001_thr

I think they were skipped before because they write to the same output
file (concio001). This is no longer a problem.

3 years agoTestsuite: delete unused file [skip ci]
Thomas Miedema [Fri, 6 May 2016 08:12:38 +0000 (10:12 +0200)] 
Testsuite: delete unused file [skip ci]

3 years agoTestsuite: delete old cleanup code (#11980)
Thomas Miedema [Sun, 24 Apr 2016 14:24:25 +0000 (16:24 +0200)] 
Testsuite: delete old cleanup code (#11980)

3 years agoTestsuite: run tests in /tmp after copying required files
Thomas Miedema [Sat, 29 Aug 2015 13:52:43 +0000 (15:52 +0200)] 
Testsuite: run tests in /tmp after copying required files

Major change to the testsuite driver.

For each TEST:
   * create a directory `<testdir>` inside `/tmp`.

   * link/copy all source files that the test needs into `<testdir>`.

   * run the test inside `<testdir>`.

   * delete `<testdir>`

Extra files are (temporarily) tracked in
`testsuite/driver/extra_files.py`, but can also be specified using the
`extra_files` setup function.

Differential Revision: https://phabricator.haskell.org/D1187

Reviewed by: Rufflewind, bgamari

Trac: #11980

3 years agoDocument determinism in shortOutIndirections
Bartosz Nitka [Tue, 17 May 2016 09:46:30 +0000 (02:46 -0700)] 
Document determinism in shortOutIndirections

varEnvElts didn't introduce nondeterminism here. This makes it
obvious that it could and explains why it doesn't.

Test Plan: ./validate

Reviewers: bgamari, simonmar, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2228

GHC Trac Issues: #4012

3 years agoAdd ghc-boot-th to rules/foreachLibrary
Ben Gamari [Tue, 17 May 2016 07:53:00 +0000 (09:53 +0200)] 
Add ghc-boot-th to rules/foreachLibrary

This may have been the cause of various build failures on FreeBSD and
Solaris.

3 years agoSet `USE_MMAP` at configure time
Erik de Castro Lopo [Mon, 16 May 2016 03:59:57 +0000 (13:59 +1000)] 
Set `USE_MMAP` at configure time

Summary:
The `USE_MMAP` macro is used in the run time linker and was being set with
some really ugly CPP hackery. Setting in the configure script is much
neater.

Reviewers: rwbarton, hvr, austin, simonmar, bgamari

Reviewed By: hvr, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2223

3 years agoRemove html_theme requirement of haddock docs
Ben Gamari [Mon, 16 May 2016 19:07:13 +0000 (21:07 +0200)] 
Remove html_theme requirement of haddock docs

Updates haddock submodule.

3 years agoAnother bump of haddock submodule
Ben Gamari [Mon, 16 May 2016 17:37:11 +0000 (19:37 +0200)] 
Another bump of haddock submodule

Trying to ensure consistent haddock documentation across Sphinx versions
is far too much work for too little benefit; reverting Alabaster
vendorization.

3 years agoKill varSetElems in tcInferPatSynDecl
Bartosz Nitka [Mon, 16 May 2016 10:27:53 +0000 (03:27 -0700)] 
Kill varSetElems in tcInferPatSynDecl

varSetElems introduces unnecessary non-determinism and while
I didn't estabilish experimentally that this matters here
I'm convinced that it will, because I expect pattern synonyms
to end up in interface files.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, mpickering, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2206

GHC Trac Issues: #4012

3 years agoMove Extension type to ghc-boot-th
Ben Gamari [Mon, 16 May 2016 13:21:34 +0000 (15:21 +0200)] 
Move Extension type to ghc-boot-th

This creates a new package, `ghc-boot-th`, to contain the `Extension`
type, which now lives in `GHC.LanguageExtension.Type`. This ensures that
the transitive dependency set of the `template-haskell` package remains
minimal.

The `GHC.LanguageExtensions.Type` module is also re-exported by
`ghc-boot`, which provides an orphan `binary` instance as well.

Test Plan: Validate

Reviewers: goldfire, thomie, hvr, austin

Reviewed By: thomie

Subscribers: RyanGlScott, thomie, erikd, ezyang

Differential Revision: https://phabricator.haskell.org/D2224

3 years agotestsuite/ImpSafe03: Normalize version of bytestring
Ben Gamari [Mon, 16 May 2016 13:56:09 +0000 (15:56 +0200)] 
testsuite/ImpSafe03: Normalize version of bytestring

3 years agoPPC: Implement SMP primitives using gcc built-ins
Peter Trommler [Mon, 16 May 2016 13:19:09 +0000 (15:19 +0200)] 
PPC: Implement SMP primitives using gcc built-ins

The SMP primitives were missing appropriate memory barriers
(sync, isync instructions) on all PowerPCs.

Use the built-ins _sync_* provided by gcc and clang. This
reduces code size significantly.

Remove broken mark for concprog001 on powerpc64. The referenced
ticket number (11259) was wrong.

Test Plan: validate on powerpc and ARM

Reviewers: erikd, austin, simonmar, bgamari, hvr

Reviewed By: bgamari, hvr

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2225

GHC Trac Issues: #12070

3 years agoPPC NCG: Fix pretty printing of st[wd]ux instr.
Peter Trommler [Mon, 16 May 2016 13:16:49 +0000 (15:16 +0200)] 
PPC NCG: Fix pretty printing of st[wd]ux instr.

Printing STU was mixed up. The tab character must appear
after the 'x'.

Test Plan: validate on powerpc

Reviewers: bgamari, austin, erikd

Reviewed By: austin, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2214

GHC Trac Issues: #12054

3 years agoBump haddock submodule
Ben Gamari [Mon, 16 May 2016 13:14:18 +0000 (15:14 +0200)] 
Bump haddock submodule

Vendorise alabaster theme for older sphinx releases.

3 years agoUpdate bytestring submodule to 0.10.8.1 release tag
Herbert Valerio Riedel [Sun, 15 May 2016 21:19:18 +0000 (23:19 +0200)] 
Update bytestring submodule to 0.10.8.1 release tag

3 years agoFix a performance issue with -fprint-expanded-synonyms
Ömer Sinan Ağacan [Sun, 15 May 2016 11:04:39 +0000 (07:04 -0400)] 
Fix a performance issue with -fprint-expanded-synonyms

The type synonym expander was doing redundant work by looking at same
types again and again. This patch fixes the loop code when both of the
types can be expanded, to do `O(min(n, m))` comparisons and `O(n + m)`
expansions, where `n` is expansions of the first type and `m` is
expansions of the second type.

Reported by sjcjoosten in T10547.

Test Plan:
Added a regression test that was taking several minutes to type check
before this patch.

Reviewers: bgamari, simonpj, austin, ezyang

Reviewed By: bgamari, simonpj, austin, ezyang

Subscribers: simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D2198

GHC Trac Issues: #10547

3 years agoBump haddock submodule
Ben Gamari [Thu, 12 May 2016 15:44:49 +0000 (17:44 +0200)] 
Bump haddock submodule

This includes various fixes to Haddock's integration with the GHC build
system.

3 years agoTest Trac #12039
Simon Peyton Jones [Thu, 12 May 2016 15:15:18 +0000 (16:15 +0100)] 
Test Trac #12039

3 years agoRefactor some ppr functions to use pprUFM
Bartosz Nitka [Thu, 12 May 2016 15:01:34 +0000 (08:01 -0700)] 
Refactor some ppr functions to use pprUFM

Nondeterminism doesn't matter in these places and pprUFM makes
it obvious. I've flipped the order of arguments for convenience.

Test Plan: ./validate

Reviewers: simonmar, bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2205

GHC Trac Issues: #4012

3 years agoFix comments about scavenging WEAK objects
Takano Akio [Thu, 12 May 2016 13:45:44 +0000 (15:45 +0200)] 
Fix comments about scavenging WEAK objects

This is a follow-up of D2189. If fixes some comments, deletes a section
in the User's Guide about the bug, and updates .mailmap as suggested on
the WorkinConventions wiki page.

Test Plan: It compiles.

Reviewers: austin, simonmar, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2202

GHC Trac Issues: #11108

3 years agoRtsUtils: Use `size_t` instead of `int` where appropriate
Erik de Castro Lopo [Thu, 12 May 2016 13:45:10 +0000 (15:45 +0200)] 
RtsUtils: Use `size_t` instead of `int` where appropriate

Functions like `stgMallocBytes` take a size parameter which was of type
`int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is
problematic because the `sizeof` operator returns `size_t` so that on 64
bit systems, in this common use case the `size_t` parameter would be
truncated to 32 bits when passed to `stgMallocBytes` where it was cast
back to `size_t`.

Test Plan: Validate on Linux, OS X and Windows

Reviewers: austin, hvr, bgamari, simonmar, hsyl20

Reviewed By: hvr, bgamari, simonmar, hsyl20

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2201

3 years agorts: Make function pointer parameters `const` where possible
Erik de Castro Lopo [Thu, 12 May 2016 13:45:00 +0000 (15:45 +0200)] 
rts: Make function pointer parameters `const` where possible

If a function takes a pointer parameter and doesn't update what
the pointer points to, we can add `const` to the parameter
declaration to document that no updates occur.

Test Plan: Validate on Linux, OS X and Windows

Reviewers: austin, Phyx, bgamari, simonmar, hsyl20

Reviewed By: bgamari, simonmar, hsyl20

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2200

3 years agoUse StgHalfWord instead of a CPP #if
Tomas Carnecky [Thu, 12 May 2016 13:44:42 +0000 (15:44 +0200)] 
Use StgHalfWord instead of a CPP #if

Reviewers: simonmar, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2183

3 years agoKill varEnvElts in specImports
Bartosz Nitka [Thu, 12 May 2016 13:55:00 +0000 (06:55 -0700)] 
Kill varEnvElts in specImports

We need the order of specialized binds and rules to be deterministic,
so we use a deterministic set here.

Test Plan: ./validate

Reviewers: simonmar, bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2197

GHC Trac Issues: #4012

3 years agoDocument zonkTyCoVarsAndFV determinism
Bartosz Nitka [Thu, 12 May 2016 13:44:52 +0000 (06:44 -0700)] 
Document zonkTyCoVarsAndFV determinism

I've changed it to use nonDetEltsUFM and documented why
it's OK.

Test Plan: it builds

Reviewers: bgamari, austin, simonmar, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2204

GHC Trac Issues: #4012

3 years agoAllow putting Haddocks on derived instances
Ryan Scott [Wed, 11 May 2016 13:58:35 +0000 (15:58 +0200)] 
Allow putting Haddocks on derived instances

Currently, one can document top-level instance declarations, but derived
instances (both those in `deriving` clauses and standalone `deriving`
instances) do not enjoy the same privilege. This makes the necessary
changes to the parser to enable attaching Haddock comments for derived
instances.

Updates haddock submodule.

Fixes #11768.

Test Plan: ./validate

Reviewers: hvr, bgamari, austin

Reviewed By: austin

Subscribers: thomie, mpickering

Differential Revision: https://phabricator.haskell.org/D2175

GHC Trac Issues: #11768

3 years agoMake Generic1 poly-kinded
RyanGlScott [Wed, 11 May 2016 13:57:48 +0000 (15:57 +0200)] 
Make Generic1 poly-kinded

This generalizes the `Generic1` typeclass to be of kind `k -> *`, and
this also makes the relevant datatypes and typeclasses in `GHC.Generics`
poly-kinded. If `PolyKinds` is enabled, `DeriveGeneric` derives
`Generic1` instances such that they use the most general kind possible.
Otherwise, deriving `Generic1` defaults to make an instance where the
argument is of kind `* -> *` (the current behavior).

Fixes #10604. Depends on D2117.

Test Plan: ./validate

Reviewers: kosmikus, dreixel, goldfire, austin, hvr, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie, ekmett

Differential Revision: https://phabricator.haskell.org/D2168

GHC Trac Issues: #10604

3 years agoFix deriveTyData's kind unification when two kind variables are unified
RyanGlScott [Wed, 11 May 2016 13:57:24 +0000 (15:57 +0200)] 
Fix deriveTyData's kind unification when two kind variables are unified

When `deriveTyData` attempts to unify two kind variables (which can
happen if both the typeclass and the datatype are poly-kinded), it
mistakenly adds an extra mapping to its substitution which causes the
unification to fail when applying the substitution. This can be
prevented by checking both the domain and the range of the original
substitution to see which kind variables shouldn't be put into the
domain of the substitution. A more in-depth explanation is included in
`Note [Unification of two kind variables in deriving]`.

Fixes #11837.

Test Plan: ./validate

Reviewers: simonpj, hvr, goldfire, niteria, austin, bgamari

Reviewed By: bgamari

Subscribers: niteria, thomie

Differential Revision: https://phabricator.haskell.org/D2117

GHC Trac Issues: #11837

3 years agoAdd TH support for pattern synonyms (fixes #8761)
Dominik Bollmann [Wed, 11 May 2016 13:55:13 +0000 (15:55 +0200)] 
Add TH support for pattern synonyms (fixes #8761)

This commit adds Template Haskell support for pattern synonyms as
requested by trac ticket #8761.

Test Plan: ./validate

Reviewers: thomie, jstolarek, osa1, RyanGlScott, mpickering, austin,
goldfire, bgamari

Reviewed By: goldfire, bgamari

Subscribers: rdragon

Differential Revision: https://phabricator.haskell.org/D1940

GHC Trac Issues: #8761

3 years agoBump haddock submodule
Ben Gamari [Thu, 12 May 2016 13:39:24 +0000 (15:39 +0200)] 
Bump haddock submodule

3 years agodocs: add skeleton 8.2.1 release notes
Austin Seipp [Wed, 11 May 2016 13:52:08 +0000 (15:52 +0200)] 
docs: add skeleton 8.2.1 release notes

Summary:
Out with the old, in with the new.

Not much has diverged yet, but it's good to get this out of the way early.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Test Plan: Built and looked at the documentation.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2066

3 years agoMake absentError not depend on uniques
Bartosz Nitka [Thu, 12 May 2016 12:42:21 +0000 (05:42 -0700)] 
Make absentError not depend on uniques

As explained in the comment it will cause changes in
inlining if we don't suppress them.

Test Plan: ./validate

Reviewers: bgamari, austin, simonpj, goldfire, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2203

GHC Trac Issues: #4012

3 years agoDon't prematurely force TyThing thunks with -ddump-if-trace.
Edward Z. Yang [Tue, 10 May 2016 07:14:05 +0000 (00:14 -0700)] 
Don't prematurely force TyThing thunks with -ddump-if-trace.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2187

3 years agoRemove stale comment.
Edward Z. Yang [Tue, 10 May 2016 02:56:41 +0000 (19:56 -0700)] 
Remove stale comment.

Summary:
The code was reordered before tcRnImports in
3c44a46b352a4eb7ff72eb3aa5495b25dee8351f.  I don't
think the new code is buggy.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2186

3 years agoRemove a copy of System.Random and use reqlib('random')
Simon Marlow [Wed, 11 May 2016 15:05:46 +0000 (16:05 +0100)] 
Remove a copy of System.Random and use reqlib('random')

3 years agoMake random an "extra" package
Simon Marlow [Wed, 11 May 2016 15:01:05 +0000 (16:01 +0100)] 
Make random an "extra" package

It will get built as part of "validate --slow".  We have 11 tests that
depend on random, so this enables more tests to work.

3 years agoFix ASSERT failure and re-enable setnumcapabilities001
Simon Marlow [Wed, 11 May 2016 14:38:25 +0000 (15:38 +0100)] 
Fix ASSERT failure and re-enable setnumcapabilities001

The assertion failure was fairly benign, I think, but this fixes it.
I've been running the test repeatedly for the last 30 mins and it hasn't
triggered.

There are other problems exposed by this test (see #12038), but I've
worked around those in the test itself for now.

I also copied the relevant bits of the parallel library here so that we
don't need parallel for the test to run.

3 years agoDocument SCC determinism
Bartosz Nitka [Wed, 11 May 2016 14:47:47 +0000 (07:47 -0700)] 
Document SCC determinism

I've documented the guarantees that stronglyConnCompFromEdgedVertices
provides and commented on the call sites to explain why they are
OK from determinism standpoint. I've changed the functions to
nonDetUFM versions, so that it's explicit they could introduce
nondeterminism.  I haven't defined container (VarSet, NameSet)
specific versions, so that we have less functions to worry about.

Test Plan: this is mostly just documentation,
it should have no runtime effect

Reviewers: bgamari, simonmar, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2194

GHC Trac Issues: #4012

3 years agoRemove some varSetElems in dsCmdStmt
Bartosz Nitka [Wed, 11 May 2016 14:47:15 +0000 (07:47 -0700)] 
Remove some varSetElems in dsCmdStmt

varSetElems introduces unnecessary determinism and it's easy to
preserve determinism here.

Test Plan: ./validate

Reviewers: goldfire, simonmar, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2195

GHC Trac Issues: #4012

3 years agoHandle promotion failures when scavenging a WEAK (#11108)
Takano Akio [Wed, 11 May 2016 12:45:29 +0000 (14:45 +0200)] 
Handle promotion failures when scavenging a WEAK (#11108)

Previously, we ignored promotion failures when evacuating fields of
a WEAK object. When a failure happens, this resulted in an WEAK object
pointing to another object in a younger generation, causing crashes.

I used the test case from #11746 to check that the fix is working.
However I haven't managed to produce a test case that quickly reproduces
the issue.

Test Plan: ./validate

Reviewers: austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2189

GHC Trac Issues: #11108

3 years agorts: Fix C compiler warnings on Windows
Erik de Castro Lopo [Wed, 11 May 2016 06:17:08 +0000 (16:17 +1000)] 
rts: Fix C compiler warnings on Windows

Summary:
Specifcally we want the MinGW compiler to use ISO print format
specfifiers.

Test Plan: Validate on Linux, OS X and Windows

Reviewers: Phyx, austin, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2192

3 years agoRtsFlags: Make `mallocFailHook` const correct
Erik de Castro Lopo [Mon, 2 May 2016 11:20:28 +0000 (21:20 +1000)] 
RtsFlags: Make `mallocFailHook` const correct

Test Plan: Validate

Reviewers: hvr, austin, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2193

3 years agoDocument why closeOverKind is OK for determinism
Bartosz Nitka [Wed, 11 May 2016 10:39:25 +0000 (03:39 -0700)] 
Document why closeOverKind is OK for determinism

There's no point in converting the existing call sites to use
deterministic closeOverKinds if they never linearize the set.

Test Plan: it compiles, this is basically just documentation

Reviewers: simonpj, goldfire, simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2191

GHC Trac Issues: #4012

3 years agoKill foldUFM in classifyTyCon
Bartosz Nitka [Tue, 10 May 2016 15:29:39 +0000 (08:29 -0700)] 
Kill foldUFM in classifyTyCon

We can get away with anyUFM here.

3 years agomake accept for Make simplifyInstanceContexts deterministic
Bartosz Nitka [Tue, 10 May 2016 14:56:06 +0000 (07:56 -0700)] 
make accept for Make simplifyInstanceContexts deterministic

Making it deterministic changed some error messages and I
forgot to make accept. Relevant change: b58b0e18a568.

3 years agoFix typos
Bartosz Nitka [Tue, 10 May 2016 14:45:55 +0000 (07:45 -0700)] 
Fix typos

3 years agoGet rid of Traversable UniqFM and Foldable UniqFM
Bartosz Nitka [Tue, 10 May 2016 14:17:28 +0000 (07:17 -0700)] 
Get rid of Traversable UniqFM and Foldable UniqFM

Both Traversable and Foldable can introduce non-determinism
and because of typeclass overloading it's implicit and not
obvious at the call site. This removes the instances, so that
they can't accidentally be used.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2190

GHC Trac Issues: #4012

3 years agoTest Trac #11640
Simon Peyton Jones [Tue, 10 May 2016 14:14:11 +0000 (15:14 +0100)] 
Test Trac #11640

3 years agoRecord that EqualityConstraint now works
Simon Peyton Jones [Tue, 10 May 2016 13:37:36 +0000 (14:37 +0100)] 
Record that EqualityConstraint now works

Fixing Trac #9478

3 years agoUse partial-sig constraints as givens
Simon Peyton Jones [Tue, 10 May 2016 11:48:29 +0000 (12:48 +0100)] 
Use partial-sig constraints as givens

In TcSimplify.simplifyInfer, use the context of a partial type
signature as 'givens' when simplifying the inferred constraints of the
group.  This way we get maximum benefit from them.  See
Note [Add signature contexts as givens].

This (finally) fixes test EqualityConstraints in Trac #9478.

And it's a nice tidy-up.

3 years agoAdd Outputable ShowHowMuch
Simon Peyton Jones [Mon, 9 May 2016 08:46:27 +0000 (09:46 +0100)] 
Add Outputable ShowHowMuch

I needed this instance when debugging, so I thought I'd add
it permanently.

3 years agoComments only
Simon Peyton Jones [Fri, 6 May 2016 08:50:03 +0000 (09:50 +0100)] 
Comments only

3 years agoComments about static forms
Simon Peyton Jones [Fri, 6 May 2016 08:49:46 +0000 (09:49 +0100)] 
Comments about static forms

3 years agoMake simplifyInstanceContexts deterministic
Bartosz Nitka [Tue, 10 May 2016 12:32:28 +0000 (05:32 -0700)] 
Make simplifyInstanceContexts deterministic

simplifyInstanceContexts used cmpType which is nondeterministic
for canonicalising typeclass constraints in derived instances.
Following changes make it deterministic as explained by the
Note [Deterministic simplifyInstanceContexts].

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2173

GHC Trac Issues: #4012

3 years agoKill unnecessary cmpType in lhs_cmp_type
Bartosz Nitka [Tue, 10 May 2016 12:26:06 +0000 (05:26 -0700)] 
Kill unnecessary cmpType in lhs_cmp_type

This is the only call site of `lhs_cmp_type` and we only
care about equality.
`cmpType` is nondeterministic (because `TyCon`s are compared
with Uniques in `cmpTc`), so if we don't have to use it, it's
better not to.

Test Plan: ./validate

Reviewers: simonmar, goldfire, bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2172

GHC Trac Issues: #4012

3 years agoComments only
Erik de Castro Lopo [Tue, 10 May 2016 08:09:50 +0000 (18:09 +1000)] 
Comments only

[skip ci]

3 years agoFix a crash in requestSync()
Simon Marlow [Tue, 10 May 2016 10:22:57 +0000 (03:22 -0700)] 
Fix a crash in requestSync()

It was possible for a thread to read invalid memory after a conflict
when multiple threads were synchronising.

I haven't been successful in constructing a test case that triggers
this, but we have some internal code that ran into it.

3 years agoRdrHsSyn: Only suggest `type` qualification when appropriate
Ben Gamari [Tue, 10 May 2016 09:02:19 +0000 (11:02 +0200)] 
RdrHsSyn: Only suggest `type` qualification when appropriate

This suggestion only applies to operators.

3 years agoForbid variables to be parents in import lists.
Matthew Pickering [Tue, 10 May 2016 06:41:46 +0000 (08:41 +0200)] 
Forbid variables to be parents in import lists.

In the long discussion on #11432, it was decided that when a type
constructor is parsed as a variable ((--.->) is one example) then in
order to export the type constructor then the user should be required to
use the ExplicitNamespaces keyword.

This was implemented in quite an indirect manner in the renamer. It
is much more direct to enforce this in the parser at the expense of
slighty worse error messages. Further to this, the check in the
renamer was actually slightly wrong. If the variable was in scope
then no error was raised, this was causing panics, see #12026 for an
example.

Reviewers: austin, bgamari

Subscribers: davean, skvadrik, thomie

Differential Revision: https://phabricator.haskell.org/D2181

GHC Trac Issues: #12026

3 years agostg/Types.h: Fix comment and #include
Ben Gamari [Tue, 10 May 2016 06:51:25 +0000 (08:51 +0200)] 
stg/Types.h: Fix comment and #include

3 years agoRe-do the invariant for TcDepVars
Simon Peyton Jones [Mon, 9 May 2016 22:12:31 +0000 (23:12 +0100)] 
Re-do the invariant for TcDepVars

Previously I had it so that dv_kvs and dv_tvs didn't
overlap.  Now they can, and quantifyZonkedTyVars
removes the former from the latter.  This is more
economical, and in fact there was a bug where the
invariant wasn't re-established.

It's much easier to allow dv_kvs and dv_kvs to overlap,
and to eliminate the overlap in TcMType.quantifyZonkedTyVars

3 years agoError message wibbles, re partial type sigs
Simon Peyton Jones [Mon, 9 May 2016 12:52:18 +0000 (13:52 +0100)] 
Error message wibbles, re partial type sigs

I committed three patches involving partial type sigs that
are collectively responsible for these error message changes.
The are all just changes to numbering in the pretty-printer.

I didn't bother to partition them between patches -- sorry!

3 years agoTidy up partial-sig quantification
Simon Peyton Jones [Mon, 9 May 2016 12:48:34 +0000 (13:48 +0100)] 
Tidy up partial-sig quantification

There's a messy bit of tcSimplifyInfer which concerns how
quantify when partial type signatures are involved. This
patch tidies it up a lot.

Notice that decideQuantification and quantify_tvs get
much simpler.  And previously the inferred type of a
function could be cluttered with phantom variables that
were relevant only to the error messgas.

See Note [Quantification and partial signatures].

3 years agoFix partial sigs and pattern bindings interaction
Simon Peyton Jones [Mon, 9 May 2016 12:08:02 +0000 (13:08 +0100)] 
Fix partial sigs and pattern bindings interaction

It turns out that GHC 8.0 would accept entirely bogus
programs like

   f2 :: (True, _) -> Char
   Just f2 = Just (\x->x)

(which is now partial-sigs/should_fail/PatBind3)

This also fixes Trac #9478, test `PatBind2`.

3 years agoComments only
Simon Peyton Jones [Mon, 9 May 2016 10:52:11 +0000 (11:52 +0100)] 
Comments only

3 years agoEmit wild-card constraints in the right place
Simon Peyton Jones [Mon, 9 May 2016 10:49:15 +0000 (11:49 +0100)] 
Emit wild-card constraints in the right place

We were failing to emit wild-card hole constraints altogether
in the case of pattern bindings.  Reason: it was done in
tcExtendTyVarEnvFromSig, which isn't called for pattern bindings.

This patch make it work right for both pattern and function
bindings.  Mainly, there is a call to emitWildCardHolds in
tcRhs for both PatBind and FunBind.

I also killed off TcExpr.typeSigCtxt.

3 years agoWhite space only
Simon Peyton Jones [Mon, 9 May 2016 10:45:49 +0000 (11:45 +0100)] 
White space only

3 years agoUse stdint types for Stg{Word,Int}{8,16,32,64}
Tomas Carnecky [Sun, 8 May 2016 12:44:07 +0000 (14:44 +0200)] 
Use stdint types for Stg{Word,Int}{8,16,32,64}

We can't define Stg{Int,Word} in terms of {,u}intptr_t because STG
depends on them being the exact same size as void*, and {,u}intptr_t
does not make that guarantee. Furthermore, we also need to define
StgHalf{Int,Word}, so the preprocessor if needs to stay. But we can at
least keep it in a single place instead of repeating it in various
files.

Also define STG_{INT,WORD}{8,16,32,64}_{MIN,MAX} and use it in HsFFI.h,
further reducing the need for CPP in other files.

Reviewers: austin, bgamari, simonmar, hvr, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2182

3 years agoDocumentation for simplifyDeriv.
Edward Z. Yang [Fri, 6 May 2016 23:34:50 +0000 (16:34 -0700)] 
Documentation for simplifyDeriv.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: docs only

Reviewers: simonpj, austin, goldfire, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2180

3 years agorts/ProfHeap.c: Use `ssize_t` instead of `long`.
Erik de Castro Lopo [Thu, 5 May 2016 08:36:16 +0000 (18:36 +1000)] 
rts/ProfHeap.c: Use `ssize_t` instead of `long`.

On x64 Windows `sizeof long` is 4 which could easily overflow
resulting in incorrect heap profiling results. This change does not
affect either Linux or OS X where `sizeof long` == `sizeof ssize_t`
regardless of machine word size.

Test Plan: Validate on Linux and Windows

Reviewers: hsyl20, bgamari, simonmar, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2177