ghc.git
3 years agoImprove error messages for recursive superclasses
Simon Peyton Jones [Mon, 8 Feb 2016 13:31:11 +0000 (13:31 +0000)] 
Improve error messages for recursive superclasses

If we fail to typecheck by blowing the constraint simplifier
iteration limit, we want to see the limit-blowing meessage.
Previously it was being suppressed by the type /error/, which
suppress the iteration-limit /warning/.  Solution: make the
iteration-limit message into an error.

3 years agoImprove tracing in TcInteract
Simon Peyton Jones [Mon, 8 Feb 2016 13:18:35 +0000 (13:18 +0000)] 
Improve tracing in TcInteract

3 years agoComment out some traceFlat calls
Simon Peyton Jones [Mon, 8 Feb 2016 13:17:15 +0000 (13:17 +0000)] 
Comment out some traceFlat calls

They were excessively verbose.  I've commented them out rather than
deleting so that they can easily be restored.

3 years agoDocument and improve superclass expansion
Simon Peyton Jones [Mon, 8 Feb 2016 13:14:02 +0000 (13:14 +0000)] 
Document and improve superclass expansion

When investigating Trac #11523 I found that superclass
expansion was a little over-aggressive; we were sort of
unrolling each loop twice.

This patch corrects that, and adds explanatory comments.

3 years agoWhite space and comments only
Simon Peyton Jones [Thu, 4 Feb 2016 13:02:17 +0000 (13:02 +0000)] 
White space and comments only

3 years agoAdd comments to TcCoercibleFail
Simon Peyton Jones [Thu, 4 Feb 2016 13:00:22 +0000 (13:00 +0000)] 
Add comments to TcCoercibleFail

Flag up the problem highlighted in Trac #11518 comment:15

3 years agoComments only, on the invariants of GlobalRdrEnv
Simon Peyton Jones [Mon, 1 Feb 2016 14:01:34 +0000 (14:01 +0000)] 
Comments only, on the invariants of GlobalRdrEnv

3 years agoAdd Edward Kmett's example as a test case
Simon Peyton Jones [Mon, 1 Feb 2016 13:59:11 +0000 (13:59 +0000)] 
Add Edward Kmett's example as a test case

This is a more stressful example of T11480.

3 years agouser-guide: Add cross-reference for -XUnicodeSyntax
Ben Gamari [Sun, 7 Feb 2016 23:13:50 +0000 (00:13 +0100)] 
user-guide: Add cross-reference for -XUnicodeSyntax

3 years agoFix SimpleFail12 error output
Simon Peyton Jones [Mon, 8 Feb 2016 10:13:28 +0000 (10:13 +0000)] 
Fix SimpleFail12 error output

I missed this on my previous commit, somehow
   2cf3ca Allow foralls in instance decls
Apologies.

3 years agoAllow foralls in instance decls
Simon Peyton Jones [Mon, 8 Feb 2016 09:05:12 +0000 (09:05 +0000)] 
Allow foralls in instance decls

This patch finally makes it possible to have explicit
foralls in an instance decl
   instance forall (a :: *). Eq a => Eq [a] where ...

This is useful to allow kind signatures or indeed
explicicit kind for-alls; see Trac #11519

I thought it would be really easy, because an instance
declaration already contains an actual HsSigType, so all
the syntactic baggage is there.  But in fact it turned
out that instance declarations were kind-checked a
little differently, because the body kind of the forall
is 'Constraint' rather than '*'.

So I fixed that.  There a slight kludge
(see Note [Body kind of a HsQualTy], but it's still a
significant improvement.

I also did the usual other round of refactoring,
improved a few error messages, tidied up comments etc.
The only significant aspect of all that was

  * Kill mkNakedSpecSigmaTy, mkNakedPhiTy, mkNakedFunTy
    These function names suggest that they do something
    complicated, but acutally they do nothing. So I
    killed them.

  * Swap the arg order of mkNamedBinder, just so that it is
    convenient to say 'map (mkNamedBinder Invisible) tvs'

  * I had to improve isPredTy, to deal with (illegal)
    types like
       (Eq a => Eq [a]) => blah
    See Note [isPeredTy complications] in Type.hs

Still to come: user manual documentation for the
instance-decl change.

3 years agoRemove unused export from TcUnify
Simon Peyton Jones [Thu, 28 Jan 2016 22:43:38 +0000 (22:43 +0000)] 
Remove unused export from TcUnify

..namely buildImplication.

Plus white space in TcDeriv

3 years agoBump haddock submodule
Ben Gamari [Sun, 7 Feb 2016 22:39:49 +0000 (23:39 +0100)] 
Bump haddock submodule

3 years agoFix haddocks for TypeError
Ben Gamari [Sun, 7 Feb 2016 21:40:24 +0000 (22:40 +0100)] 
Fix haddocks for TypeError

3 years agorts: mark 'shutdownCapability' as static
Sergei Trofimovich [Sun, 7 Feb 2016 18:39:33 +0000 (18:39 +0000)] 
rts: mark 'shutdownCapability' as static

Noticed by uselex.rb:
    last_free_capability: [R]: exported from:
        ./rts/dist/build/Capability.o
    shutdownCapability: [R]: exported from:
        ./rts/dist/build/Capability.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: drop unused 'traceEventThreadRunnable'
Sergei Trofimovich [Sun, 7 Feb 2016 18:16:10 +0000 (18:16 +0000)] 
rts: drop unused 'traceEventThreadRunnable'

Not used since:

    commit f361281c89fbce42865d8b8b27b0957205366186
    Author: Simon Marlow <marlowsd@gmail.com>
    Date:   Wed Dec 7 11:32:35 2011 +0000

        Do not emit the THREAD_RUNNABLE event; it has no useful semantic content

Noticed by uselex.rb:
    traceEventThreadRunnable: [R]: exported from:
        ./rts/dist/build/Inlines.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'ccs_mutex' and 'prof_arena' as static
Sergei Trofimovich [Sun, 7 Feb 2016 18:00:00 +0000 (18:00 +0000)] 
rts: mark 'ccs_mutex' and 'prof_arena' as static

Noticed by uselex.rb:
    ccs_mutex: [R]: exported from:
        ./rts/dist/build/Profiling.thr_p_o
    prof_arena: [R]: exported from:
        ./rts/dist/build/Profiling.p_o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'blockedThrowTo' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:58:59 +0000 (17:58 +0000)] 
rts: mark 'blockedThrowTo' as static

Noticed by uselex.rb:
    blockedThrowTo: [R]: exported from:
        ./rts/dist/build/RaiseAsync.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: drop unused 'traverseAllRetainerSet'
Sergei Trofimovich [Sun, 7 Feb 2016 17:55:56 +0000 (17:55 +0000)] 
rts: drop unused 'traverseAllRetainerSet'

While at is mark 'printRetainer' as 'static'.

Noticed by uselex.rb:
    printRetainer: [R]: exported from:
        ./rts/dist/build/RetainerSet.p_o
    traverseAllRetainerSet: [R]: exported from:
        ./rts/dist/build/RetainerSet.p_o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'setProgName' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:36:55 +0000 (17:36 +0000)] 
rts: mark 'setProgName' as static

Noticed by uselex.rb:
    setProgName: [R]: exported from:
        ./rts/dist/build/RtsFlags.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'removeFromRunQueue' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:33:02 +0000 (17:33 +0000)] 
rts: mark 'removeFromRunQueue' as static

Noticed by uselex.rb:
    removeFromRunQueue: [R]: exported from:
        ./rts/dist/build/Schedule.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: drop unused mut_user_time_during_heap_census
Sergei Trofimovich [Sun, 7 Feb 2016 17:23:36 +0000 (17:23 +0000)] 
rts: drop unused mut_user_time_during_heap_census

Was never used looking at history available in git.

While at it marked 'mut_user_time_during_RP' as 'static'.

Noticed by uselex.rb:
    mut_user_time_during_heap_census: [R]: exported from:
        ./rts/dist/build/Stats.p_o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'wakeBlockingQueue' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:14:37 +0000 (17:14 +0000)] 
rts: mark 'wakeBlockingQueue' as static

Noticed by uselex.rb:
    wakeBlockingQueue: [R]: exported from:
        ./rts/dist/build/Threads.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: drop unused getThreadCPUTime
Sergei Trofimovich [Sun, 7 Feb 2016 16:59:03 +0000 (16:59 +0000)] 
rts: drop unused getThreadCPUTime

Use of this helper function was removed in:

    commit 3c9fc104337a142fe4f375d30d7a6b81d55a70c1
    Author: Brian Brooks <brooks.brian@gmail.com>
    Date:   Thu Jul 10 02:55:33 2014 -0500

        Avoid unnecessary clock_gettime() syscalls in GC stats.

Noticed by uselex.rb:
    getThreadCPUTime: [R]: exported from:
        ./rts/dist/build/posix/GetTime.p_o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark 'copied' as static
Sergei Trofimovich [Sun, 7 Feb 2016 16:41:06 +0000 (16:41 +0000)] 
rts: mark 'copied' as static

Noticed by uselex.rb:
    copied: [R]: exported from:
        ./rts/dist/build/sm/GC.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: mark scavenge_mutable_list as static
Sergei Trofimovich [Sun, 7 Feb 2016 16:08:56 +0000 (16:08 +0000)] 
rts: mark scavenge_mutable_list as static

Noticed by uselex.rb:
    scavenge_mutable_list: [R]: exported from:
        ./rts/dist/build/sm/Scav.o
    scavenge_mutable_list1: [R]: exported from:
        ./rts/dist/build/sm/Scav.thr_o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agorts: drop unused calcLiveBlocks, calcLiveWords
Sergei Trofimovich [Sun, 7 Feb 2016 15:55:44 +0000 (15:55 +0000)] 
rts: drop unused calcLiveBlocks, calcLiveWords

Use of these helper functions was removed by
  commit 18896fa2b06844407fd1e0d3f85cd3db97a96ff4
  Author: Simon Marlow <marlowsd@gmail.com>
  Date:   Wed Feb 2 15:49:55 2011 +0000

Noticed by uselex.rb:
    calcLiveBlocks: [R]: exported from:
        ./rts/dist/build/sm/Storage.o
    calcLiveWords: [R]: exported from:
        ./rts/dist/build/sm/Storage.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agovalidate: enable -DDEBUG in stage 1 by default
Ömer Sinan Ağacan [Sun, 7 Feb 2016 18:14:44 +0000 (13:14 -0500)] 
validate: enable -DDEBUG in stage 1 by default

Since the whole point of validation is to test the compiler, assertions
should be enabled at least for some part of the build. Previously
assertions were only enabled (1) in stage 2 compiler (2) when "slow"
setting is used. With this patch we enable assertions in stage 1
compiler in all settings, to test them on (1) the compiler itself (2)
the libraries, even with the "fast" setting.

This will make "fast" setting slower, but the difference should be quite
modest - I didn't realize a significant difference in validation times.

Reviewers: bgamari, austin, thomie

Reviewed By: thomie

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

3 years agomkDocs: Fix fallout from c5f4f95c64006a9f
Ben Gamari [Sun, 7 Feb 2016 15:40:31 +0000 (10:40 -0500)] 
mkDocs: Fix fallout from c5f4f95c64006a9f

Fixes #11419

3 years agomkDocs: Update for xz
Ben Gamari [Sun, 7 Feb 2016 15:40:02 +0000 (10:40 -0500)] 
mkDocs: Update for xz

Fixes #11419.

3 years agotestsuite: ignore *.prof.normalised files
Sergei Trofimovich [Sun, 7 Feb 2016 15:00:47 +0000 (15:00 +0000)] 
testsuite: ignore *.prof.normalised files

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agohp2ps: mark local functions as 'static'
Sergei Trofimovich [Sun, 7 Feb 2016 09:29:55 +0000 (09:29 +0000)] 
hp2ps: mark local functions as 'static'

Found by uselex.rb:
    fonttab: [R]: exported from: ./utils/hp2ps/dist/build/Dimensions.o
    GetString: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o
    thestring: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o
    auxfp: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    dflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    filter: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    iflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    mflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    pflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    psfile: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    tflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    OrderOf: [R]: exported from: ./utils/hp2ps/dist/build/Reorder.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agounlit: mark local functions as 'static'
Sergei Trofimovich [Sun, 7 Feb 2016 09:10:54 +0000 (09:10 +0000)] 
unlit: mark local functions as 'static'

Found by uselex.rb:
    complain: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    egetc: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    myputc: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    readline: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    unlit: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    writeerror: [R]: exported from: ./utils/unlit/dist/build/unlit.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoRevert "Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape"
Ömer Sinan Ağacan [Sun, 7 Feb 2016 01:09:27 +0000 (20:09 -0500)] 
Revert "Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape"

This reverts commit 4f9967aa3d1f7cfd539d0c173cafac0fe290e26f.

3 years agoAdd test for #11516
Ben Gamari [Sat, 6 Feb 2016 14:16:15 +0000 (15:16 +0100)] 
Add test for #11516

3 years agoAdd a derived `Show SrcLoc` instance
Eric Seidel [Sat, 6 Feb 2016 13:16:53 +0000 (14:16 +0100)] 
Add a derived `Show SrcLoc` instance

Test Plan:
```
ghci> import GHC.Stack
ghci> SrcLoc "f" "b" "c" 1 2 3 4
SrcLoc {srcLocPackage = "f", srcLocModule = "b", srcLocFile = "c",
srcLocStartLine = 1, srcLocStartCol = 2, srcLocEndLine = 3,
srcLocEndCol = 4}
```

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Projects: #ghc

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

GHC Trac Issues: #11510

3 years agoFix @since annotations for renamed pretty{CallStack,SrcLoc}
Herbert Valerio Riedel [Sat, 6 Feb 2016 10:33:14 +0000 (11:33 +0100)] 
Fix @since annotations for renamed pretty{CallStack,SrcLoc}

3 years agoGHCi: Fix Windows build (again)
Ben Gamari [Fri, 5 Feb 2016 15:11:01 +0000 (16:11 +0100)] 
GHCi: Fix Windows build (again)

GHC.Conc exports Shutdown

3 years agoUse default xz compression level
Ben Gamari [Fri, 5 Feb 2016 12:37:05 +0000 (13:37 +0100)] 
Use default xz compression level

-9e is crazy expensive for very little pay-off. See
http://smart-cactus.org/~ben/posts/2016-02-04-compression-comparison.html
for details.

3 years agoRemove unused LiveVars and SRT fields of StgCase and StgLetNoEscape
Ömer Sinan Ağacan [Thu, 4 Feb 2016 21:22:48 +0000 (16:22 -0500)] 
Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape

Also remove the functions and types that became useless after removing
the fields:

- SRT functions
- LiveInfo type and functions
- freeVarsToLiveVars
- unariseLives and unariseSRT

Reviewers: bgamari, simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

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

3 years agoFix a few loose ends from D1795
Ben Gamari [Thu, 4 Feb 2016 09:46:28 +0000 (10:46 +0100)] 
Fix a few loose ends from D1795

George updated the Diff but I didn't noticed until it was too late.

3 years agoOverhaul the Overhauled Pattern Match Checker
George Karachalias [Wed, 3 Feb 2016 18:06:45 +0000 (19:06 +0100)] 
Overhaul the Overhauled Pattern Match Checker

Overhaul the Overhauled Pattern Match Checker

* Changed the representation of Value Set Abstractions. Instead of
using a prefix tree, we now use a list of Value Vector Abstractions.
The set of constraints Delta for every Value Vector Abstraction is the
oracle state so that we solve everything only once.

* Instead of doing everything lazily, we prune at once (and in general
everything is much stricter). Hence, an example written with pattern
guards is checked in almost the same time as the equivalent with
pattern matching.

* Do not store the covered and the divergent sets at all. Since what we
only need is a yes/no (does this clause cover anything? Does it force
any thunk?) We just keep a boolean for each.

* Removed flags `-Wtoo-many-guards` and `-ffull-guard-reasoning`.
Replaced with `fmax-pmcheck-iterations=n`. Still debatable what should
the default `n` be.

* When a guard is for sure not going to contribute anything, we treat
it as such: The oracle is not called and cases `CGuard`, `UGuard` and
`DGuard` from the paper are not happening at all (the generation of a
fresh variable, the unfolding of the pattern list etc.). his combined
with the above seems to be enough to drop the memory increase for test
T783 down to 18.7%.

* Do not export function `dsPmWarn` (it is now called directly from
within `checkSingle` and `checkMatches`).

* Make `PmExprVar` hold a `Name` instead of an `Id`. The term oracle
does not handle type information so using `Id` was a waste of
time/space.

* Added testcases T11195, T11303b (data families) and T11374

The patch addresses at least the following:
Trac #11195, #11276, #11303, #11374, #11162

Test Plan: validate

Reviewers: goldfire, bgamari, hvr, austin

Subscribers: simonpj, thomie

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

3 years agoAllow all RTS options to iserv
Simon Marlow [Wed, 3 Feb 2016 15:33:40 +0000 (07:33 -0800)] 
Allow all RTS options to iserv

3 years agoUpdate binary submodule to 0.8.2.0 release
Herbert Valerio Riedel [Tue, 2 Feb 2016 21:43:06 +0000 (22:43 +0100)] 
Update binary submodule to 0.8.2.0 release

3 years agoUpdate cabal_macros_boot.h
Herbert Valerio Riedel [Tue, 2 Feb 2016 21:07:05 +0000 (22:07 +0100)] 
Update cabal_macros_boot.h

the MIN_VERSION_bytestring() macro is going to be needed
for the upcoming binary update

3 years agoTcMType: Add some elementary notes
Ben Gamari [Tue, 2 Feb 2016 13:50:22 +0000 (14:50 +0100)] 
TcMType: Add some elementary notes

It's astoundingly difficult to find a good description of zonking. Given
that there is a Stack Overflow question on the matter, I'm clearly not
the only one who feels this way. Hopefully this will clarify the issue.

Test Plan: Read it

Reviewers: goldfire, austin, simonpj

Subscribers: thomie

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

3 years agoAdd (failing) test for #11247
Thomas Miedema [Mon, 21 Dec 2015 16:23:21 +0000 (17:23 +0100)] 
Add (failing) test for #11247

3 years agoMake TypeError a newtype, add changelog entry
RyanGlScott [Tue, 2 Feb 2016 14:03:04 +0000 (09:03 -0500)] 
Make TypeError a newtype, add changelog entry

Summary:
Phab:D866 added the `TypeError` datatype to `Control.Exception` to represent
the error that is thrown when `-fdefer-type-errors` is on, but a changelog
entry for it was never added. In addition, it should probably be a
newtype.

Reviewers: austin, hvr, KaneTW, bgamari

Reviewed By: KaneTW, bgamari

Subscribers: thomie, KaneTW

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

GHC Trac Issues: #10284

3 years agoUse a correct substitution in tcCheckPatSynDecl
Bartosz Nitka [Tue, 2 Feb 2016 13:02:23 +0000 (05:02 -0800)] 
Use a correct substitution in tcCheckPatSynDecl

The `substTheta` call didn't have the free variables of the
`prov_theta` in the `in_scope` set. It should be enough to add
`univ_tvs`, as all the `ex_tvs` are already in the domain of
the substitution.

Test Plan: added a testcase

Reviewers: simonpj, bgamari, goldfire, austin

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11524

3 years agoFix Windows build after D1874
Tamar Christina [Tue, 2 Feb 2016 11:36:52 +0000 (12:36 +0100)] 
Fix Windows build after D1874

Windows uses wchar_t* for paths. The code committed won't compile for
Windows as the types are incorrect and the types in the branches of the
ternary operator aren't consistent.

Test Plan: ./validate --fast

Reviewers: austin, rwbarton, erikd, bgamari

Subscribers: thomie

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

3 years agoRemote GHCi: parallelise BCO serialization
Simon Marlow [Mon, 1 Feb 2016 16:39:50 +0000 (16:39 +0000)] 
Remote GHCi: parallelise BCO serialization

Summary:
Serialization of BCOs is slow, but we can parallelise it when using
ghci -j<n>.  It parallelises nicely, saving multiple seconds off the
link time in a large example I have.

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

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

GHC Trac Issues: #11100

3 years agoRemote GHCi: batch the creation of strings
Simon Marlow [Mon, 1 Feb 2016 16:19:10 +0000 (16:19 +0000)] 
Remote GHCi: batch the creation of strings

Summary:
This makes a big performance difference especially when loading a
large number of modules and using parallel compilation (ghci -jN).

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

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

GHC Trac Issues: #11100

3 years agoRemote GHCi: Optimize the serialization/deserialization of byte code
Simon Marlow [Fri, 29 Jan 2016 11:27:50 +0000 (11:27 +0000)] 
Remote GHCi: Optimize the serialization/deserialization of byte code

Summary: This cuts allocations by about a quarter.

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

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

GHC Trac Issues: #11100

3 years agoTyCoRep: Implement some helpers for dropping/checking Levity arguments
Ömer Sinan Ağacan [Tue, 2 Feb 2016 01:15:21 +0000 (20:15 -0500)] 
TyCoRep: Implement some helpers for dropping/checking Levity arguments

Also fix `isLevityTy` (it should use `coreView`) and start using
`dropLevityArgs` in some places.

Reviewers: goldfire, simonpj, austin, hvr, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

3 years agoUpdate unix submodule to latest snapshot
Herbert Valerio Riedel [Mon, 1 Feb 2016 18:38:46 +0000 (19:38 +0100)] 
Update unix submodule to latest snapshot

Besides containing more internal refactorings,
this update also bumps unix's version number to 2.7.2.0

3 years agoAvoid mangled/derived names in GHCi autocomplete (fixes #11328)
Adam Gundry [Mon, 1 Feb 2016 15:41:03 +0000 (16:41 +0100)] 
Avoid mangled/derived names in GHCi autocomplete (fixes #11328)

This changes `getRdrNamesInScope` to use field labels rather than
selector names for fields from modules with `DuplicateRecordFields`
enabled. Moreover, it filters out derived names (e.g. type
representation bindings) that shouldn't show up in autocomplete.

Test Plan: New test ghci/should_run/T11328

Reviewers: kolmodin, austin, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #11328

3 years agoFix runtime linker error message when old symbol had no owner
Reid Barton [Mon, 1 Feb 2016 14:43:48 +0000 (09:43 -0500)] 
Fix runtime linker error message when old symbol had no owner

Test Plan: Actually run validate. This fixes test linker_error3.

Reviewers: austin, erikd, bgamari

Reviewed By: erikd, bgamari

Subscribers: thomie

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

3 years agoTypo in docs
Ben Gamari [Mon, 1 Feb 2016 13:33:15 +0000 (14:33 +0100)] 
Typo in docs

Spelling mistakes fixed,

 * identiy > identity
 * suprising > surprising

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoAdd some Outputable instances
Oleg Grenrus [Mon, 1 Feb 2016 13:32:54 +0000 (14:32 +0100)] 
Add some Outputable instances

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoFix LOOKS_LIKE_PTR for 64-bit platforms
Reid Barton [Mon, 1 Feb 2016 13:32:38 +0000 (14:32 +0100)] 
Fix LOOKS_LIKE_PTR for 64-bit platforms

I'm not sure what this is used for. But it won't correctly
detect RTS-filled slop on 64-bit platforms.

Test Plan:
Untested. But I did verify that

    unsigned long x = (unsigned long)0xaaaaaaaaaaaaaaaaULL;

compiles warning-free and produces the expected output using both
gcc and clang, with -Wall -Wextra -O, and with and without -m32.

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoImplement basic uniform warning set tower
Herbert Valerio Riedel [Mon, 1 Feb 2016 13:32:30 +0000 (14:32 +0100)] 
Implement basic uniform warning set tower

This implements/completes the current basic warning sets to provide the
following tower of warning sets (i.e. each line subsumes the warnings
from the sets listed below):

- `-Weverything`
- `-Wall`
- `-Wextra` (alias of `-W`)
- `-Wdefault`

So for each of flags there's also a complement `-Wno-...` flag, which
subtracts the given set from the current enabled-warnings state.

Thus, we can now easily perform simple set subtraction operations, as
warning flags are evaluated from left-to-right on the command line.

So e.g.

- `-Weverything -Wno-all -Wno-compat` enables *all* warnings not enabled
  by `-Wall` and `-Wcompat`.

- `-Wextra -Wno-default` only warnings that `-Wextra` provides
  beyond the default warnings.

Reviewers: quchen, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoHide the CallStack implicit parameter
Eric Seidel [Mon, 1 Feb 2016 13:32:19 +0000 (14:32 +0100)] 
Hide the CallStack implicit parameter

The implicit parameter isn't actually very relevant to the CallStack
machinery, so we hide the implementation details behind a constraint
alias

```
type HasCallStack = (?callStack :: CallStack)
```

This has a few benefits:

1. No need to enable `ImplicitParams` in user code.
2. No need to remember the `?callStack` naming convention.
3. Gives us the option to change the implementation details in the
future with less user-land breakage.

The revised `CallStack` API is exported from `GHC.Stack` and makes no
mention of the implicit parameter.

Test Plan: ./validate

Reviewers: simonpj, austin, hvr, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Projects: #ghc

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

3 years agoSimplify ghc-boot database representation with new type class.
Edward Z. Yang [Mon, 1 Feb 2016 13:31:49 +0000 (14:31 +0100)] 
Simplify ghc-boot database representation with new type class.

Previously, we had an 'OriginalModule' type in ghc-boot which
was basically identical to 'Module', and we had to do a bit of
gyrating to get it converted into the right form.  This commit
introduces a new typeclass, 'DbModuleRep' which represents types
which we know how to serialize to and from the (now renamed) 'DbModule'
type.

The upshot is that we can just store 'Module's DIRECTLY in
the 'InstalledPackageInfo', no conversion needed.

I took the opportunity to clean up ghc-pkg to make its use of
the 'BinaryStringRep' classes more type safe.

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

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoSuppress substitution assertions to fix tests
Bartosz Nitka [Mon, 1 Feb 2016 10:39:50 +0000 (02:39 -0800)] 
Suppress substitution assertions to fix tests

This is one place that I've missed with D1862.
This doesn't fix the underlying problem and I prefer to suppress it
now and fix it later as this is a part of a larger effort (#11371)
to fix an old bug with `substTy` called with invalid `in_scope` sets.

Test Plan: `make test TEST="hClose002 hClose003 hDuplicateTo001"

Reviewers: thomie, austin, bgamari, trofi

Reviewed By: trofi

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

GHC Trac Issues: #11371

3 years agoMissing @since annotations in GHC.Generics
RyanGlScott [Mon, 1 Feb 2016 02:10:48 +0000 (21:10 -0500)] 
Missing @since annotations in GHC.Generics

[ci skip]

3 years agoMinor doc fixes to GHC.Generics
RyanGlScott [Mon, 1 Feb 2016 02:02:57 +0000 (21:02 -0500)] 
Minor doc fixes to GHC.Generics

This adds @since annotations and fixes a couple of Haddock formatting
errors.

3 years agoWhen encountering a duplicate symbol, show source of the first symbol
Reid Barton [Mon, 1 Feb 2016 00:10:29 +0000 (19:10 -0500)] 
When encountering a duplicate symbol, show source of the first symbol

Test Plan: Used this to track down an issue I was having.

Reviewers: simonmar, austin, erikd, bgamari

Reviewed By: erikd, bgamari

Subscribers: thomie

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

3 years agoFix Trac issue #11487.
Geoffrey Mainland [Sun, 31 Jan 2016 18:35:41 +0000 (13:35 -0500)] 
Fix Trac issue #11487.

3 years agoProperly track live registers when saving the CCCS.
Geoffrey Mainland [Thu, 28 Jan 2016 14:58:37 +0000 (09:58 -0500)] 
Properly track live registers when saving the CCCS.

Summary:
When saving the CCCS, we now correctly track the set of live registers and pass
them to the jump_SAVE_CCCS macro. This is now a variadic macro, but variadic
macros are supported by GCC since 3.0 and by all versions of clang, so this
should not be a problem.

Test Plan:
./validate with the following build options:

```
BuildFlavour = quick-llvm
SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage
```

Reviewers: bgamari, simonmar, austin, rwbarton, simonpj

Subscribers: thomie

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

GHC Trac Issues: #11487

3 years agoCode formatting cleanup.
Geoffrey Mainland [Thu, 28 Jan 2016 15:34:53 +0000 (10:34 -0500)] 
Code formatting cleanup.

3 years agoAdd type signatures.
Geoffrey Mainland [Thu, 28 Jan 2016 14:58:28 +0000 (09:58 -0500)] 
Add type signatures.

3 years agoPut docs in /usr/share/doc/ghc-<version>
Thomas Miedema [Fri, 29 Jan 2016 19:30:47 +0000 (20:30 +0100)] 
Put docs in /usr/share/doc/ghc-<version>

`make install` puts libraries in a direcory containing the version
number. Do the same for the docs, such that multiple installs can live
side-by-side.

Delete unused ghcdocdir.

Test Plan:
```
./boot
./configure
make show! VALUE=docdir
```

Reviewed by: bgamari

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

GHC Trac Issues: #11354

3 years agoUpdate unix submodule to latest snapshot
Herbert Valerio Riedel [Sat, 30 Jan 2016 23:53:11 +0000 (00:53 +0100)] 
Update unix submodule to latest snapshot

This is a follow-up to
6c7760b26133a0490f613895a37ff67045249fc8
which should have been accompanied by a submodule update...

3 years agoDefine CTYPE for more Posix types
Herbert Valerio Riedel [Sat, 30 Jan 2016 17:50:17 +0000 (18:50 +0100)] 
Define CTYPE for more Posix types

See also b9f636b3aa962154c1b1515a3acecfbe9071b308 for explaination,
as `unix` is slowly migrating to make more use of CApiFFI we need
more accurately annotated CTYPES.

3 years agoAdd asserts to other substitution functions
Bartosz Nitka [Wed, 27 Jan 2016 16:37:30 +0000 (08:37 -0800)] 
Add asserts to other substitution functions

This adds asserts to `substTys`, `substCo` and `substCos` in
the same spirit as already existing asserts on `substTy`, protecting
every possible entry point to `subst_ty` and `subst_co`.

I've replaced the violators with unchecked versions.

Test Plan: ./validate --slow

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoAdd release note about flexible RebindableSyntax
Richard Eisenberg [Wed, 27 Jan 2016 15:55:17 +0000 (10:55 -0500)] 
Add release note about flexible RebindableSyntax

3 years agoAdd closing parenthesis in comment for eqString (#11507)
Thomas Miedema [Fri, 29 Jan 2016 04:46:08 +0000 (05:46 +0100)] 
Add closing parenthesis in comment for eqString (#11507)

Spotted by czipperz

3 years agoFix the Windows build
Thomas Miedema [Fri, 29 Jan 2016 04:32:38 +0000 (05:32 +0100)] 
Fix the Windows build

3 years agoMark dynamic-paper as expect_fail_for optasm and optllvm (#11330)
Thomas Miedema [Fri, 29 Jan 2016 03:05:15 +0000 (04:05 +0100)] 
Mark dynamic-paper as expect_fail_for optasm and optllvm (#11330)

It passes with `-O -fhpc` though, strange... (I didn't read the paper)

3 years agoFixup test for #10728
Thomas Miedema [Fri, 29 Jan 2016 04:19:46 +0000 (05:19 +0100)] 
Fixup test for #10728

It was failing for WAY=ghci.

3 years agoUse the in_scope set in lint_app
Bartosz Nitka [Wed, 27 Jan 2016 19:59:02 +0000 (11:59 -0800)] 
Use the in_scope set in lint_app

This makes the call to `substTy` satisfy the invariant from
Note [The substitution invariant] in TyCoRep.

Test Plan: ./validate --slow

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agofix validate breakage
Simon Marlow [Wed, 27 Jan 2016 16:57:44 +0000 (08:57 -0800)] 
fix validate breakage

(Travis said it was OK!)

3 years agoUpdate profiling test output
Simon Marlow [Wed, 27 Jan 2016 08:20:01 +0000 (08:20 +0000)] 
Update profiling test output

There were a couple of broken profiling tests.

3 years agoRemote GHCi: create cost centre stacks in batches
Simon Marlow [Thu, 21 Jan 2016 09:46:13 +0000 (09:46 +0000)] 
Remote GHCi: create cost centre stacks in batches

Towards optimising the binary serialisation that
-fexternal-interpreter does, this saves quite a bit of time when using
-fexternal-interpreter with -prof.

3 years agoFix cost-centre-stack bug when creating new PAP (#5654)
Simon Marlow [Thu, 21 Jan 2016 09:45:52 +0000 (09:45 +0000)] 
Fix cost-centre-stack bug when creating new PAP (#5654)

See comment in `AutoApply.h`.  This partly fixes #5654.  New test
added, and renamed the old test to match the ticket number.

3 years agoRename "open" subst functions
Bartosz Nitka [Tue, 26 Jan 2016 19:59:37 +0000 (11:59 -0800)] 
Rename "open" subst functions

This is the renaming that @simonpj requested:
```
· zipOpenTCvSubst  -> zipTvSubst   (It only deals with tyvars)

· zipOpenTCvSubstCoVars -> zipCvSubst   (it only deals with
covars)

· zipOpenTCvSubstBinders ->  zipTyBinderSubst  (it only deals
with TyBinders, not covars)
```
plus the `mk` variant.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: thomie, simonpj

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

GHC Trac Issues: #11371

3 years agoRefactor the typechecker to use ExpTypes.
Richard Eisenberg [Thu, 14 Jan 2016 04:29:17 +0000 (23:29 -0500)] 
Refactor the typechecker to use ExpTypes.

The idea here is described in [wiki:Typechecker]. Briefly,
this refactor keeps solid track of "synthesis" mode vs
"checking" in GHC's bidirectional type-checking algorithm.
When in synthesis mode, the expected type is just an IORef
to write to.

In addition, this patch does a significant reworking of
RebindableSyntax, allowing much more freedom in the types
of the rebindable operators. For example, we can now have
`negate :: Int -> Bool` and
`(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
is in tcSyntaxOp.

This addresses tickets #11397, #11452, and #11458.

Tests:
  typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
  th/T11452

3 years agoFix some substitution InScopeSets
Richard Eisenberg [Tue, 26 Jan 2016 03:00:47 +0000 (22:00 -0500)] 
Fix some substitution InScopeSets

This is relevant to #11371.

3 years agos/unLifted/unlifted for consistency
Ömer Sinan Ağacan [Wed, 27 Jan 2016 12:15:15 +0000 (13:15 +0100)] 
s/unLifted/unlifted for consistency

This was causing trouble as we had to remember when to use "unLifted"
and when to use "unlifted".

"unlifted" is used instead of "unLifted" as it's a single word.

Reviewers: austin, hvr, goldfire, bgamari

Subscribers: thomie

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

3 years agoDocument -fllvm-fill-undef-with-garbage
Ben Gamari [Wed, 27 Jan 2016 11:24:48 +0000 (12:24 +0100)] 
Document -fllvm-fill-undef-with-garbage

3 years agoTest for undef bugs in the LLVM backend when validating
Reid Barton [Wed, 27 Jan 2016 10:05:59 +0000 (11:05 +0100)] 
Test for undef bugs in the LLVM backend when validating

In an attempt to catch bugs involving using undef values, replace
undef literals by values likely to cause crashes or test failures.
We do this only when validating since it is a deoptimization.

This depends on D1857 to catch such bugs in the RTS (such as #11487).

Test Plan:
Did a build with
```
BuildFlavour = quick-llvm
SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage
```
The build crashed when running ghc-stage2, as expected.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoUse stage1 build variables when building the RTS
Reid Barton [Wed, 27 Jan 2016 10:05:50 +0000 (11:05 +0100)] 
Use stage1 build variables when building the RTS

The fourth argument of distdir-way-opts was missing. So, for example,
SRC_HC_OPTS_STAGE1 was not used when building the RTS.

Test Plan: validate --slow

Reviewers: austin, bgamari, thomie

Reviewed By: thomie

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

3 years agoRestore original alignment for info tables
Simon Brenner [Wed, 27 Jan 2016 10:05:35 +0000 (11:05 +0100)] 
Restore original alignment for info tables

This was broken in 4a32bf925b8aba7885d9c745769fe84a10979a53, meaning
that info tables and subsequent code are no longer guaranteed to have
the recommended alignment.  Split up the section header and section
alignment printers, and print an appropriate alignment directive before
each info table.

Fixes Trac #11486

Reviewers: austin, bgamari, rwbarton

Reviewed By: bgamari, rwbarton

Subscribers: thomie

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

GHC Trac Issues: #11486

3 years agorts/Timer: Actually fix #9105
Ben Gamari [Wed, 27 Jan 2016 10:05:23 +0000 (11:05 +0100)] 
rts/Timer: Actually fix #9105

jberthold astutely pointed out that the previous fix (D1822) could not
have possibly fixed the issue as the patch would only have had any
effect if !PROFILING.

Test Plan: Check for reduced CPU usage when compiled with `-prof` but
without `+RTS -p`

Reviewers: simonmar, austin, jberthold

Reviewed By: simonmar, jberthold

Subscribers: simonmar, thomie

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

GHC Trac Issues: #9105

3 years agoghci: fix trac issue #11481
Benjamin Bykowski [Wed, 27 Jan 2016 10:05:13 +0000 (11:05 +0100)] 
ghci: fix trac issue #11481

Test Plan: validate

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

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

GHC Trac Issues: #11481

3 years agoTypos in comments
Gabor Greif [Wed, 27 Jan 2016 10:11:04 +0000 (11:11 +0100)] 
Typos in comments

3 years agoFix a typo in the note name in comments
Bartosz Nitka [Wed, 27 Jan 2016 09:55:52 +0000 (01:55 -0800)] 
Fix a typo in the note name in comments

This is `subsititution` to `substitution`, plus one instance of
the note that I missed.

Test Plan: docufix

Reviewers: simonpj, bgamari, austin, goldfire

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoEnable RemoteGHCi on Windows
Tamar Christina [Wed, 27 Jan 2016 09:20:11 +0000 (10:20 +0100)] 
Enable RemoteGHCi on Windows

Makes the needed changes to make RemoteGHCi work on Windows.
The approach passes OS Handles areound instead of the Posix Fd
as on Linux.

The reason is that I could not find any real documentation about
the behaviour of Windows w.r.t inheritance and Posix FDs.

The implementation with Fd did not seem to be able to find the Fd
in the child process. Instead I'm using the much better documented
approach of passing inheriting handles.

This requires a small modification to the `process` library.
https://github.com/haskell/process/pull/52

Test Plan: ./validate On Windows x86_64

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

Reviewed By: simonmar

Subscribers: #ghc_windows_task_force

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

GHC Trac Issues: #11100

3 years agoBuild profiling libraries on `validate --slow` (#11496)
Thomas Miedema [Tue, 26 Jan 2016 23:08:53 +0000 (00:08 +0100)] 
Build profiling libraries on `validate --slow` (#11496)

3 years agoTestsuite: fixup req_profiling tests (#11496)
Thomas Miedema [Tue, 26 Jan 2016 12:07:38 +0000 (13:07 +0100)] 
Testsuite: fixup req_profiling tests (#11496)

* T2552 (#10037) is failng for all threaded opt_ways, not for WAY=prof.
* TH_spliceE5_prof (#11495) is failing when ghc_dynamic
* Rename ghci_dynamic to ghc_dynamic. It's the same thing.