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

3 years agoConstruct in_scope set in mkTopTCvSubst
Bartosz Nitka [Tue, 26 Jan 2016 19:26:06 +0000 (11:26 -0800)] 
Construct in_scope set in mkTopTCvSubst

The pre-condition on `mkTopTCvSubst` turned out to be wrong and
not satisfied by any of the callers. I've fixed it, so that it
constructs the in_scope set from the range of the substitution.
`mkTopTCvSubst` was also unnecessarily general it is never called
with `CoVars`, so I changed the type signature and added an assertion.

Test Plan: ./validate --slow

Reviewers: goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoSplit off -Wunused-type-variables from -Wunused-matches
RyanGlScott [Tue, 26 Jan 2016 17:33:19 +0000 (12:33 -0500)] 
Split off -Wunused-type-variables from -Wunused-matches

Summary:
Previously, `-Wunused-matches` would fire whenever it detected unused type
variables in a type family or data family instance. This can be annoying for
users who wish to use type variable names as documentation, as being
`-Wall`-compliant would mean that they'd have to prefix many of their type
variable names with underscores, making the documentation harder to read.

To avoid this, a new warning `-Wunused-type-variables` was created that only
encompasses unused variables in family instances. `-Wunused-matches` reverts
back to its role of only warning on unused term-level pattern names. Unlike
`-Wunused-matches`, `-Wunused-type-variables` is not implied by `-Wall`.

Fixes #11451.

Test Plan: ./validate

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

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11451

3 years agoFix segmentation fault when .prof file not writeable
Thomas Miedema [Tue, 26 Jan 2016 00:11:49 +0000 (01:11 +0100)] 
Fix segmentation fault when .prof file not writeable

There are two ways to do retainer profiling. Quoting from the user's guide:
  1. `+RTS -hr` "Breaks down the graph by retainer set"
  2. `+RTS -hr<cc> -h<x>`, where `-h<x>` is one of normal heap profiling
     break-down options (e.g. `-hc`), and `-hr<cc> means "Restrict the
     profile to closures with retainer sets containing cost-centre
     stacks with one of the specified cost centres at the top."

Retainer profiling writes to a .hp file, like the other heap profiling
options, but also to a .prof file. Therefore, when the .prof file is not
writeable for whatever reason, retainer profiling should be turned off
completely.

This worked ok when running the program with `+RTS -hr` (option 1), but a
segfault would occur when using `+RTS -hr<cc> -h<x>`, with `x!=r` (option 2).

This commit fixes that.

Reviewed by: bgamari

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

GHC Trac Issues: #11489

3 years agoNicer error on +RTS -hc without -rtsopts or -prof
Thomas Miedema [Mon, 25 Jan 2016 19:07:31 +0000 (20:07 +0100)] 
Nicer error on +RTS -hc without -rtsopts or -prof

Before:
 * without -rtsopts: Most RTS options are disabled. Link with -rtsopts to enable them.
 * with -rtsopts: invalid heap profile option: -hc
After:
 * the flag -hc requires the program to be built with -prof

Copy `Note [OPTION_SAFE vs OPTION_UNSAFE]` from commit 8c7ad0bd.

Reviewed by: bgamari

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

3 years agoPass InScopeSet to substTy in lintTyApp
Bartosz Nitka [Thu, 21 Jan 2016 19:30:07 +0000 (11:30 -0800)] 
Pass InScopeSet to substTy in lintTyApp

This is the fix proposed in #11371:
```
In other cases, we already have the in-scope set in hand. Example: in
CoreLint.lintTyApp we find a call to substTyWith. But Lint carries an
in-scope set, so it would be easy to pass it to substTyWith.
```

Test Plan: ./validate --slow (only pre-existing problems)

Reviewers: simonpj, goldfire, austin, nomeata, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoFix three broken tests involving exceptions
Simon Peyton Jones [Tue, 26 Jan 2016 12:36:21 +0000 (12:36 +0000)] 
Fix three broken tests involving exceptions

See comment:16 in Trac #10712. The tests were wrong, not GHC!

3 years agoUpdate process submodule to 1.4.2.0 release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:41:23 +0000 (12:41 +0100)] 
Update process submodule to 1.4.2.0 release

Most notably, this pulls in a feature needed for #11100 (remote ghci)
windows-support

3 years agoUpdate transformers submodule to 0.5.1.0 release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:03:23 +0000 (12:03 +0100)] 
Update transformers submodule to 0.5.1.0 release

This shouldn't have any noticeable API changes for GHC

3 years agoMinor users-guide markup fixup [skip ci]
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:00:58 +0000 (12:00 +0100)] 
Minor users-guide markup fixup [skip ci]

3 years agoMissed plural renaming in user's guide
Herbert Valerio Riedel [Tue, 26 Jan 2016 10:59:40 +0000 (11:59 +0100)] 
Missed plural renaming in user's guide

Follow-up to 132c20894d102558cc8f3aee5bc289425d0ddb24

[skip ci]

3 years agoFix two cloning-related bugs
Simon Peyton Jones [Tue, 26 Jan 2016 09:30:50 +0000 (09:30 +0000)] 
Fix two cloning-related bugs

Crikey!  Not just one but two bugs in type variable cloning,
both dating from the days before PolyKinds.  Both were shown up
by Trac #11330.

1. In SetLevels, when floating a case expression we must clone its
   binders, *and* do so in a telescope-aware way, because the
   constructor may bind a kind variable that appears in the kind
   of a type variable.

   Instead of doing this (wrongly) by steam, call CoreSubst.cloneBndrs.

   I added Notes and did other refactoring at the same time.

2. It turned out that CoreSubst.cloneBndrs calls TyCoRep.cloneTyVarBndr,
   and that too was bogus!  It didn't substitute in the kind of the
   TyVar being cloned.  There was even a comment to say "variables can't
   appear in kinds".  Thta hasn't been true for a long time now.

Easily fixed.

Interestingly, I then found that test
   dependent/should_compile/KindEqualities
was emitting a new inexhaustive-pattern-match warning.  Sure enough
it was valid!  So the lack of cloning in cloneTyVarBndr really was
causing an observable bug; just one that we had not observed.

3 years agoKill off zipTopTCvSubst in favour of zipOpenTCvSubst
Simon Peyton Jones [Tue, 26 Jan 2016 09:37:06 +0000 (09:37 +0000)] 
Kill off zipTopTCvSubst in favour of zipOpenTCvSubst

As Bartosz has discovered, the invariants for substitutions were
wrong, and in particular the "mkTop...Subst" and "zipTop..Subst"
functions were building substitutions that didn't obey even the
old invariants.

This patch kills of the bogus zipTopTCvSubst in favour of the
more robust zipOpenTCvSubst.

I tripped over this because my upcoming patch (concerning SetLevels,
Trac #11330) triggered an ASSERT failure in the substitution
well-formedness assertion in TyCoRep.

3 years agoAdd "ticks-exhausted" comment
Simon Peyton Jones [Tue, 26 Jan 2016 09:24:33 +0000 (09:24 +0000)] 
Add "ticks-exhausted" comment

This code deliberately builds a subtle negative-occurrence-of-data-type
example, described in the paper, so with -O it'll give "simplifier
ticks exhausted".

This patch just adds a comment to explain.

3 years agoWhite space only
Simon Peyton Jones [Tue, 26 Jan 2016 09:00:57 +0000 (09:00 +0000)] 
White space only

3 years agoLess verbose output for the in-scope set
Simon Peyton Jones [Mon, 25 Jan 2016 14:17:14 +0000 (14:17 +0000)] 
Less verbose output for the in-scope set

With -dppr-debug the output for the (ofen-large) InScope set
was overwhelming.  This makes it smaller.

Only affects debugging.

3 years agoEnsure that we don't produce code for pre-ARMv7 without barriers
Ben Gamari [Mon, 25 Jan 2016 20:19:04 +0000 (21:19 +0100)] 
Ensure that we don't produce code for pre-ARMv7 without barriers

We are unable to produce load/store barriers for pre-ARMv7 targets.
Phab:D894 added dummy cases to SMP.h for these barriers to prevent the
build from failing under the assumption that there are no SMP-capable
devices of this vintage. However, #10433 points out that it is more
correct to simply set NOSMP for such targets.

Tested By: rwbarton

Test Plan: Validate

Reviewers: erikd, rwbarton, austin

Reviewed By: rwbarton

Subscribers: thomie

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

GHC Trac Issues: #10433

3 years agoImplement -Wunrecognised-warning-flag
Ben Gamari [Mon, 25 Jan 2016 16:14:49 +0000 (17:14 +0100)] 
Implement -Wunrecognised-warning-flag

This allows the user to avoid warnings for warning flags that GHC
doesn't recognise. See #11429 for details..

Test Plan: Validate with T11429[abc] tests

Reviewers: austin, hvr

Reviewed By: hvr

Subscribers: thomie

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

GHC Trac Issues: #11429

3 years agouser-guide: Note order-dependence of flags
Ben Gamari [Mon, 25 Jan 2016 14:18:13 +0000 (15:18 +0100)] 
user-guide: Note order-dependence of flags

This supplements the description previously added in
6400c7687223c5b2141176aa92f7ff987f61aba6. See #10560 for details.

Test Plan: read it

Reviewers: austin

Subscribers: thomie, hvr

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

GHC Trac Issues: #10560

3 years agoBetter document behavior of -Wmissed-specialisations
Ben Gamari [Mon, 25 Jan 2016 14:18:04 +0000 (15:18 +0100)] 
Better document behavior of -Wmissed-specialisations

Test Plan: Read it

Reviewers: austin

Subscribers: thomie

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

3 years agoRename -Wmissing-monadfail-instance to plural-form
Herbert Valerio Riedel [Mon, 25 Jan 2016 13:51:50 +0000 (14:51 +0100)] 
Rename -Wmissing-monadfail-instance to plural-form

This warning flag was recently introduced as part of #10751. However,
it was missed during code-review that almost all existing warning
flags use a plural-form, so for consistency this commit renames
that warning flag to `-Wmissing-monadfail-instances`.

Test Plan: local validate (still running)

Reviewers: quchen, goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10751

3 years agoHscTypes: Fix typo in comment
Ben Gamari [Sat, 23 Jan 2016 21:51:51 +0000 (22:51 +0100)] 
HscTypes: Fix typo in comment

3 years agoComments only: more alternate names for ARM registers [skip ci]
Reid Barton [Mon, 25 Jan 2016 14:13:04 +0000 (09:13 -0500)] 
Comments only: more alternate names for ARM registers [skip ci]

Summary:
These are the names used by arm-linux-androideabi-objdump, so
it's helpful to have them here next to the Stg register mapping.

Reviewers: austin, erikd, bgamari

Reviewed By: erikd, bgamari

Subscribers: thomie

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

3 years agoShow error message for unknown symbol on Elf_Rel platforms
Reid Barton [Mon, 25 Jan 2016 14:12:40 +0000 (09:12 -0500)] 
Show error message for unknown symbol on Elf_Rel platforms

Summary: This is already the behavior on Elf_Rela platforms, and is helpful.

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: erikd

Subscribers: thomie

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

3 years agoFix exprIsHNF (Trac #11248)
Simon Peyton Jones [Mon, 25 Jan 2016 11:16:18 +0000 (11:16 +0000)] 
Fix exprIsHNF (Trac #11248)

Blimey!  CoreUtils.exprIsHNFlike had not one but two bugs.

 * is_hnf_like treated coercion args like type args
   (result: exprIsHNF might wrongly say True)

 * app_is_value treated type args like value args
   (result: exprIsHNF might wrongly say False)

Bizarre.  This goes back to at least 2012. It's amazing that it
hasn't caused more trouble.

It was discovered by a Lint error when compiling Trac #11248 with -O.

3 years agoImprove tracing in checkValidInstance
Simon Peyton Jones [Mon, 25 Jan 2016 08:31:51 +0000 (08:31 +0000)] 
Improve tracing in checkValidInstance

3 years agoAvoid recursive use of immSuperClasses
Simon Peyton Jones [Mon, 25 Jan 2016 08:29:12 +0000 (08:29 +0000)] 
Avoid recursive use of immSuperClasses

In fixing Trac #11480 I had omitted to deal with FunDeps.oclose,
which was making recursive use of immSuperClasses, and hence
going into a loop in the recursive case.

Solution: use transSuperClasses, which takes care not to.

3 years agoRefactor validity checking for type/data instances
Simon Peyton Jones [Fri, 22 Jan 2016 16:40:55 +0000 (16:40 +0000)] 
Refactor validity checking for type/data instances

I found that there was some code duplication going on,
so I've put more into the shared function checkValidFamPats.

I did some refactoring in checkConsistentFamInst too,
preparatory to #11450; the error messages change a little
but no change in behaviour.

3 years agoSpecial-case implicit params in superclass expansion
Simon Peyton Jones [Fri, 22 Jan 2016 16:34:18 +0000 (16:34 +0000)] 
Special-case implicit params in superclass expansion

This issue came up in Trac #11480, and is documented in
Note [When superclasses help] in TcRnTypes.

We were getting a spurious warning
  T11480.hs:1:1: warning:
     solveWanteds: too many iterations (limit = 4)

The fix is easy.  A bit of refactoring along the way.

The original bug report in Trac #11480 appears to work
fine in HEAD and the 8.0 branch but I added a regression
test in this commit as well.

3 years agoImplement `-Wnoncanonical-monadfail-instances` warning
Herbert Valerio Riedel [Sun, 24 Jan 2016 13:46:44 +0000 (14:46 +0100)] 
Implement `-Wnoncanonical-monadfail-instances` warning

The MonadFail proposal implemented so far via #10751 only warns about
missing `MonadFail` instances based on existence of failible pattern
matches in `do`-blocks.

However, based on the noncanonical Monad warnings implemented via #11150
we can provide a different mechanism for detecting missing `MonadFail`
instances quite cheaply. That is, by checking for canonical `fail` definitions.

In the case of `Monad`/`MonadFail`, we define the canonical implementation of
`fail` to be such that the soft-deprecated method shall (iff overridden) be
defined in terms of the non-deprecated method. Consequently, in case of
`MonadFail`, the `Monad(fail)` method shall be defined as alias of
the `MonadFail(fail)` method.

This allows us at some distant point in the future to remove `fail` from
the `Monad` class, while having GHC ignore/tolerate such literal canonical
method definitions.

Reviewed By: bgamari, RyanGlScott

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

3 years agoAdd -fwarn-redundant-constrains to test for #9708
Thomas Miedema [Sun, 24 Jan 2016 01:49:42 +0000 (02:49 +0100)] 
Add -fwarn-redundant-constrains to test for #9708

Fixes validate on Travis.

Reviewed by: bgamari

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

3 years agoRemove `replaceDynFlags` from `ContainsDynFlags`
Thomas Miedema [Tue, 19 Jan 2016 10:54:36 +0000 (11:54 +0100)] 
Remove `replaceDynFlags` from `ContainsDynFlags`

Refactoring only. It's shorter, and brings
`HasDynFlags/ContainsDynFLags` in line with `HasModule/ContainsModule`.
Introduce `updTopEnv`.

Reviewed by: bgamari

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

3 years agoDocs: delete section on Hierarchical Modules
Thomas Miedema [Sun, 24 Jan 2016 12:07:47 +0000 (13:07 +0100)] 
Docs: delete section on Hierarchical Modules

This information is mostly useless, since hierarchical modules are valid
Haskell2010 and everybody knows how to use them.

Reviewed by: bgamari

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

3 years agoUser's guide: fix singular/plural typo in flagnames
Herbert Valerio Riedel [Sun, 24 Jan 2016 14:33:48 +0000 (15:33 +0100)] 
User's guide: fix singular/plural typo in flagnames

3 years agoAdd test for #11473
Ben Gamari [Fri, 22 Jan 2016 12:33:36 +0000 (13:33 +0100)] 
Add test for #11473

3 years agouser-guide: Document -L RTS flag
Ben Gamari [Sat, 23 Jan 2016 21:03:04 +0000 (22:03 +0100)] 
user-guide: Document -L RTS flag

See #5641.

3 years agoDon't add ticks around type applications (#11329)
Reid Barton [Sat, 23 Jan 2016 20:30:04 +0000 (15:30 -0500)] 
Don't add ticks around type applications (#11329)

Test Plan: validate --slow

Reviewers: austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: thomie

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

3 years agouser-guide: Fix typos
Ben Gamari [Sat, 23 Jan 2016 20:12:24 +0000 (21:12 +0100)] 
user-guide: Fix typos

3 years agouser-guide: Reformat warning lists
Ben Gamari [Sat, 23 Jan 2016 18:17:45 +0000 (19:17 +0100)] 
user-guide: Reformat warning lists

3 years agomkUserGuidePart: Better flag cross-referencing
Ben Gamari [Sat, 23 Jan 2016 18:10:59 +0000 (19:10 +0100)] 
mkUserGuidePart: Better flag cross-referencing

3 years agoRemove -Wredundant-superclasses from standard warnings
Ben Gamari [Sat, 23 Jan 2016 17:40:33 +0000 (18:40 +0100)] 
Remove -Wredundant-superclasses from standard warnings

It is impossible to write warning-free code under the three-release
policy with this flag enabled by default. See #11370 for details.

3 years agoGive a more verbose error message when desugaring a HsTypeOut
Reid Barton [Sat, 23 Jan 2016 12:13:31 +0000 (13:13 +0100)] 
Give a more verbose error message when desugaring a HsTypeOut

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoSmall doc fix
Adam Sandberg Eriksson [Sat, 23 Jan 2016 12:13:07 +0000 (13:13 +0100)] 
Small doc fix

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoRemove unused IND_PERM
Joachim Breitner [Sat, 23 Jan 2016 12:12:10 +0000 (13:12 +0100)] 
Remove unused IND_PERM

it seems that this closure type has not been in use since 5d52d9, so all
this is dead and untested code. This removes it. Some of the code might
be useful for a counting indirection as described in #10613, so when
implementing that, have a look at what this commit removes.

Test Plan: validate on harbormaster

Reviewers: austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

3 years agoAdd test for Trac #11056
RyanGlScott [Sat, 23 Jan 2016 12:03:26 +0000 (13:03 +0100)] 
Add test for Trac #11056

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton

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

GHC Trac Issues: #11056

3 years agorts: Disable tick timer unless really needed
Ben Gamari [Fri, 22 Jan 2016 15:22:13 +0000 (16:22 +0100)] 
rts: Disable tick timer unless really needed

Trac #9105 notes significant CPU usage by an otherwise idle process when
compiled with profiling. The reason for this is that we keep the tick
timer active in the profiling RTS even if profiling wasn't requested at
runtime.

If the user requests any sort of profiling then we need to keep the
timer active to ensure that samples are collected.

Test Plan: Validate, check CPU usage, ensure profiling still works

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: thomie

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

GHC Trac Issues: #9105

3 years agoDo not count void arguments when considering a function for loopification.
Jonas Scholl [Fri, 22 Jan 2016 15:21:57 +0000 (16:21 +0100)] 
Do not count void arguments when considering a function for loopification.

This fixes #11372 by omitting arguments with a void-type when checking
whether a self-recursive tail call can be optimized to a local jump.
Previously, a function taking a real argument and a State# token
would report an arity of 1 in the SelfLoopInfo in getCallMethod,
but a self-recursive call would apply it to 2 arguments, one of them
being the State# token, thus no local jump would be generated.
As the State# token is not represented by anything at runtime, we can
ignore it and thus trigger the loopification optimization.

Test Plan: ./validate

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari

Subscribers: simonmar, thomie

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

GHC Trac Issues: #11372

3 years agoFix a formatting error in the user's guide
Eric Seidel [Fri, 22 Jan 2016 15:16:46 +0000 (16:16 +0100)] 
Fix a formatting error in the user's guide

```
``CallStack``s
```

seems to confuse ReST into producing an extended code-span

```
``CallStack``\s
```

fixes it, but there may be a better solution

Test Plan: build the user's guide and inspect the last paragraph of
"9.14.4.5. Implicit CallStacks"

Reviewers: bgamari

Reviewed By: bgamari

Projects: #ghc

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

3 years agoMark some ghci tests as req_interp
Reid Barton [Fri, 22 Jan 2016 15:00:27 +0000 (10:00 -0500)] 
Mark some ghci tests as req_interp

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

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

3 years agoDon't print "Loaded GHCi configuration" message in ghc -e (#11478)
Reid Barton [Fri, 22 Jan 2016 14:59:20 +0000 (09:59 -0500)] 
Don't print "Loaded GHCi configuration" message in ghc -e (#11478)

Summary:
Also don't print it if the user specifically requested
non-verbose output with -v0.

Since this means there is no longer any test that checks
for the message, add such a test.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11478

3 years agoAdd tests for #11465 and the kind invariant
Ben Gamari [Fri, 22 Jan 2016 12:01:55 +0000 (13:01 +0100)] 
Add tests for #11465 and the kind invariant

3 years agoDefault non-canonical CallStack constraints
Eric Seidel [Fri, 22 Jan 2016 11:45:53 +0000 (12:45 +0100)] 
Default non-canonical CallStack constraints

Test Plan: `make test TEST=T11462`

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Projects: #ghc

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

GHC Trac Issues: #11462

3 years agoMake a constraint synonym for repeated BinaryStringRep and use it.
Edward Z. Yang [Thu, 21 Jan 2016 18:27:58 +0000 (19:27 +0100)] 
Make a constraint synonym for repeated BinaryStringRep and use it.

Test Plan: validate

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

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

3 years agoAdd expected stderr for #11466 test case
Joachim Breitner [Fri, 22 Jan 2016 09:51:46 +0000 (10:51 +0100)] 
Add expected stderr for #11466 test case

3 years agoAlways run test T9407
Reid Barton [Fri, 22 Jan 2016 02:09:21 +0000 (21:09 -0500)] 
Always run test T9407

We don't know what the cause of the bug was, or what commit fixed it.
or why it was Windows only. So it seems prudent to run it in all
configurations, in case the bug should crop up again.

3 years agoImprove comments in CmmSwitch
Joachim Breitner [Thu, 21 Jan 2016 16:55:48 +0000 (17:55 +0100)] 
Improve comments in CmmSwitch

addressing some valuable feedback by thomie at
https://phabricator.haskell.org/rGHCde1160be0477

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

3 years agosphinx-build: fix python stack overflow (Trac #10950)
Sergei Trofimovich [Thu, 21 Jan 2016 21:43:37 +0000 (21:43 +0000)] 
sphinx-build: fix python stack overflow (Trac #10950)

Summary:
commit a034031a102bc08c76a6cdb104b72922ae22c96b did not
fix problem completely. Stack overflows still occasionally
happen.

Easy to test by the following Torture Test:

  while sphinx-build -T -N -E -a -b html \
        -d docs/users_guide/.doctrees-html \
        -D latex_paper_size=letter \
        docs/users_guide docs/users_guide/build-html/users_guide
  do
    echo again
  done

sphinx build large nested data structures when parses GHC manual
(docs/users_guide/glasgow_exts.rst is 455KB in size) which
can't be serialized useing default python call stack depth of 1000
calls.

The patch increases stack depth 10 times. Survived 2 hours of
Torture Test.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: ran Torture Test to make sure it is stable

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10950

3 years agoFix docstring GHC.IO.Handle.FD.openFileBLocking
Thomas Miedema [Thu, 21 Jan 2016 20:16:05 +0000 (21:16 +0100)] 
Fix docstring GHC.IO.Handle.FD.openFileBLocking

Fixes #4248.

3 years agoAdd -ignore-dot-ghci to tests that use --interactive
Reid Barton [Thu, 21 Jan 2016 18:50:00 +0000 (13:50 -0500)] 
Add -ignore-dot-ghci to tests that use --interactive

3 years agoAdd a missing .gitignore entry in annotations tests
Reid Barton [Thu, 21 Jan 2016 16:16:47 +0000 (11:16 -0500)] 
Add a missing .gitignore entry in annotations tests

3 years agoUpdate and improve documentation in Data.Foldable
Ben Gamari [Thu, 21 Jan 2016 13:51:01 +0000 (14:51 +0100)] 
Update and improve documentation in Data.Foldable

Previously there were a few obsolete references to `Data.List` and
the descriptions were lacking examples.

Fixes #11065.

Test Plan: Read it.

Reviewers: ekmett, goldfire, hvr, austin

Reviewed By: hvr

Subscribers: nomeata, thomie

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

GHC Trac Issues: #11065

3 years agorel-notes: Note the return of -Wmonomorphism-restriction
Ben Gamari [Thu, 21 Jan 2016 13:49:01 +0000 (14:49 +0100)] 
rel-notes: Note the return of -Wmonomorphism-restriction