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

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.