ghc.git
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

3 years agoUpdate time submodule to 1.6.0.1 release tag
Herbert Valerio Riedel [Sat, 7 May 2016 06:41:54 +0000 (08:41 +0200)] 
Update time submodule to 1.6.0.1 release tag

3 years agoRemove trailing whitespace from 'testsuite/tests/module/all.T'
Matthew Pickering [Fri, 6 May 2016 16:16:55 +0000 (17:16 +0100)] 
Remove trailing whitespace from 'testsuite/tests/module/all.T'

[skip ci]

3 years agoFix pretty printing of IEThingWith
Matthew Pickering [Fri, 6 May 2016 16:15:54 +0000 (17:15 +0100)] 
Fix pretty printing of IEThingWith

[skip ci]

3 years agoUpdate Win32 submodule to v2.3.1.1 release tag
Herbert Valerio Riedel [Fri, 6 May 2016 08:45:36 +0000 (10:45 +0200)] 
Update Win32 submodule to v2.3.1.1 release tag

3 years agoUse tcExtendGlobalValEnv for default methods
Simon Peyton Jones [Fri, 6 May 2016 07:21:33 +0000 (08:21 +0100)] 
Use tcExtendGlobalValEnv for default methods

We add the default method Ids to the global type envt in
tcAddImplicits; and then again in tcInstDcls2 (for reasons
explained there).  But for some reason in the latter case
we added them to the /local/ type envt, via tcExtendLetEnv.

This patch just uses tcExtendGlobalValEnv consistently
for both.

(I found this when reviewing slightly-awkward code from Facundo's
static-form error-message patch; turned out that the awkwardness
came back to this inconsistency in the handling of default
methods.)

3 years agoExplain linter optimization for StaticPtr checks.
Facundo Domínguez [Fri, 6 May 2016 00:32:49 +0000 (21:32 -0300)] 
Explain linter optimization for StaticPtr checks.

3 years agoComments only explaining export list parsing.
Matthew Pickering [Thu, 5 May 2016 09:25:12 +0000 (10:25 +0100)] 
Comments only explaining export list parsing.

3 years agorts: Replace `nat` with `uint32_t`
Erik de Castro Lopo [Sun, 1 May 2016 20:37:14 +0000 (06:37 +1000)] 
rts: Replace `nat` with `uint32_t`

The `nat` type was an alias for `unsigned int` with a comment saying
it was at least 32 bits. We keep the typedef in case client code is
using it but mark it as deprecated.

Test Plan: Validated on Linux, OS X and Windows

Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20

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

3 years agoKill non-deterministic foldUFM in TrieMap and TcAppMap
Bartosz Nitka [Wed, 4 May 2016 16:22:37 +0000 (09:22 -0700)] 
Kill non-deterministic foldUFM in TrieMap and TcAppMap

Summary:
foldUFM introduces unnecessary non-determinism that actually
leads to different generated code as explained in
Note [TrieMap determinism].

As we're switching from UniqFM to UniqDFM here you might be
concerned about performance. There's nothing that ./validate
detects. nofib reports no change in Compile Allocations, but
Compile Time got better on some tests and worse on some,
yielding this summary:

        -1 s.d.                -----            -3.8%
        +1 s.d.                -----            +5.4%
        Average                -----            +0.7%

This is not a fair comparison as the order of Uniques
changes what GHC is actually doing. One benefit from making
this deterministic is also that it will make the
performance results more stable.

Full nofib results: P108

Test Plan: ./validate, nofib

Reviewers: goldfire, simonpj, simonmar, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agobase: Export runRW# from GHC.Exts
Ben Gamari [Wed, 4 May 2016 16:30:51 +0000 (18:30 +0200)] 
base: Export runRW# from GHC.Exts

Seems like this should be available in GHC.Exts. Thanks for @carter
for pointing this out.

Test Plan: Validate

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie, carter

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

3 years agotestsuite: Add test for #11959
Ben Gamari [Tue, 3 May 2016 20:58:47 +0000 (22:58 +0200)] 
testsuite: Add test for #11959

Test Plan: Validate, expected to fail

Reviewers: goldfire, austin

Reviewed By: austin

Subscribers: thomie

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

GHC Trac Issues: #11959

3 years agoBe more aggressive when checking constraints for custom type errors.
Iavor S. Diatchki [Tue, 3 May 2016 20:55:07 +0000 (22:55 +0200)] 
Be more aggressive when checking constraints for custom type errors.

This fixes #11990.

The current rule is simpler than before: if we encounter an unsolved
constraint that contains any mentions of properly applied `TypeError`,
then we report the type error.

If there are multiple `TypeErrors`, then we just report one of them.

Reviewers: simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11990

3 years agoMake 'make fast' work for the User Guide
Simon Marlow [Wed, 4 May 2016 11:47:12 +0000 (12:47 +0100)] 
Make 'make fast' work for the User Guide

If you already have mkUserGuidePart compiled.

3 years agoDon't STATIC_INLINE giveCapabilityToTask
Simon Marlow [Wed, 4 May 2016 11:29:06 +0000 (04:29 -0700)] 
Don't STATIC_INLINE giveCapabilityToTask

This causes errors with some versions of gcc (4.4.7 here).

3 years agoschedulePushWork: avoid unnecessary wakeups
Simon Marlow [Sun, 24 Apr 2016 20:31:55 +0000 (21:31 +0100)] 
schedulePushWork: avoid unnecessary wakeups

This function had some pathalogically bad behaviour: if we had 2 threads
on the current capability and 23 other idle capabilities, we would

* grab all 23 capabilities
* migrate one Haskell thread to one of them
* wake up a worker on *all* 23 other capabilities.

This lead to a lot of unnecessary wakeups when using large -N values.

Now, we

* Count how many capabilities we need to wake up
* Start from cap->no+1, so that we don't overload low-numbered capabilities
* Only wake up capabilities that we migrated a thread to (unless we have
  sparks to steal)

This results in a pretty dramatic improvement in our production system.

3 years agoAdd +RTS -AL<size>
Simon Marlow [Sun, 24 Apr 2016 20:31:55 +0000 (21:31 +0100)] 
Add +RTS -AL<size>

+RTS -AL<size> controls the total size of large objects that can be
allocated before a GC is triggered.  Previously this was always just the
value of -A, and the limit mainly existed to prevent runaway allocation
in pathalogical programs that allocate a lot of large objects.  However,
since the limit is shared between all cores, on a large multicore the
default becomes more restrictive, and can end up triggering GC well
before it would normally have been.

Arguably a better default would be A*N, but this is probably excessive.
Adding a flag lets you choose, and I've left the default as it was.

See docs for usage.

3 years agoAllow limiting the number of GC threads (+RTS -qn<n>)
Simon Marlow [Sat, 9 Apr 2016 19:45:50 +0000 (20:45 +0100)] 
Allow limiting the number of GC threads (+RTS -qn<n>)

This allows the GC to use fewer threads than the number of capabilities.
At each GC, we choose some of the capabilities to be "idle", which means
that the thread running on that capability (if any) will sleep for the
duration of the GC, and the other threads will do its work.  We choose
capabilities that are already idle (if any) to be the idle capabilities.

The idea is that this helps in the following situation:

* We want to use a large -N value so as to make use of hyperthreaded
  cores
* We use a large heap size, so GC is infrequent
* But we don't want to use all -N threads in the GC, because that
  thrashes the memory too much.

See docs for usage.

3 years agoAdjust testsuite output to bytestring-0.10.8.0
Joachim Breitner [Wed, 4 May 2016 08:54:39 +0000 (10:54 +0200)] 
Adjust testsuite output to bytestring-0.10.8.0

This is a band-aid; the test suite should not be sensitive to these
messages.

3 years agoExport oneShot from GHC.Exts
Joachim Breitner [Wed, 4 May 2016 07:54:40 +0000 (09:54 +0200)] 
Export oneShot from GHC.Exts

as suggested by carter in #12011.

3 years agoUpdate bytestring submodule to 0.10.8.0 release tag
Herbert Valerio Riedel [Tue, 3 May 2016 22:45:43 +0000 (00:45 +0200)] 
Update bytestring submodule to 0.10.8.0 release tag

3 years agoUpdate libraries/hpc submodule to v0.6.0.3 release tag
Herbert Valerio Riedel [Tue, 3 May 2016 20:11:59 +0000 (22:11 +0200)] 
Update libraries/hpc submodule to v0.6.0.3 release tag

3 years agoCleanups related to MAX_FREE_LIST
Simon Marlow [Mon, 2 May 2016 19:26:15 +0000 (20:26 +0100)] 
Cleanups related to MAX_FREE_LIST

- Rename to the (more correct) NUM_FREE_LISTS

- NUM_FREE_LISTS should be derived from the block and mblock sizes, not
  defined manually.  It was actually too large by one, which caused a
  little bit of (benign) extra work in the form of a redundant loop
  iteration in some cases.

- Add some ASSERTs for input preconditions to log_2() and log_2_ceil()

- Fix some comments

- Fix usage in allocLargeChunk, to account for the fact that
  log_2_ceil() can return NUM_FREE_LISTS.

3 years agoRevert "Revert "Use __builtin_clz() to implement log_1()""
U-THEFACEBOOK\smarlow [Sun, 1 May 2016 07:27:35 +0000 (08:27 +0100)] 
Revert "Revert "Use __builtin_clz() to implement log_1()""

This reverts commit 546f24e4f8a7c086b1e5afcdda624176610cbcf8.

And adds a fix for Windows: we need to use __builtin_clzll() rather than
__builtin_clzl(), because StgWord is unsigned long long on Windows.

3 years agoStaticPointers: Allow closed vars in the static form.
Facundo Domínguez [Thu, 7 Apr 2016 19:20:19 +0000 (16:20 -0300)] 
StaticPointers: Allow closed vars in the static form.

Summary:
With this patch closed variables are allowed regardless of whether
they are bound at the top level or not.

The FloatOut pass is always performed. When optimizations are
disabled, only expressions that go to the top level are floated.
Thus, the applications of the StaticPtr data constructor are always
floated.

The CoreTidy pass makes sure the floated applications appear in the
symbol table of object files. It also collects the floated bindings
and inserts them in the static pointer table.

The renamer does not check anymore if free variables appearing in the
static form are top-level. Instead, the typechecker looks at the
tct_closed flag to decide if the free variables are closed.

The linter checks that applications of StaticPtr only occur at the
top of top-level bindings after the FloatOut pass.

The field spInfoName of StaticPtrInfo has been removed. It used to
contain the name of the top-level binding that contains the StaticPtr
application. However, this information is no longer available when the
StaticPtr is constructed, as the binding name is determined now by the
FloatOut pass.

Test Plan: ./validate

Reviewers: goldfire, simonpj, austin, hvr, bgamari

Reviewed By: simonpj

Subscribers: thomie, mpickering, mboes

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

GHC Trac Issues: #11656

3 years agoMake validDerivPred ignore non-visible arguments to a class type constructor
RyanGlScott [Mon, 2 May 2016 16:38:04 +0000 (12:38 -0400)] 
Make validDerivPred ignore non-visible arguments to a class type constructor

Summary:
GHC choked when trying to derive the following:

```
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
module Example where

class Category (cat :: k -> k -> *) where
  catId   :: cat a a
  catComp :: cat b c -> cat a b -> cat a c

newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category
```

Unlike in #8865, where we were deriving `Category` for a concrete type like
`Either`, in the above example we are attempting to derive an instance of the
form:

```
instance Category * c => Category (T * c) where ...
```

(using `-fprint-explicit-kinds` syntax). But `validDerivPred` is checking if
`sizePred (Category * c)` equals the number of free type variables in
`Category * c`. But note that `sizePred` counts both type variables //and//
type constructors, and `*` is a type constructor! So `validDerivPred`
erroneously rejects the above instance.

The fix is to make `validDerivPred` ignore non-visible arguments to the class
type constructor (e.g., ignore `*` is `Category * c`) by using
`filterOutInvisibleTypes`.

Fixes #11833.

Test Plan: ./validate

Reviewers: goldfire, hvr, simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11833

3 years agodocs/users_guide/glasgow_exts.rst: fix merge conflict
Sergei Trofimovich [Mon, 2 May 2016 10:24:23 +0000 (11:24 +0100)] 
docs/users_guide/glasgow_exts.rst: fix merge conflict

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoglasgow_exts.rst: fix quoting
Sergei Trofimovich [Thu, 21 Apr 2016 21:43:11 +0000 (22:43 +0100)] 
glasgow_exts.rst: fix quoting

glasgow_exts.rst:6525: WARNING: Inline literal start-string without end-string.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>