ghc.git
3 years agoAnother batch of typo fixes in non-code
Gabor Greif [Thu, 11 Feb 2016 11:38:21 +0000 (12:38 +0100)] 
Another batch of typo fixes in non-code

3 years agocompiler: Do not suggest nor complete deprecated flags fix trac issue #11454
Nikita Kartashov [Thu, 11 Feb 2016 10:58:30 +0000 (11:58 +0100)] 
compiler: Do not suggest nor complete deprecated flags fix trac issue #11454

Previously, all flags were present in user suggest and completion. This commit
removes the deprecated ones from there. It is done by saving deprecation info
at the moment of flag definition.

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

3 years agosizeExpr: fix a bug in the size calculation
Simon Marlow [Wed, 10 Feb 2016 09:19:34 +0000 (09:19 +0000)] 
sizeExpr: fix a bug in the size calculation

There were two bugs here:

* We weren't ignoring Cast in size_up_app
* An application of a non-variable wasn't being charged correct

The result was that some things looked too cheap.  In my case I had
things like

    ((f x) `cast` ...) y

which was given size 21 instead of 30, and this had knock-on effects
elsewhere that caused some large code bloat.

Test Plan:
* nofib runs (todo)
* validate

Reviewers: simonpj, austin, bgamari, erikd

Subscribers: thomie

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

GHC Trac Issues: #11564

3 years agoIgnore untracked in nofib
Simon Marlow [Wed, 10 Feb 2016 22:23:14 +0000 (22:23 +0000)] 
Ignore untracked in nofib

3 years agoComments about ru_auto
Simon Peyton Jones [Thu, 11 Feb 2016 11:00:24 +0000 (11:00 +0000)] 
Comments about ru_auto

...following a question from Conal

3 years agoAlways do eta-reduction
Simon Peyton Jones [Thu, 11 Feb 2016 10:38:33 +0000 (10:38 +0000)] 
Always do eta-reduction

See Note [Eta-reduction in -O0] in DynFlags.

Bottom line: doing eta reduction unconditionally is benign, and
removes an ASSERT failure (Trac #11562).

3 years agoReplace mkTvSubstPrs (a `zip` b) with zipTvSubst a b
Bartosz Nitka [Wed, 10 Feb 2016 16:12:44 +0000 (08:12 -0800)] 
Replace mkTvSubstPrs (a `zip` b) with zipTvSubst a b

It's just a small cleanup. There should be no change in
behaviour.

Test Plan: ./validate --slow

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

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

3 years agoWrap solveEqualities in checkNoErrs
Simon Peyton Jones [Wed, 10 Feb 2016 14:32:22 +0000 (14:32 +0000)] 
Wrap solveEqualities in checkNoErrs

This simple change fixes Trac #11563, #11520, #11516, #11399.
See esp the comments in #11520.

See Note [Fail fast on kind errors] in TcSimplify

Merge to 8.0 branch

3 years agomkUserGuide: fix option wrapping in a table
Sergei Trofimovich [Wed, 10 Feb 2016 14:12:03 +0000 (14:12 +0000)] 
mkUserGuide: fix option wrapping in a table

Noticed as a sphinx warning:
    docs/users_guide/flags-warnings.gen.rst:97:
        WARNING: Inline interpreted text or phrase
        reference start-string without end-string.

Which pointed to broken table.

Before the patch table looked like:

    | :ghc-flag:`-Wno-unticked-promoted-constructors |
    | `                                              |

After the patch long link is on a single line:

    | :ghc-flag:`-Wno-unticked-promoted-constructors`    |

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agodocs: add newline after '.. ghc-flag::'
Sergei Trofimovich [Wed, 10 Feb 2016 14:10:03 +0000 (14:10 +0000)] 
docs: add newline after '.. ghc-flag::'

Noticed when looked through sphinx warnings:
    docs/users_guide/safe_haskell.rst:4:
        SEVERE: Duplicate ID: "ghc-flag-Issue"

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoError early when you register with too old a version of Cabal.
Edward Z. Yang [Wed, 10 Feb 2016 10:09:53 +0000 (11:09 +0100)] 
Error early when you register with too old a version of Cabal.

On the GHC 8.0 RCs, multiple users reported a very strange error
whereby GHC would complain that the symbols names recorded in interface
files did not match the expected name.  The reason for this is
that they were using an old version of Cabal which chose symbol
names differently from the installed package ID ('id' field) which
the package was to be installed with; GHC 8.0 now mandates that
these coincides.

This change adds a test to ghc-pkg to make sure that 'id' and 'key'
(which is how Cabal previously reported what the symbol name
was supposed to be) match; if they don't match or key is missing,
we assume that the Cabal was too old.

Bikeshed points:

    - Should we offer more information about how to upgrade
      Cabal correctly (i.e. specify a version?)

    - Should we allow for a missing 'key'?  If we allow for
      'key' to be missing, we lose the ability to detect
      Cabal from GHC 7.8 or earlier being used.  If we
      require it to be specified, then it will not be possible
      for Cabal to deprecate the (unused) field and remove it
      without having BC for 8.0.

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

Reviewers: austin, bgamari, hvr

Reviewed By: hvr

Subscribers: bergmark, thomie

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

GHC Trac Issues: #11558

3 years agoExpand users' guide TH declaration groups section (#9813)
Owen Stephens [Wed, 10 Feb 2016 09:18:41 +0000 (10:18 +0100)] 
Expand users' guide TH declaration groups section (#9813)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoadd Template Haskell regression test for #9022.
Dominik Bollmann [Wed, 10 Feb 2016 09:18:29 +0000 (10:18 +0100)] 
add Template Haskell regression test for #9022.

The bug itself has already been fixed in #10734, so this
only adds another regression test (as given in the ticket).

Test Plan: ./validate

Reviewers: goldfire, austin, thomie, bgamari

Reviewed By: bgamari

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

GHC Trac Issues: #9022

3 years agoDynFlags: drop tracking of '-#include' flags
Sergei Trofimovich [Sun, 3 Jan 2016 12:07:10 +0000 (12:07 +0000)] 
DynFlags: drop tracking of '-#include' flags

GHC does not use passed paramaters anywhere
for this deprecated option.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoTcPatSyn: Fix spelling of "pattern" in error message
Ben Gamari [Tue, 9 Feb 2016 13:42:01 +0000 (14:42 +0100)] 
TcPatSyn: Fix spelling of "pattern" in error message

3 years agoTcErrors: Fix plural form of "instance" error
Ben Gamari [Tue, 9 Feb 2016 13:39:39 +0000 (14:39 +0100)] 
TcErrors: Fix plural form of "instance" error

Previously "types" was inappropriately made plural instead of
"instance",

    instance Eq Ordering -- Defined in ‘GHC.Classes’
    ...plus 24 others
    ...plus 13 instance involving out-of-scope typess

3 years agoRestore derived Eq instance for SrcLoc
RyanGlScott [Tue, 9 Feb 2016 10:06:34 +0000 (11:06 +0100)] 
Restore derived Eq instance for SrcLoc

GHC 7.10.2 and 7.10.3 had a derived `Eq` instance for `SrcLoc`, but it
seems to have been removed (see
6740d70d95cb81cea3859ff847afc61ec439db4f) during GHC 8.0 development.

Reviewers: hvr, austin, gridaphobe, bgamari

Reviewed By: gridaphobe, bgamari

Subscribers: thomie

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

3 years agoUnset GREP_OPTIONS in build system
Ben Gamari [Tue, 9 Feb 2016 10:06:27 +0000 (11:06 +0100)] 
Unset GREP_OPTIONS in build system

Test Plan: GREP_OPTIONS=--blah ./validate

Reviewers: austin, thomie

Reviewed By: thomie

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

GHC Trac Issues: #11530

3 years agoEarly error when crosscompiling + haddock/docs
Thomas Miedema [Tue, 9 Feb 2016 10:06:13 +0000 (11:06 +0100)] 
Early error when crosscompiling + haddock/docs

When CrossCompiling=YES or Stage1Only=YES, building the haddocks and the
User's Guide should be skipped, because haddock and mkUserGuidePart
depend on the GHC API.
See Note [No stage2 packages when CrossCompiling or Stage1Only] for
details.

There are several places in the build system where the variables
HADDOCK_DOCS and BUILD_SPHINX_* are checked. Instead of also checking
for the variables CrossCompiling or Stage1Only in all those places,
`make` will now exit with a nice error message when the user requests
the impossible.

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

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

3 years agoFix the removal of unnecessary stack checks
Jonas Scholl [Tue, 9 Feb 2016 10:06:00 +0000 (11:06 +0100)] 
Fix the removal of unnecessary stack checks

The module CmmLayoutStack removes stack checks if a function does not
use stack space. However, it can only recognize checks of the form
Sp < SpLim. However, these checks get sometimes rewritten to
Sp >= SpLim (with both branches swapped), so we better recognize these
checks too.

Test Plan: ./validate

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #11533

3 years agotestsuite: Un-break T5642
Ben Gamari [Mon, 8 Feb 2016 16:44:44 +0000 (17:44 +0100)] 
testsuite: Un-break T5642

This was largely fixed by the re-rework of the pattern match checker.
Resolves #5642.

3 years agoPrint * has Unicode star with -fprint-unicode-syntax
Ben Gamari [Mon, 8 Feb 2016 15:29:04 +0000 (16:29 +0100)] 
Print * has Unicode star with -fprint-unicode-syntax

Reviewers: austin, thomie

Subscribers: thomie

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

3 years agoRemove unused LiveVars and SRT fields of StgCase
Ömer Sinan Ağacan [Mon, 8 Feb 2016 21:18:23 +0000 (16:18 -0500)] 
Remove unused LiveVars and SRT fields of StgCase

We also need to update `stgBindHasCafRefs` assertion with this change,
as we no longer have the pre-computed SRT, LiveVars etc. We rename it to
`topStgBindHasCafRefs` and implement it like this:

A non-updatable top-level binding may refer to a CAF by referring to a
top-level definition with CAFs. A top-level definition may have CAFs if
it's updatable. At this point (because this is done after TidyPgm)
top-level Ids (whether imported or defined in this module) are
GlobalIds, so the top-levelness test is easy. (see also comments in the
code)

Reviewers: bgamari, simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11550

3 years agoDefine tyConRolesRepresentational and use it
Simon Peyton Jones [Mon, 8 Feb 2016 17:41:58 +0000 (17:41 +0000)] 
Define tyConRolesRepresentational and use it

tyConRolesRepresentational is just a version of tyConRolesX, but
specialised for a Representational argument. Saves a bit of extra
argument passing and pattern matching, and tyConRolesX was often
called when we knew the argument role was Representational.

Rather to my surprise this made the compiler allocate 5% less
for tests T9872{b,c,d}.  At least I think it's this commit.
Good thing, regardless.

3 years agoTest Trac #11552
Simon Peyton Jones [Mon, 8 Feb 2016 17:38:26 +0000 (17:38 +0000)] 
Test Trac #11552

3 years agoDefine mkTvSubst, and use it
Simon Peyton Jones [Mon, 8 Feb 2016 17:36:52 +0000 (17:36 +0000)] 
Define mkTvSubst, and use it

   mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
produces a TCvSubst with an empty CvSubstEnv

3 years agoSome tiding up in TcGenDeriv
Simon Peyton Jones [Mon, 8 Feb 2016 15:29:12 +0000 (15:29 +0000)] 
Some tiding up in TcGenDeriv

..around newtype deriving instances.

See esp the new Note [Newtype-deriving instances]

No change in behaviour

3 years agorelease notes: Note new two-step allocator
Ben Gamari [Mon, 8 Feb 2016 14:51:55 +0000 (15:51 +0100)] 
release notes: Note new two-step allocator

3 years agoFix a nasty superclass expansion bug
Simon Peyton Jones [Mon, 8 Feb 2016 14:41:08 +0000 (14:41 +0000)] 
Fix a nasty superclass expansion bug

This patch fixes Trac #11523.

* The basic problem was that TcRnTypes.superClassesMightHelp was
  returning True of a Derived constraint, and that led to us
  expanding Given superclasses, which produced the same Derived
  constraint again, and so on infinitely.  We really want to do
  this only if there are unsolve /Wanted/ contraints!

* On the way I made TcSMonad.getUnsolvedInerts a bit more
  discriminating about which Derived equalities it returns;
  see Note [Unsolved Derived equalities] in TcSMonad

* Lots of new comments in TcSMonad.

3 years agoA small, local refactoring of TcSimplify.usefulToFloat
Simon Peyton Jones [Mon, 8 Feb 2016 13:38:09 +0000 (13:38 +0000)] 
A small, local refactoring of TcSimplify.usefulToFloat

3 years agoUse runTcSDeriveds for simplifyDefault
Simon Peyton Jones [Mon, 8 Feb 2016 13:36:31 +0000 (13:36 +0000)] 
Use runTcSDeriveds for simplifyDefault

This is a small refactoring, no change in behaviour.

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