10 months agotestsuite: Add test for #16104
Ben Gamari [Tue, 15 Jan 2019 16:48:59 +0000 (11:48 -0500)] 
testsuite: Add test for #16104

10 months agotestsuite: Add predicate for CPU feature availability
Ben Gamari [Thu, 27 Dec 2018 19:41:01 +0000 (14:41 -0500)] 
testsuite: Add predicate for CPU feature availability

Previously testing code-generation for ISA extensions was nearly impossible
since we had no ability to determine whether the host supports the needed
extension. Here we fix this by introducing a simple /proc/cpuinfo-based
testsuite predicate. We really ought to

10 months agoAdd @sgraf to CODEOWNERS
Sebastian Graf [Sat, 26 Jan 2019 17:44:23 +0000 (12:44 -0500)] 
Add @sgraf to CODEOWNERS

[skip ci]

10 months agoAdd Simon and Richard as more CODEOWNERS
Richard Eisenberg [Fri, 25 Jan 2019 03:27:00 +0000 (22:27 -0500)] 
Add Simon and Richard as more CODEOWNERS

[skip ci]

10 months agogitlab-ci: Explicitly clear dependencies of all jobs
Ben Gamari [Tue, 22 Jan 2019 19:21:31 +0000 (14:21 -0500)] 
gitlab-ci: Explicitly clear dependencies of all jobs

Apparently GitLab CI defaults to declaring all jobs of the previous
stage as dependencies of a job. This meant that we would end up
downloading all of our binary distributions during the `cleanup` stage,
eating up a truly remarkable amount of S3 tranfers.

10 months agotestsuite: Skip ghcilink002 when unregisterised
Ben Gamari [Tue, 22 Jan 2019 23:40:36 +0000 (18:40 -0500)] 
testsuite: Skip ghcilink002 when unregisterised

See #16085.

10 months agoMinor refactor [ci skip]
Gabor Greif [Tue, 22 Jan 2019 11:13:28 +0000 (12:13 +0100)] 
Minor refactor [ci skip]

10 months agoA few typofixes
Gabor Greif [Tue, 22 Jan 2019 11:07:47 +0000 (12:07 +0100)] 
A few typofixes

10 months agogitlab-ci: Drop CircleCI jobs
Ben Gamari [Tue, 22 Jan 2019 19:25:05 +0000 (14:25 -0500)] 
gitlab-ci: Drop CircleCI jobs

It's pretty unlikely we will be going back to circleci at this point


10 months agoError out of invalid Int/Word bit shifts
Alec Theriault [Fri, 11 Jan 2019 07:44:04 +0000 (23:44 -0800)] 
Error out of invalid Int/Word bit shifts

Although the Haddock's for `shiftL` and `shiftR` do require the number
of bits to be non-negative, we should still check this before calling
out to primitives (which also have undefined behaviour for negative bit

If a user _really_ wants to bypass checks that the number of bits is
sensible, they already have the aptly-named `unsafeShiftL`/`unsafeShiftR`
at their disposal.

See #16111.

10 months agogitlab: Collect artifacts on Windows
Ben Gamari [Wed, 16 Jan 2019 04:21:39 +0000 (23:21 -0500)] 
gitlab: Collect artifacts on Windows

10 months agoUpdate Darwin CI to use new toplevel --with-intree-gmp configure flag
Alec Theriault [Tue, 22 Jan 2019 03:25:29 +0000 (19:25 -0800)] 
Update Darwin CI to use new toplevel --with-intree-gmp configure flag

10 months agoHadrian: support in-tree GMP
Alec Theriault [Thu, 6 Dec 2018 04:46:21 +0000 (20:46 -0800)] 
Hadrian: support in-tree GMP

This adds top-level configure flags '--with-intree-gmp' and
'--with-framework-preferred', both of which are especially relevant
on MacOS.

Besides gaining two new flags, Hadrian also had to be taught what to
do with the 'framework' in .cabal files.

Test Plan:
./boot && ./configure --with-intree-gmp && ./hadrian/
./boot && ./configure --with-gmp-framework-preferred && ./hadrian/ # on macos

Reviewers: carter, snowleopard, alpmestan, hvr, goldfire, bgamari

Subscribers: rwbarton, erikd

GHC Trac Issues: #16001

Differential Revision:

10 months agogitlab-ci: Disallow failure
Ben Gamari [Thu, 17 Jan 2019 18:56:00 +0000 (13:56 -0500)] 
gitlab-ci: Disallow failure

10 months agotestsuite: Mark T16180 as broken on Darwin
Ben Gamari [Wed, 23 Jan 2019 00:08:07 +0000 (19:08 -0500)] 
testsuite: Mark T16180 as broken on Darwin

See #16218.

10 months agotestsuite: Mark ghci063 as broken on Darwin
Ben Gamari [Thu, 17 Jan 2019 18:55:00 +0000 (13:55 -0500)] 
testsuite: Mark ghci063 as broken on Darwin

This is the last failing test on Darwin preventing us from disallowing CI
failures. See #16201.

10 months agoHadrian: install patches 'haddock-{html,interface}'
Alec Theriault [Sat, 19 Jan 2019 09:06:00 +0000 (01:06 -0800)] 
Hadrian: install patches 'haddock-{html,interface}'

Since the `$(docdir)` can be picked independently from the `$(libdir)`,
we need to make sure that that the `haddock-html` and `haddock-interface`
fields in the package DB (which is in the `$(libdir)`) get updated to
point to the appropriate places in the `$(docdir)`.

NB: in the make system, `ghc-cabal` would cover this sort of thing by
re-running `configure` on installation, but here we get away with a
couple lines of `sed` and a call to `ghc-pkg recache`.

Fixes #16202.

10 months agotestsuite: Ensure that config.{msys,cygwin} are initialized
Ben Gamari [Mon, 21 Jan 2019 01:45:34 +0000 (20:45 -0500)] 
testsuite: Ensure that config.{msys,cygwin} are initialized

Reviewers: monoidal

Reviewed By: monoidal

Subscribers: monoidal, rwbarton, carter

Differential Revision:

10 months agoAdd myself to CODEOWNERS for a few files
Joachim Breitner [Tue, 22 Jan 2019 09:57:52 +0000 (10:57 +0100)] 
Add myself to CODEOWNERS for a few files

10 months agoMinor typo in docs for KProxy
Joachim Breitner [Tue, 22 Jan 2019 10:17:57 +0000 (11:17 +0100)] 
Minor typo in docs for KProxy

really minor, but it annoyed me when reading it :-)

10 months agoFix hadrian prof flavour so that it builds a profiled version of GHC
Matthew Pickering [Tue, 22 Jan 2019 11:33:18 +0000 (11:33 +0000)] 
Fix hadrian prof flavour so that it builds a profiled version of GHC

In Alp's refactoring of `getProgramContexts` he removed a call to
`getProgramContext` which was where the logic for this used to be

Fixes #16214

10 months agousers guide: fix typesetting of pragmas
Ben Price [Tue, 22 Jan 2019 00:16:14 +0000 (00:16 +0000)] 
users guide: fix typesetting of pragmas

10 months agousers guide: consistent spelling of inlinable
Ben Price [Tue, 22 Jan 2019 00:15:05 +0000 (00:15 +0000)] 
users guide: consistent spelling of inlinable

10 months agogitlab-ci: Reenable Hadrian build on Windows
Ben Gamari [Mon, 21 Jan 2019 20:55:05 +0000 (15:55 -0500)] 
gitlab-ci: Reenable Hadrian build on Windows

10 months agoUpdate transformers module
Herbert Valerio Riedel [Tue, 22 Jan 2019 00:00:10 +0000 (01:00 +0100)] 
Update transformers module

10 months agoFix bogus worker for newtypes
Simon Peyton Jones [Wed, 16 Jan 2019 16:34:24 +0000 (16:34 +0000)] 
Fix bogus worker for newtypes

The "worker" for a newtype is actually a function
with a small (compulsory) unfolding, namely a cast.

But the construction of this function was plain wrong
for newtype /instances/; it cast the arguemnt to the
family type rather than the representation type.

This never actually bit us because, in the case of a
family instance, we immediately cast the result to
the family type.  So we get
   \x. (x |> co1) |> co2

where the compositio of co1 and co2 is ill-kinded.
However the optimiser (even the simple optimiser)
just collapsed those casts, ignoring the mis-match
in the middle, so we never saw the problem.

Trac #16191 is indeed a dup of #16141; but the resaon
these tickets produce Lint errors is not the unnecessary
forcing; it's because of the ill-typed casts.

This patch fixes the ill-typed casts, properly.  I can't
see a way to trigger an actual failure prior to this
patch, but it's still wrong wrong wrong to have ill-typed
casts, so better to get rid of them.

10 months agoExtend linker-script workaround to work with musl libc
Samuel Holland [Mon, 21 Jan 2019 02:20:16 +0000 (20:20 -0600)] 
Extend linker-script workaround to work with musl libc

GHC has code to handle unsuffixed .so files that are linker scripts
pointing to the real shared library. The detection is done by parsing
the result of `dlerror()` after calling `dlopen()` and looking for
certain error strings. On musl libc, the error message is "Exec format
error", which happens to be `strerror(ENOEXEC)`:

$ cat tmp.c
#include <dlfcn.h>
#include <stdio.h>

int main(void) {
        dlopen("", RTLD_NOW | RTLD_GLOBAL);
        return 0;
$ gcc -o tmp tmp.c
$ ./tmp
Error loading shared library Exec format error

This change fixes the workaround to also work on musl libc.

10 months agoAdd CODEOWNERS
Ben Gamari [Mon, 21 Jan 2019 19:42:13 +0000 (14:42 -0500)] 

GitLab uses this file to suggest reviewers based upon the files that a Merge
Request touches.


10 months agogitlab: Add merge request template
Ben Gamari [Sat, 19 Jan 2019 20:47:33 +0000 (15:47 -0500)] 
gitlab: Add merge request template

This begins to define our expectations of contributions.


10 months agoFix typo in TcRnTypes.hs [skip ci]
Matthew Pickering [Mon, 21 Jan 2019 17:17:20 +0000 (12:17 -0500)] 
Fix typo in TcRnTypes.hs [skip ci]

10 months agoAdd support for ASM foreign files (.s) in TH (#16180)
Sylvain Henry [Tue, 15 Jan 2019 12:14:45 +0000 (13:14 +0100)] 
Add support for ASM foreign files (.s) in TH (#16180)

10 months agoRemove TODO in HsExpr
Matthew Pickering [Fri, 18 Jan 2019 16:36:12 +0000 (11:36 -0500)] 
Remove TODO in HsExpr

It is correct to be `GhcTc` as the data type is for expressions which are inside splices
so they can be delayed until desugaring.

10 months agoMention DerivingStrategies in the warning when DAC and GND are both enabled
Chaitanya Koparkar [Mon, 14 Jan 2019 19:36:29 +0000 (14:36 -0500)] 
Mention DerivingStrategies in the warning when DAC and GND are both enabled


When DeriveAnyClass and GeneralizedNewtypeDeriving are both enabled,
GHC prints out a warning that specifies the strategy it used to
derive a class. This patch updates the warning to mention that users
may pick a particular strategy by using DerivingStrategies.

Test plan: make test TEST=T16179

10 months ago[T16199] Adds a verify-packages script
Moritz Angermann [Sun, 20 Jan 2019 10:24:21 +0000 (05:24 -0500)] 
[T16199] Adds a verify-packages script

10 months agoPrepare source-tree for base-4.13 MFP bump
Herbert Valerio Riedel [Tue, 18 Dec 2018 22:36:29 +0000 (23:36 +0100)] 
Prepare source-tree for base-4.13 MFP bump

10 months agoFix typo in DsExpr
Matthew Pickering [Fri, 18 Jan 2019 13:35:08 +0000 (08:35 -0500)] 
Fix typo in DsExpr

10 months agoComments in stranal test declarations
Ömer Sinan Ağacan [Fri, 18 Jan 2019 08:51:59 +0000 (11:51 +0300)] 
Comments in stranal test declarations

10 months agoSmall refactor
Simon Peyton Jones [Thu, 10 Jan 2019 12:08:47 +0000 (12:08 +0000)] 
Small refactor use the same error message rather than duplicating it

10 months agoRemove export of checkValidFamPats, never used
Simon Peyton Jones [Thu, 10 Jan 2019 12:08:15 +0000 (12:08 +0000)] 
Remove export of checkValidFamPats, never used

10 months agoComments about data constructor wrappers
Simon Peyton Jones [Thu, 10 Jan 2019 12:07:57 +0000 (12:07 +0000)] 
Comments about data constructor wrappers

10 months ago'DynFlag'-free version of 'mkParserFlags'
Alec Theriault [Tue, 8 Jan 2019 20:07:07 +0000 (12:07 -0800)] 
'DynFlag'-free version of 'mkParserFlags'

This is a fixed version of the reverted d2fbc33c4ff3074126ab71654af8bbf8a46e4e11
and  5aa29231ab7603537284eff5e4caff3a73dba6d2.

Obtaining a `DynFlags` is difficult, making using the lexer/parser
for pure parsing/lexing unreasonably difficult, even with `mkPStatePure`.
This is despite the fact that we only really need

    * language extension flags
    * warning flags
    * a handful of boolean options

The new `mkParserFlags'` function makes is easier to directly construct a
`ParserFlags`. Furthermore, since `pExtsBitmap` is just a footgun, I've gone
ahead and made `ParserFlags` an abstract type.

Also, we now export `ExtBits` and `getBit` instead of defining/exporting a
bunch of boilerplate functions that test for a particular 'ExtBits'.
In the process, I also

  * cleaned up an unneeded special case for `ITstatic`
  * made `UsePosPrags` another variant of `ExtBits`
  * made the logic in `reservedSymsFM` match that of `reservedWordsFM`

Test Plan: make test

Reviewers: bgamari, alanz, tdammers

Subscribers: sjakobi, tdammers, rwbarton, mpickering, carter

GHC Trac Issues: #11301

Differential Revision:

10 months agoPPC NCG: Rename constructors
Peter Trommler [Thu, 3 Jan 2019 13:04:37 +0000 (14:04 +0100)] 
PPC NCG: Rename constructors

Rename constructors in calling convention data type to reflect the
fact that they represent an ELF ABI not only a Linux ABI.

10 months agoFix tab and improve whitespace
Peter Trommler [Sat, 29 Dec 2018 10:29:02 +0000 (11:29 +0100)] 
Fix tab and improve whitespace

10 months agoPPC NCG: Register definitions for all 64-bit systems
Peter Trommler [Sat, 29 Dec 2018 09:14:12 +0000 (10:14 +0100)] 
PPC NCG: Register definitions for all 64-bit systems

10 months agoPPC NCG: GOT declaration for all 64-bit ELF systems
Peter Trommler [Sat, 29 Dec 2018 09:12:48 +0000 (10:12 +0100)] 
PPC NCG: GOT declaration for all 64-bit ELF systems

10 months agoPPC NCG: Make `stackHeaderSize` more general
Peter Trommler [Fri, 28 Dec 2018 22:55:35 +0000 (23:55 +0100)] 
PPC NCG: Make `stackHeaderSize` more general

10 months agoPPC NCG: Make calling convention more general
Peter Trommler [Fri, 28 Dec 2018 22:52:31 +0000 (23:52 +0100)] 
PPC NCG: Make calling convention more general

All operating systems except AIX and Darwin follow the ELF

10 months agoRTS: Use ELF v1 convention on all powerpc64 systems
Peter Trommler [Fri, 28 Dec 2018 21:30:34 +0000 (22:30 +0100)] 
RTS: Use ELF v1 convention on all powerpc64 systems

10 months agoAdd test for #16197
Ömer Sinan Ağacan [Thu, 17 Jan 2019 13:57:20 +0000 (16:57 +0300)] 
Add test for #16197

10 months agoDocumentation for StgRetFun
Ömer Sinan Ağacan [Wed, 16 Jan 2019 06:47:35 +0000 (09:47 +0300)] 
Documentation for StgRetFun

10 months agoMake sure 'haddock' package also copies resources
Alec Theriault [Thu, 10 Jan 2019 12:37:36 +0000 (04:37 -0800)] 
Make sure 'haddock' package also copies resources

...and does so in the lib folder of the right stage

10 months agoHadrian: handle Haddock's resource directory
Alec Theriault [Thu, 10 Jan 2019 11:45:06 +0000 (03:45 -0800)] 
Hadrian: handle Haddock's resource directory

Fixes #16105

  * Require Haddock's resource as runtime dependencies of the Haddock
    builder. This means we no longer have to `need` particular resources
    in every other documentation rule.

  * Do a _tracked_ copy of both the 'html' and 'latex' folder resource

  * Move resources into `stage1/lib` (NB: the `haddock` binary goes in
    `stage1/bin`). Besides now actually matching the Haddock script
    wrapper generated by BinaryDist, this also prepares for Haddock
    in relocatable build folder detecting its own resources.

10 months agoImprove clarity of documentation for maybeToList
Steve Hart [Thu, 10 Jan 2019 13:30:47 +0000 (08:30 -0500)] 
Improve clarity of documentation for maybeToList

10 months agoRevert "Fix typo in maybeToList documentation"
Steve Hart [Thu, 10 Jan 2019 13:29:29 +0000 (08:29 -0500)] 
Revert "Fix typo in maybeToList documentation"

This reverts commit af210f40ce7ad7b3351abc988b0351446e8b639e

10 months agoFix typo in maybeToList documentation
Steve Hart [Thu, 10 Jan 2019 03:21:38 +0000 (22:21 -0500)] 
Fix typo in maybeToList documentation

10 months agoHadrian: Use the Cabal build script on Windows by default
Andrey Mokhov [Thu, 10 Jan 2019 00:18:24 +0000 (00:18 +0000)] 
Hadrian: Use the Cabal build script on Windows by default

The Stack build script `build.stack.bat` currently fails on Windows
when invoked with the `--configure` flag, see:

The Cabal build script `build.cabal.bat` works reliably on my Windows
machine, so I am proposing to switch to it by default, that is, to run
it from the default `build.bat` script.

The Stack build script can still be run directly if need be.

10 months agoDisable Shake Lint by default.
Andrey Mokhov [Thu, 10 Jan 2019 22:35:22 +0000 (22:35 +0000)] 
Disable Shake Lint by default.

10 months agoSwitch to the untracked version of getDirectoryFiles when scanning for GMP objects
Andrey Mokhov [Wed, 9 Jan 2019 21:34:03 +0000 (21:34 +0000)] 
Switch to the untracked version of getDirectoryFiles when scanning for GMP objects


This is work in progress: this commit does the right thing, but does not
yet fix the ticket.

10 months agotypo
Alp Mestanogullari [Wed, 9 Jan 2019 21:40:25 +0000 (22:40 +0100)] 

10 months agocrosslink hadrian/ and hadrian/doc/
Alp Mestanogullari [Wed, 9 Jan 2019 11:51:50 +0000 (12:51 +0100)] 
crosslink hadrian/ and hadrian/doc/

10 months agodoc: behaviour of +RTS -h depends on profiling
Ben Price [Tue, 15 Jan 2019 12:38:44 +0000 (12:38 +0000)] 
doc: behaviour of +RTS -h depends on profiling

The rts option `-h` behaves as `-hT` when compiled without profiling,
and `-hc` when compiled with profiling. Add a note to the user's guide
highlighting this inconsistency.

10 months agodoc: reorder heap profiling information in +RTS -?
Ben Price [Mon, 14 Jan 2019 18:26:45 +0000 (18:26 +0000)] 
doc: reorder heap profiling information in +RTS -?

10 months agorts: Allow heap prof by closure type in prof way
Ben Price [Tue, 8 Jan 2019 22:16:10 +0000 (22:16 +0000)] 
rts: Allow heap prof by closure type in prof way

Complete b7b6617a90824303daf555c817f538cd9c792671 (see ticket #15086) to
actually enable profiling by closure type in the profiling rts. I.e.
+RTS -p -hT is now accepted.

10 months agotry to fix CI
Alec Theriault [Wed, 9 Jan 2019 00:29:32 +0000 (16:29 -0800)] 
try to fix CI

10 months agoFix tests for `integer-simple`
Alec Theriault [Tue, 8 Jan 2019 18:50:30 +0000 (10:50 -0800)] 
Fix tests for `integer-simple`

A bunch of tests for `integer-simple` were now broken for a foolish reason:
unlike the `integer-gmp` case, there is no CorePrep optimization for turning
small integers directly into applications of `S#`.

Rather than port this optimization to `integer-simple` (which would involve
moving a bunch of `integer-simple` names into `PrelNames`), I switched
as many tests as possible to use `Int`.

The printing of `Integer` is already tested in `print037`.

10 months agoRemove from `base` obsolete CPP for `integer-gmp`
Alec Theriault [Tue, 8 Jan 2019 18:41:50 +0000 (10:41 -0800)] 
Remove from `base` obsolete CPP for `integer-gmp`

  * `GHC.Natural` now exports the same functions (regardless of integer backend)
  * remove unnecessary CPP around instances
  * remove the 'OPTIMISE_INTEGER_GCD_LCM' flag - almost all of those optimizations
    now work regardless of which integer backend is used

Note that some CPP still remains for situations where there are backend-specific
optimization hacks (like a more efficient GMP-only `gcd` for `Int#` and `Word#`).

10 months agoMatch `integer-simple`'s API with `integer-gmp`
Alec Theriault [Tue, 8 Jan 2019 18:35:55 +0000 (10:35 -0800)] 
Match `integer-simple`'s API with `integer-gmp`

In `integer-simple`:

  * Added an efficient `popCountInteger` and `bitInteger`
  * Added an efficient `gcdInteger` and `lcmInteger`
  * Made `testBitInteger` more efficient

10 months agoSupport printing `integer-simple` Integers in GHCi
Alec Theriault [Tue, 8 Jan 2019 18:28:10 +0000 (10:28 -0800)] 
Support printing `integer-simple` Integers in GHCi

This means that `:p` no longer leaks the implementation details of
`Integer` with `integer-simple`. The `print037` test case should
exercise all possible code paths for GHCi's code around printing
`Integer`s (both in `integer-simple` and `integer-gmp`).

`ghc` the package now also has a Cabal `integer-simple` flag (like the
`integer-gmp` one).

10 months agoCreate folder if missing for .hie files
Alec Theriault [Tue, 8 Jan 2019 14:31:32 +0000 (06:31 -0800)] 
Create folder if missing for .hie files

This matches the existing behaviour for .hi files: if the user requests
the interface file be written in some location, we should create the
parent folder if it doesn't already exist.

Reviewers: bgamari, sjakobi

Reviewed By: sjakobi

Subscribers: sjakobi, rwbarton, carter

Differential Revision:

10 months agoHadrian: support extra libraries + OSX rpath
Alec Theriault [Mon, 7 Jan 2019 19:38:11 +0000 (11:38 -0800)] 
Hadrian: support extra libraries + OSX rpath

This fixes some of the issues that surfaced when trying to build
dynamic GHC on OSX. Unfortunately, due some other `libffi`
issues, this doesn't completely fix dynamic builds on OSX.

  - Use 'extra-libraries' from .cabal files instead of hardcoding
    which packages need which extra libs. Also add support for

  - Make sure Hadrian looks in the right places to support both
    plain '<pkg>.buildinfo' and '<pkg>' files.

  - Make the '-rpath' support more robust across OS's (it previously
    didn't work on OSX and possibly windows either).

Reviewers: angerman, alpmestan, adamse, DavidEichmann, bgamari, Phyx

Subscribers: rwbarton, carter

GHC Trac Issues: #15990

Differential Revision:

10 months agoIntroduce ghci command wrapper
Zejun Wu [Sat, 29 Dec 2018 20:28:47 +0000 (12:28 -0800)] 
Introduce ghci command wrapper

Introduce ghci command wrapper, which can be used to cutomize ghci:
* process additionals actions before/after the command
* handle particular exceptions in given ways
* logging stats

We also split the timing and printing part of `timeIt` into different

10 months agoFix filename in comment again
Peter Trommler [Sun, 30 Dec 2018 21:31:38 +0000 (22:31 +0100)] 
Fix filename in comment again

10 months agoFix reference to stack code in comment
Peter Trommler [Sun, 30 Dec 2018 21:28:45 +0000 (22:28 +0100)] 
Fix reference to stack code in comment

10 months agoPPC NCG: Refactor stack allocation code
Peter Trommler [Mon, 17 Dec 2018 12:27:49 +0000 (13:27 +0100)] 
PPC NCG: Refactor stack allocation code

There is only one place where UPDATE_SP was used. Instead of the
UPDATE_SP pseudo instruction build the list of instructions directly.

10 months agoHadrian: configure packages with right 'htmldir'
Alec Theriault [Thu, 27 Dec 2018 21:07:51 +0000 (13:07 -0800)] 
Hadrian: configure packages with right 'htmldir'

This means that we can query the package DB for haddock interfaces.
Haddock uses this in its testsuite. 'cabal {v1-,v2,}-haddock' also
uses this.

Also thread through to Haddock package-specific overrides of GHC

10 months agoChange comments as requested by code review. #10857
Roland Senn [Thu, 27 Dec 2018 14:14:31 +0000 (15:14 +0100)] 
Change comments as requested by code review. #10857

10 months agoGHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857
Roland Senn [Mon, 24 Dec 2018 13:14:25 +0000 (14:14 +0100)] 
GHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857

10 months agohWaitForInput-accurate-socket test
Tom Sydney Kerckhove [Fri, 21 Dec 2018 10:41:13 +0000 (12:41 +0200)] 
hWaitForInput-accurate-socket test

10 months ago@simonpj's suggested refactor
Ryan Scott [Tue, 15 Jan 2019 01:28:59 +0000 (20:28 -0500)] 
@simonpj's suggested refactor

10 months agoBump Cabal submodule
Ryan Scott [Mon, 14 Jan 2019 15:41:26 +0000 (10:41 -0500)] 
Bump Cabal submodule

10 months agoControl validity-checking of type synonym applications more carefully
Ryan Scott [Thu, 10 Jan 2019 21:55:51 +0000 (16:55 -0500)] 
Control validity-checking of type synonym applications more carefully

Trac #16059 shows that when validity checking applications of type
synonyms, GHC sometimes wasn't checking the expanded type enough.
We must be careful, however, since checking both the expanded type as
well as the arguments to the type synonym can lead to exponential
blowup (see
Nor can we omit checking either the expanded type or the argument for
correctness reasons.

The solution here is to introduce a new `ExpandMode` data type that
is plumbed through all of the type-validity-checking functions in
`TcValidity`. `ExpandMode` dictates whether we only check the
expanded type (`Expand`), only check the arguments (`NoExpand), or
both (`Both`). Importantly, if we check `Both` in the function for
validity checking type synonym applications, then we switch to
`NoExpand` when checking the arguments so as to avoid exponential
blowup. See `Note [Correctness and performance of type synonym validity
checking]` for the full story.

10 months agoFix #16116 by removing badAssocRhs
Ryan Scott [Tue, 15 Jan 2019 21:02:07 +0000 (16:02 -0500)] 
Fix #16116 by removing badAssocRhs

10 months agoFix #16114 by adding a validity check to rnClsInstDecl
Ryan Scott [Tue, 15 Jan 2019 13:08:43 +0000 (08:08 -0500)] 
Fix #16114 by adding a validity check to rnClsInstDecl

10 months agogitlab-ci: Cleanup Windows builds
Ben Gamari [Sun, 6 Jan 2019 04:28:49 +0000 (23:28 -0500)] 
gitlab-ci: Cleanup Windows builds

See Note [Cleanup on Windows].

10 months agoDocument the Shake Lint feature.
Andrey Mokhov [Thu, 10 Jan 2019 23:27:07 +0000 (23:27 +0000)] 
Document the Shake Lint feature.

10 months agoClarify when to follow the instructions in doc/
Andrey Mokhov [Thu, 10 Jan 2019 23:18:47 +0000 (23:18 +0000)] 
Clarify when to follow the instructions in doc/


10 months agoHadrian: Update
Andrey Mokhov [Thu, 10 Jan 2019 02:13:46 +0000 (02:13 +0000)] 
Hadrian: Update

* Update or remove a few outdated paragraphs
* Use consistent naming (e.g. "Stage1" instead of occasionally "stage1")
* Rewrite acknowledgements
* Some more minor revisions

10 months agotestsuite: Show both test name and way in JUnit output
Ben Gamari [Thu, 10 Jan 2019 16:45:32 +0000 (11:45 -0500)] 
testsuite: Show both test name and way in JUnit output

10 months agoUpdate `Cabal` submodule
Herbert Valerio Riedel [Sun, 6 Jan 2019 23:59:23 +0000 (00:59 +0100)] 
Update `Cabal` submodule

This also requires adapting `ghc-pkg` to use the new Cabal parsing API
as the old ReadP-based one has finally been evicted for good.

Hadrian bit finished by: Ben Gamari <>

10 months agorts: Use always-available locking operations in pthread Itimer implementation
Ben Gamari [Wed, 9 Jan 2019 14:17:05 +0000 (09:17 -0500)] 
rts: Use always-available locking operations in pthread Itimer implementation

Previously we ACQUIRE_LOCK and RELEASE_LOCK but these compile to a noop in the
non-threaded RTS, as noted in #16150. Use OS_ACQUIRE_LOCK and OS_RELEASE_LOCK

10 months agoitimer: Don't free condvar until we know ticker is stopped
Ben Gamari [Wed, 9 Jan 2019 05:20:19 +0000 (00:20 -0500)] 
itimer: Don't free condvar until we know ticker is stopped

When we are shutting down the pthread ticker we signal the start_cond condition
variable to ensure that the ticker thread wakes up and exits in a reasonable
amount of time. Previously, when the ticker thread would shut down it was
responsible for freeing the start_cond condition variable. However, this would
lead to a race wherein the ticker would free start_cond, then the main thread
would try to signal it in an effort to wake the ticker (#16150).

Avoid this by moving the mutex destruction to the main thread.

10 months agoPPC NCG: Reduce memory consumption emitting string literals
Peter Trommler [Sun, 13 Jan 2019 21:36:07 +0000 (16:36 -0500)] 
PPC NCG: Reduce memory consumption emitting string literals

10 months agoRefactor GHCi UI to fix #11606, #12091, #15721, #16096
Ömer Sinan Ağacan [Wed, 9 Jan 2019 15:44:48 +0000 (18:44 +0300)] 
Refactor GHCi UI to fix #11606, #12091, #15721, #16096

Instead of parsing and executing a statement or declaration directly we
now parse them first and then execute in a separate step. This gives us
the flexibility to inspect the parsed declaration before execution.
Using this we now inspect parsed declarations, and if it's a single
declaration of form `x = y` we execute it as `let x = y` instead, fixing
a ton of problems caused by poor declaration support in GHCi.

To avoid any users of the modules I left `execStmt` and `runDecls`
unchanged and added `execStmt'` and `runDecls'` which work on parsed

10 months agoFix checkPtrInArena
Ömer Sinan Ağacan [Sat, 12 Jan 2019 13:08:24 +0000 (16:08 +0300)] 
Fix checkPtrInArena

(See comments)

10 months agoDon't invoke dataConSrcToImplBang on newtypes
Ryan Scott [Sun, 13 Jan 2019 00:05:46 +0000 (19:05 -0500)] 
Don't invoke dataConSrcToImplBang on newtypes

11 months agoFix negative mutator time in GC stats in prof builds
Ömer Sinan Ağacan [Fri, 28 Dec 2018 10:51:28 +0000 (13:51 +0300)] 
Fix negative mutator time in GC stats in prof builds

Because garbage collector calls `retainerProfile()` and `heapCensus()`,
GC times normally include some of PROF times too. To fix this we have
these lines:

    // heapCensus() is called by the GC, so RP and HC time are
    // included in the GC stats.  We therefore subtract them to
    // obtain the actual GC cpu time.
    stats.gc_cpu_ns      -=  prof_cpu;
    stats.gc_elapsed_ns  -=  prof_elapsed;

These variables are later used for calculating GC time excluding the
final GC (which should be attributed to EXIT).

    exit_gc_elapsed      = stats.gc_elapsed_ns - start_exit_gc_elapsed;

The problem is if we subtract PROF times from `gc_elapsed_ns` and then
subtract `start_exit_gc_elapsed` from the result, we end up subtracting
PROF times twice, because `start_exit_gc_elapsed` also includes PROF

We now subtract PROF times from GC after the calculations for EXIT and
MUT times. The existing assertion that checks


now holds. When we subtract PROF numbers from GC, and a new assertion


also holds.

Fixes #15897. New assertions added in this commit also revealed #16102,
which is also fixed by this commit.

11 months agoFix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime
Ömer Sinan Ağacan [Thu, 10 Jan 2019 08:55:25 +0000 (11:55 +0300)] 
Fix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime

UNDERFLOW_FRAMEs don't have profiling headers so we have to use the
AP_STACK's function's CCS as the new frame's CCS.

Fixes one of the many bugs caught by concprog001 (#15508).

11 months agoDocumentation and refactoring in CCS related code
Ömer Sinan Ağacan [Thu, 10 Jan 2019 11:39:16 +0000 (14:39 +0300)] 
Documentation and refactoring in CCS related code

- Remove REGISTER_CC and REGISTER_CCS macros, add functions registerCC
  and registerCCS to Profiling.c.

- Reduce scope of symbols: CC_LIST, CCS_LIST, CC_ID, CCS_ID

- Document CC_LIST and CCS_LIST

11 months agoMore minor comment improvements
Richard Eisenberg [Fri, 11 Jan 2019 21:42:06 +0000 (16:42 -0500)] 
More minor comment improvements

[skip ci]

11 months agoRun typed splices in the zonker
Matthew Pickering [Wed, 9 Jan 2019 14:52:30 +0000 (14:52 +0000)] 
Run typed splices in the zonker

This fixes #15471

In the typechecker we check that the splice has the right type but we
crucially don't zonk the generated expression. This is because we might
end up unifying type variables from outer scopes later on.

Reviewers: simonpj, goldfire, bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15471

Differential Revision: