ghc.git
20 months agobase: Rip out old RTS statistics interface
Ben Gamari [Mon, 27 Nov 2017 19:02:56 +0000 (14:02 -0500)] 
base: Rip out old RTS statistics interface

Test Plan: Validate

Reviewers: simonmar, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #14516

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

20 months agorelnotes: Rework treatment of included package list
Ben Gamari [Mon, 27 Nov 2017 19:01:02 +0000 (14:01 -0500)] 
relnotes: Rework treatment of included package list

Previously the included package lists took a disproportionate amount of
space in the resulting document and were difficult to maintain. Turn it
into a table.

Subscribers: rwbarton, thomie

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

20 months agoDon't call alex for Cabal lib during GHC build
Tobias Dammers [Mon, 27 Nov 2017 19:00:50 +0000 (14:00 -0500)] 
Don't call alex for Cabal lib during GHC build

The Cabal library now commits `Lexer.hs` directly to the source tree,
so the build step where we'd call alex ourselves to generate that file
is no longer necessary, nor will it work.

See also: https://ghc.haskell.org/trac/ghc/ticket/14459

Reviewers: bgamari, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14459

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

20 months agotypecheck: Consistently use pretty quotes in error messages
Ben Gamari [Mon, 27 Nov 2017 19:00:06 +0000 (14:00 -0500)] 
typecheck: Consistently use pretty quotes in error messages

Subscribers: rwbarton, thomie, carter

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

20 months agoCheck quantification for partial type signatues
Simon Peyton Jones [Tue, 14 Nov 2017 15:26:19 +0000 (15:26 +0000)] 
Check quantification for partial type signatues

Trac #14449 showed that we were failing to check that the
quantified type variables of a partial type signature remained
distinct.

See Note [Quantified variables in partial type signatures]
in TcBinds.

A little refactoring along the way.

20 months agoboot: Eliminate superfluous output
Ben Gamari [Mon, 27 Nov 2017 15:20:59 +0000 (10:20 -0500)] 
boot: Eliminate superfluous output

20 months agoRtsFlags: allow +RTS -K0
Ben Gamari [Mon, 27 Nov 2017 14:46:55 +0000 (09:46 -0500)] 
RtsFlags: allow +RTS -K0

Reviewers: erikd, simonmar, hvr

Reviewed By: hvr

Subscribers: hvr, rwbarton, thomie

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

20 months agoAdd obvious Outputable Integer instance.
klebinger.andreas@gmx.at [Mon, 27 Nov 2017 14:46:32 +0000 (09:46 -0500)] 
Add obvious Outputable Integer instance.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoFollow symlinks in the Win32 code for System.Environment.getExecutablePath
Alp Mestanogullari [Mon, 27 Nov 2017 14:45:52 +0000 (09:45 -0500)] 
Follow symlinks in the Win32 code for System.Environment.getExecutablePath

This partially addresses #14483 by fixing the Windows implementation of
System.Environment.getExecutablePath. This is achieved by using
GetFinalPathNameByHandleW to resolve potential symlinks, while making
sure we do not get back a UNC path (see #14460).

Test Plan: Validate

Reviewers: Phyx, bgamari, angerman, hvr, goldfire

Reviewed By: Phyx, bgamari

GHC Trac Issues: #14483

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

20 months agoDon't complain about UNPACK in -fno-code.
Edward Z. Yang [Mon, 27 Nov 2017 14:45:23 +0000 (09:45 -0500)] 
Don't complain about UNPACK in -fno-code.

Test Plan: validate

Reviewers: ekmett, austin, bgamari

Reviewed By: bgamari

Subscribers: duog, goldfire, rwbarton, thomie

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

20 months agoCircleCI: Reenable artifact collection on Darwin
Ben Gamari [Thu, 23 Nov 2017 20:03:18 +0000 (15:03 -0500)] 
CircleCI: Reenable artifact collection on Darwin

Supposedly the original issue has been fixed.

20 months agobase: fdReady(): Fix timeouts > ~49 days overflowing. Fixes #14262.
Niklas Hambüchen [Thu, 23 Nov 2017 18:17:24 +0000 (13:17 -0500)] 
base: fdReady(): Fix timeouts > ~49 days overflowing. Fixes #14262.

On 64-bit UNIX and Windows, Haskell `Int` has 64 bits
but C `int msecs` has 32 bits, resulting in an overflow.

This commit fixes it by switching fdReady() to take int64_t,
into which a Haskell `Int` will always fit.

(Note we could not switch to `long long` because that is
32 bit on 64-bit Windows machines.)

Further, to be able to actually wait longer than ~49 days,
we put loops around the waiting syscalls (they all accept only
32-bit integers).

Note the timer signal would typically interrupt the syscalls
before the ~49 days are over, but you can run Haskell programs
without the timer signal, an we want it to be correct in all
cases.

Reviewers: bgamari, austin, hvr, NicolasT, Phyx

Reviewed By: bgamari, Phyx

Subscribers: syd, Phyx, rwbarton, thomie

GHC Trac Issues: #14262

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

20 months agousers-guide: Fix :default: placement
Ben Gamari [Thu, 23 Nov 2017 18:14:33 +0000 (13:14 -0500)] 
users-guide: Fix :default: placement

20 months agoDynFlags: Expand $topdir in --info output
Ben Gamari [Thu, 23 Nov 2017 18:05:30 +0000 (13:05 -0500)] 
DynFlags: Expand $topdir in --info output

Test Plan: Try running nofib on Windows

Reviewers: Phyx

Subscribers: rwbarton, thomie

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

20 months agoSysTools: Split up TopDir logic into new module
Ben Gamari [Thu, 23 Nov 2017 18:05:05 +0000 (13:05 -0500)] 
SysTools: Split up TopDir logic into new module

Test Plan: Validate on Linux and Windows

Reviewers: erikd

Subscribers: rwbarton, thomie

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

20 months agoSysTools: Expand occurrences of $topdir anywhere in a Settings path
Ben Gamari [Thu, 23 Nov 2017 18:04:55 +0000 (13:04 -0500)] 
SysTools: Expand occurrences of $topdir anywhere in a Settings path

Subscribers: rwbarton, thomie, Phyx

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

20 months agorts/Printer: add closure name entries for small arrays (Fixes #14513)
Takano Akio [Thu, 23 Nov 2017 17:17:24 +0000 (12:17 -0500)] 
rts/Printer: add closure name entries for small arrays (Fixes #14513)

Test Plan: ./validate

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14513

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

20 months agoCircleCI: Install lbzip2 and patch
Ben Gamari [Wed, 22 Nov 2017 17:07:29 +0000 (12:07 -0500)] 
CircleCI: Install lbzip2 and patch

tar needs lbzip2 to extract the GMP tarball. Patch is needed to, well, patch.

20 months agocircleci: Build with Hadrian
Ben Gamari [Sat, 18 Nov 2017 19:50:24 +0000 (14:50 -0500)] 
circleci: Build with Hadrian

20 months agoCircleCI: Try validating LLVM as well
Ben Gamari [Sun, 12 Nov 2017 00:04:42 +0000 (19:04 -0500)] 
CircleCI: Try validating LLVM as well

20 months agoCircleCI: Perform nightly validation of unregisterised build
Ben Gamari [Sat, 11 Nov 2017 23:53:56 +0000 (18:53 -0500)] 
CircleCI: Perform nightly validation of unregisterised build

20 months agoFix README
Ben Gamari [Thu, 23 Nov 2017 14:53:30 +0000 (09:53 -0500)] 
Fix README

This was unfortunately overwritten by the Hadrian README in a previous
Hadrian merge.

20 months agoRevert "Add new mbmi and mbmi2 compiler flags"
Ben Gamari [Wed, 22 Nov 2017 19:27:55 +0000 (14:27 -0500)] 
Revert "Add new mbmi and mbmi2 compiler flags"

This broke the 32-bit build.

This reverts commit f5dc8ccc29429d0a1d011f62b6b430f6ae50290c.

20 months agoUpdate Hadrian
Ben Gamari [Wed, 22 Nov 2017 13:50:45 +0000 (08:50 -0500)] 
Update Hadrian

20 months agoSquashed 'hadrian/' changes from fa3771fe6b..4499b294e4
Ben Gamari [Wed, 22 Nov 2017 13:47:55 +0000 (08:47 -0500)] 
Squashed 'hadrian/' changes from fa3771fe6b..4499b294e4

4499b294e4 Follow GHC changes
8fd68186b2 Add ways to build hadrian using nix
e5c7a29c23 Do not depend on the in-tree filepath library
9dd7ad2acc Fix dependencies
497184390e Bring mtl dependency back
6c5f5c9bd9 Minor clean up of Hadrian dependencies
9aff81d424 Fix Windows build
fa95caa8df Unbreak `cabal new-build`

git-subtree-dir: hadrian
git-subtree-split: 4499b294e4a53f71f8808d6eb55a7dd0b341cfb8

20 months agoErrUtils: Ensure timing dumps are always output on one line
Ben Gamari [Wed, 22 Nov 2017 03:59:28 +0000 (22:59 -0500)] 
ErrUtils: Ensure timing dumps are always output on one line

This output is supposed to be machine-readable; having random line-breaks
defeats this.

20 months agoErrUtils: Refactor dump file logic
Ben Gamari [Wed, 22 Nov 2017 03:57:27 +0000 (22:57 -0500)] 
ErrUtils: Refactor dump file logic

This refactors the dump file setup path, separating concerns a bit. It also
fixes an exception-unsafe usage of openFile.

20 months agoBump stm submodule
Ben Gamari [Wed, 22 Nov 2017 04:00:13 +0000 (23:00 -0500)] 
Bump stm submodule

20 months agobase: Remove redundant subtraction in (^) and stimes
Ben Gamari [Wed, 22 Nov 2017 02:15:29 +0000 (21:15 -0500)] 
base: Remove redundant subtraction in (^) and stimes

Subtraction `y - 1` is redundant. The value of y is guaranteed to be
positive and odd, so
```
(y - 1) `quot` 2` = `y `quot` 2
```

Test Plan: validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14439

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

20 months agocmm: Optimise remainders by powers of two
Ben Gamari [Wed, 22 Nov 2017 02:14:31 +0000 (21:14 -0500)] 
cmm: Optimise remainders by powers of two

Test Plan: validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14437

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

20 months agotestsuite: Add test for #14257
Ben Gamari [Tue, 21 Nov 2017 23:30:17 +0000 (18:30 -0500)] 
testsuite: Add test for #14257

Subscribers: rwbarton, thomie, duog

GHC Trac Issues: #14257

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

20 months agoTest Trac #14488
Vladislav Zavialov [Tue, 21 Nov 2017 23:28:21 +0000 (18:28 -0500)] 
Test Trac #14488

Summary:
The refactoring in 3f5673f34a2f761423027bf46f64f7499708725f also fixed a
previously unreported issue in the typechecker that prevented defining a
lens to a record field with a constraint. This patch adds a regression
test.

Test Plan: make test TEST=14488

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: int-e, rwbarton, thomie

GHC Trac Issues: #14488

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

20 months agoRemove hadrian sub-dir from .gitignore
Matthew Pickering [Tue, 21 Nov 2017 23:26:16 +0000 (18:26 -0500)] 
Remove hadrian sub-dir from .gitignore

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoUpdate leftover reference to refer to [FunBind vs PatBind]
klebinger.andreas@gmx.at [Tue, 21 Nov 2017 23:25:57 +0000 (18:25 -0500)] 
Update leftover reference to refer to [FunBind vs PatBind]

Reviewers: bgamari, mpickering

Reviewed By: mpickering

Subscribers: rwbarton, thomie, mpickering

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

20 months agoAdd warn-missing-export-lists
Evan Rutledge Borden [Tue, 21 Nov 2017 23:06:01 +0000 (18:06 -0500)] 
Add warn-missing-export-lists

Many industrial users have aligned around the idea that implicit exports
are an anti-pattern. They lead to namespace pollution and byzantine
naming schemes. They also prevent GHC's dead code analysis and create
more obstacles to optimization. This warning allows teams/projects to
warn on or enforce via -Werror explicit export lists.

This warning also serves as a complement to warn-missing-import-lists.

This was originally discussed here:
https://github.com/ghc-proposals/ghc-proposals/pull/93

Test Plan: Three new minimal tests have been added to the type checker.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agorts: Fix inconsistencies in how retainer and heap censuses are timed.
Douglas Wilson [Tue, 21 Nov 2017 23:05:22 +0000 (18:05 -0500)] 
rts: Fix inconsistencies in how retainer and heap censuses are timed.

mut_elapsed should deduct retainer profiling and heap censuses, just as
mut_cpu does.

mutator_cpu_ns should not deduct retainer profiling or heap censuses,
since those times are included in stats.gc_cpu_ns.

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

20 months agorts: Move libdwPrintBacktrace to public interface
Ben Gamari [Tue, 21 Nov 2017 23:04:34 +0000 (18:04 -0500)] 
rts: Move libdwPrintBacktrace to public interface

Reviewers: erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

20 months agoUpdate ANNOUNCE
Ben Gamari [Tue, 21 Nov 2017 22:23:49 +0000 (17:23 -0500)] 
Update ANNOUNCE

20 months agoCircleCI: Add webhook for Harbormaster builds
Ben Gamari [Wed, 22 Nov 2017 00:20:49 +0000 (19:20 -0500)] 
CircleCI: Add webhook for Harbormaster builds

20 months agoRevert "trees that grow" work
Ben Gamari [Tue, 21 Nov 2017 19:28:58 +0000 (14:28 -0500)] 
Revert "trees that grow" work

As documented in #14490, the Data instances currently blow up
compilation time by too much to stomach. Alan will continue working on
this in a branch and we will perhaps merge to 8.2 before 8.2.1 to avoid
having to perform painful cherry-picks in 8.2 minor releases.

Reverts haddock submodule.

This reverts commit 47ad6578ea460999b53eb4293c3a3b3017a56d65.
This reverts commit e3ec2e7ae94524ebd111963faf34b84d942265b4.
This reverts commit 438dd1cbba13d35f3452b4dcef3f94ce9a216905.
This reverts commit 0ff152c9e633accca48815e26e59d1af1fe44ceb.

20 months agobase: Document GHC.Stack.CCS internals
Ben Gamari [Tue, 21 Nov 2017 19:27:51 +0000 (14:27 -0500)] 
base: Document GHC.Stack.CCS internals

Reviewers: hvr

Subscribers: rwbarton, thomie

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

20 months agoconfigure: Fix ar probed flags
Ben Gamari [Tue, 21 Nov 2017 19:27:11 +0000 (14:27 -0500)] 
configure: Fix ar probed flags

FP_PROG_AR_ARGS appears to be probing for what flags to use to build an
archive with an index. However, none of the flags that it probed
previously were valid as they all started with `c`, which isn't a mode
character. This went unnoticed until someone attempted to use LLVM ar
since we have a special case for gnu ar.

Additionally, we work around a bug in llvm-ar 5.0 where ar will exit
with code 0 even if it fails to parse the command line. Silliness.

I believe these should rather all be mode `q` however I'll need to test
this on a few platforms to be certain.

Test Plan: Validate on OS X, BSD, and Linux with binutils and llvm ar

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd

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

20 months agoCircleCI: Disable artifact collection on OS X
Ben Gamari [Tue, 21 Nov 2017 19:22:22 +0000 (14:22 -0500)] 
CircleCI: Disable artifact collection on OS X

The storeartifacts step inexplicably hangs on OS X. I am currently be working
with CircleCI support to resolve this.

21 months agorel-notes: Fix up formatting in release notes
Ben Gamari [Mon, 20 Nov 2017 22:14:03 +0000 (17:14 -0500)] 
rel-notes: Fix up formatting in release notes

21 months agoghc-pkg: Add missing newlines to usage message
Ben Gamari [Mon, 20 Nov 2017 22:13:16 +0000 (17:13 -0500)] 
ghc-pkg: Add missing newlines to usage message

21 months agoBump haddock submodule
Ben Gamari [Mon, 20 Nov 2017 13:12:15 +0000 (08:12 -0500)] 
Bump haddock submodule

21 months agoBump hsc2hs submodule
Ben Gamari [Mon, 20 Nov 2017 03:13:07 +0000 (22:13 -0500)] 
Bump hsc2hs submodule

21 months agoStop generating make files when using hadrian.
Moritz Angermann [Mon, 20 Nov 2017 03:12:09 +0000 (22:12 -0500)] 
Stop generating make files when using hadrian.

The boot script generates lots of .mk files
for the make based build system. This change adds
a `--hadrian` flag to `boot`, which skips the `.mk`
file generation.

Reviewers: bgamari

Subscribers: rwbarton, thomie

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

21 months agoRename ghc-version -> ghcversion-file
Moritz Angermann [Mon, 20 Nov 2017 03:11:43 +0000 (22:11 -0500)] 
Rename ghc-version -> ghcversion-file

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoFix #elfi -> #elif; unbreak -Werror.
Moritz Angermann [Sun, 19 Nov 2017 23:46:01 +0000 (18:46 -0500)] 
Fix #elfi -> #elif; unbreak -Werror.

Reviewers: bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agobase: Make documentation of atomically more accurate
Andrew Martin [Sat, 18 Nov 2017 19:43:20 +0000 (14:43 -0500)] 
base: Make documentation of atomically more accurate

21 months agoFix T4437
Bartosz Nitka [Sat, 18 Nov 2017 14:11:38 +0000 (14:11 +0000)] 
Fix T4437

This test tests if the flags are in sync between GHC and
Cabal.
After b0b80e9 'Implement the basics of hex floating point
literals' landed, the Cabal side had to be updated. That
has been done, and 835d8dd 'GHC.Prim use virtual-modules'
brought the Cabal submodule up to date.

21 months agoFix rts.cabal.in
Moritz Angermann [Sat, 18 Nov 2017 07:05:31 +0000 (15:05 +0800)] 
Fix rts.cabal.in

Overlap with commit 2f463873, resulted in `hooks/LongGCSync.c`
missing from the `rts.cabal.in` file.  As the `rts.cabal` file is only
used by hadrian, this did not trigger with the make base build
system which can do globbing.

Also ignore the `rts.cabal` file, as it's generated by configure
from the `rts.cabal.in`.

21 months agoRelocatable GHC
Moritz Angermann [Fri, 17 Nov 2017 07:04:50 +0000 (15:04 +0800)] 
Relocatable GHC

GHC and the binary distribution that's produced is
not relocatable outside of Windows.  This diff tries to
address this for at least Linux and macOS.

Reviewers: austin, hvr, bgamari, erikd, goldfire, Phyx

Reviewed By: bgamari

Subscribers: duog, rwbarton, thomie, erikd

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

21 months agoGHC.Prim use virtual-modules
Moritz Angermann [Thu, 16 Nov 2017 14:54:11 +0000 (22:54 +0800)] 
GHC.Prim use virtual-modules

Stop the GHC.Prim madness with `virtual-module` support from cabal.
Needs https://github.com/haskell/cabal/pull/4875.

Bumps submodule libraries/Cabal to include the necessary logic for `virtual-module`.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoAdds -ghc-version flag to ghc.
Moritz Angermann [Fri, 17 Nov 2017 11:29:25 +0000 (19:29 +0800)] 
Adds -ghc-version flag to ghc.

Summary:
When building the rts with ghc (e.g. using ghc as a c compiler), ghc's
"Value Add"[1] is, it includes adding `-include /path/to/ghcversion.h`.  For
this it looksup the rts package in the package database, which--if
empty--fails.  Thus to allow compiling C files with GHC, we add the
`-ghc-version` flag, which takes the path to the `ghcversion.h` file.

A `-no-ghc-version` flag was omitted, as at that point it becomes
questionable why one would use ghc to compile c if one doesn't
any of the added value.

--

[1] from `compiler/main/DriverPipeline.hs`
>        -- add package include paths even if we're just compiling .c
>        -- files; this is the Value Add(TM) that using ghc instead of
>        -- gcc gives you :)

Reviewers: bgamari, geekosaur, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoconfigure: Fix incorrect quoting
Ben Gamari [Thu, 16 Nov 2017 20:07:33 +0000 (15:07 -0500)] 
configure: Fix incorrect quoting

This is a regression affecting Windows introduced by
3bed4aa703c41ccbd310496420fbb71afdfd99e7.

21 months agoDocument -ddump-timings
Ben Gamari [Wed, 15 Nov 2017 22:28:48 +0000 (17:28 -0500)] 
Document -ddump-timings

21 months agoDetect overly long GC sync
Simon Marlow [Wed, 11 Feb 2015 14:19:21 +0000 (14:19 +0000)] 
Detect overly long GC sync

Summary:
GC sync is the time between a GC being intiated and all the mutator
threads finally stopping so that the GC can start. Problems that cause
the GC sync to be delayed are hard to find and can cause dramatic
slowdowns for heavily parallel programs.

The new flag --long-gc-sync=<time> helps by emitting a warning and
calling a user-overridable hook when the GC sync time exceeds the
specified threshold. A debugger can be used to set a breakpoint when
this happens and inspect the stacks of threads to find the culprit.

Test Plan:
```
$ ./inplace/bin/ghc-stage2 +RTS --long-gc-sync=0.0000001 -S
    Alloc    Copied     Live     GC     GC      TOT      TOT  Page Flts
    bytes     bytes     bytes   user   elap     user     elap
  1135856     51144    153736  0.000  0.000    0.002    0.002    0    0  (Gen:  0)
  1034760     94704    188752  0.000  0.000    0.002    0.002    0    0  (Gen:  0)
  1038888    134832    228888  0.009  0.009    0.011    0.011    0    0  (Gen:  1)
  1025288     90128    235184  0.000  0.000    0.012    0.012    0    0  (Gen:  0)
  1049088    130080    333984  0.000  0.000    0.013    0.013    0    0  (Gen:  0)
Warning: waited 0us for GC sync
  1034424     73360    331976  0.000  0.000    0.013    0.013    0    0  (Gen:  0)
```

Also tested on a real production problem.

Reviewers: niteria, bgamari, erikd

Subscribers: rwbarton, thomie

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

21 months agoPull recent Hadrian changes from upstream
Andrey Mokhov [Wed, 15 Nov 2017 21:58:19 +0000 (21:58 +0000)] 
Pull recent Hadrian changes from upstream

Merge commit 'c1fcd9b3f60e8420dd228cd4e3efeb9cfa793aa5'

21 months agoSquashed 'hadrian/' changes from 5ebb69a..fa3771f
Andrey Mokhov [Wed, 15 Nov 2017 21:58:18 +0000 (21:58 +0000)] 
Squashed 'hadrian/' changes from 5ebb69a..fa3771f

fa3771f hadrian: Disable -Wno-undef in files which include ffi.h (#459)
f15e851 Do not run configure by default (#458)
5baa8db Fix AppVeyor cache failure (#456)
94dbe9d Fix ghc-cabal build (#455)
a679764 Fix CI scripts (#454)
06ec241 Widen bounds on Cabal (#452)

git-subtree-dir: hadrian
git-subtree-split: fa3771fe6baf5008a8506fec48220f8347ac59af

21 months agousers_guide: Fix "CancelSynchronousIo" casing
Niklas Hambüchen [Wed, 15 Nov 2017 16:43:04 +0000 (11:43 -0500)] 
users_guide: Fix "CancelSynchronousIo" casing

Reviewers: bgamari, angerman

Reviewed By: angerman

Subscribers: angerman, rwbarton, thomie

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

21 months agoAdjust AltCon Ord instance to match Core linter requirements.
klebinger.andreas@gmx.at [Wed, 15 Nov 2017 16:42:48 +0000 (11:42 -0500)] 
Adjust AltCon Ord instance to match Core linter requirements.

When sorting by the Ord instance put DEFAULT before other constructors.

This is in line with what the core linter requests allowing the use of
the instance for putting alternatives in the correct order.
This implements #14464.

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14464

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

21 months agoCabalify all the things
Moritz Angermann [Wed, 15 Nov 2017 16:41:34 +0000 (11:41 -0500)] 
Cabalify all the things

Adding cabal files to `unlit`, `touchy` and `hp2ps`, allows us to treat
them uniformally across the build system. In particular Hadrian will use
these.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoAllow the rts lib to be called rts-1.0
Moritz Angermann [Wed, 15 Nov 2017 16:41:15 +0000 (11:41 -0500)] 
Allow the rts lib to be called rts-1.0

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agorts: Fix gc timing
Douglas Wilson [Wed, 15 Nov 2017 16:40:54 +0000 (11:40 -0500)] 
rts: Fix gc timing

We were accumulating the gc times of the previous gc.
`stats.gc.{cpu,elappsed}_ns` were being accumulated into
`stats.gc_{cpu,elapsed}_ns` before they were set.

There is also a change in that heap profiling will no longer cause gc
events to
be emitted.

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14257, #14445

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

21 months agoAdd dump flag for timing output
Ben Gamari [Wed, 15 Nov 2017 16:40:16 +0000 (11:40 -0500)] 
Add dump flag for timing output

This allows you to use `-ddump-to-file -ddump-timings` for more useful
dump output.

Test Plan: Try it

Subscribers: rwbarton, thomie

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

21 months agoCLabels: Remove CaseLabel
Ben Gamari [Wed, 15 Nov 2017 16:39:31 +0000 (11:39 -0500)] 
CLabels: Remove CaseLabel

Reviewers: simonmar

Subscribers: rwbarton, thomie

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

21 months agoCLabel: Clean up unused label types
Ben Gamari [Wed, 15 Nov 2017 16:39:11 +0000 (11:39 -0500)] 
CLabel: Clean up unused label types

Test Plan: Validate

Reviewers: trommler, simonmar

Reviewed By: trommler

Subscribers: rwbarton, thomie

GHC Trac Issues: #14454

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

21 months agoRTS: Disable warnings in ffi.h
Peter Trommler [Wed, 15 Nov 2017 16:38:50 +0000 (11:38 -0500)] 
RTS: Disable warnings in ffi.h

The update of GHC's in-tree libffi causes warnings about
undefined macros and hence validate fails.

Also mark broken tests that have a ticket.

Fixes #14353

Test Plan: ./validate (on AIX and powerpc if possible)

Reviewers: bgamari, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: snowleopard, rwbarton, thomie

GHC Trac Issues: #14353, #11259, #14455, #11261

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

21 months agoAdds rts/rts.cabal.in file
Moritz Angermann [Wed, 15 Nov 2017 16:38:04 +0000 (11:38 -0500)] 
Adds rts/rts.cabal.in file

This is in preparation for cabalification of the `rts`. To be actually
able to parse this file, a rather recent Cabal is required. One after
commit 357d49d of haskell/cabal. The relevant PR to support the new
`asm-sources` and `cmm-sources` is haskell/cabal/pull/4857.

Not that this does *not* allow cabal to build the RTS. It does however
provide enough information such that cabal can `copy` and `register`
the package properly in the package database, if all the build
artifacts have been build properly.

As such it does not require any custom handling of the `rts` package.
As the rts as well as all the other packages built by the GHC built
system are built outside of cabal anyway.

Reviewers: bgamari, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

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

21 months agoStaticPointers: Clarify documentation
Facundo Domínguez [Wed, 15 Nov 2017 16:37:32 +0000 (11:37 -0500)] 
StaticPointers: Clarify documentation

 * Document requirement to use the same binaries.
 * Fix some code comments.

Test Plan: ./validate

Reviewers: bgamari, mboes, hvr

Reviewed By: bgamari, mboes

Subscribers: rwbarton, thomie

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

21 months agoAdd new mbmi and mbmi2 compiler flags
John Ky [Wed, 15 Nov 2017 16:35:42 +0000 (11:35 -0500)] 
Add new mbmi and mbmi2 compiler flags

This adds support for the bit deposit and extraction operations provided
by the BMI and BMI2 instruction set extensions on modern amd64 machines.

Test Plan: Validate

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

Reviewed By: bgamari

Subscribers: goldfire, erikd, trommler, newhoggy, rwbarton, thomie

GHC Trac Issues: #14206

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

21 months agoTTG3 Combined Step 1 and 3 for Trees That Grow
Alan Zimmerman [Sun, 12 Nov 2017 19:56:16 +0000 (21:56 +0200)] 
TTG3 Combined Step 1 and 3 for Trees That Grow

Further progress on implementing Trees that Grow on hsSyn AST.

See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow

Trees that grow extension points are added for
  - Rest of HsExpr.hs

Updates haddock submodule

Test Plan: ./validate

Reviewers: bgamari, shayan-najd, goldfire

Subscribers: goldfire, rwbarton, thomie, mpickering

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

21 months agoA bit more tc-tracing
Simon Peyton Jones [Tue, 14 Nov 2017 09:21:39 +0000 (09:21 +0000)] 
A bit more tc-tracing

21 months agoFix a TyVar bug in the flattener
Simon Peyton Jones [Tue, 14 Nov 2017 09:16:22 +0000 (09:16 +0000)] 
Fix a TyVar bug in the flattener

A year ago I gave up on trying to rigorously separate TyVars
from TcTyVars, and instead allowed TyVars to appear rather more
freely in types examined by the constraint solver:

   commit 18d0bdd3848201882bae167e3b15fd797d217e93
   Author: Simon Peyton Jones <simonpj@microsoft.com>
   Date:   Wed Nov 23 16:00:00 2016 +0000

   Allow TyVars in TcTypes

See Note [TcTyVars in the typechecker] in TcType.

However, TcFlatten.flatten_tyvar1 turned out to treat
a TyVar specially, and implicitly assumed that it could
not have an equality constraint in the inert set.  Wrong!

This caused Trac #14450.  Fortunately it is easily fixed,
by deleting code.

21 months agoWIP on combined Step 1 and 3 for Trees That Grow, HsExpr
Alan Zimmerman [Thu, 9 Nov 2017 21:20:19 +0000 (23:20 +0200)] 
WIP on combined Step 1 and 3 for Trees That Grow, HsExpr

See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow

Trees that grow extension points are added for
- HsExpr

Updates haddock submodule

Test Plan: ./validate

Reviewers: bgamari, goldfire

Subscribers: rwbarton, thomie, shayan-najd, mpickering

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

21 months agoDeclare proper spec version in `base.cabal`
Herbert Valerio Riedel [Sat, 11 Nov 2017 16:40:15 +0000 (17:40 +0100)] 
Declare proper spec version in `base.cabal`

This is a follow-up to ba2ae2c8729d5aef2aeb7fb32d6c0ea2a465ea25
which started relying on a new Cabal feature requiring the
the cabal spec version declaration to be updated accordingly.

21 months agocircleci: Bump down thread count
Ben Gamari [Sat, 11 Nov 2017 16:45:37 +0000 (11:45 -0500)] 
circleci: Bump down thread count

It appears that our jobs generally run on VMs with 2 vCPUs. Consequently running
with 8 jobs will completely oversubscribe the machine. I suspect this is the
cause of #14453. Let's bump this down to 3 for now. Ideally we would determine
this from the environment.

21 months agoUse LICENSE instead of ../LICENSE in the compiler.cabal file
Moritz Angermann [Sat, 11 Nov 2017 15:56:10 +0000 (10:56 -0500)] 
Use LICENSE instead of ../LICENSE in the compiler.cabal file

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoAdds cmm-sources to base
Moritz Angermann [Sat, 11 Nov 2017 15:55:51 +0000 (10:55 -0500)] 
Adds cmm-sources to base

Bumps Cabal submodule.

Reviewers: bgamari, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoWindows: Bump to GCC 7.2 for GHC 8.4
Tamar Christina [Sat, 11 Nov 2017 15:55:31 +0000 (10:55 -0500)] 
Windows: Bump to GCC 7.2 for GHC 8.4

GHC 8.4 is expected to ship with an updated GCC bindist based on GCC
7.2.

I am however at this time not updating the crt due to an issue
introduced in September.
https://sourceforge.net/p/mingw-w64/mailman/message/36085637/

Unless a favorable fix comes out of the discussion I will just ship the
old crt with GHC 8.4.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, rwbarton

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

21 months agoSquashed 'hadrian/' changes from 438dc576e7..5ebb69ae1e
Ben Gamari [Fri, 10 Nov 2017 14:28:36 +0000 (09:28 -0500)] 
Squashed 'hadrian/' changes from 438dc576e7..5ebb69ae1e

5ebb69ae1e Drop GccLtXX flags, require GCC > 4.7 and up (#450)

git-subtree-dir: hadrian
git-subtree-split: 5ebb69ae1eb063f25c59383bffb3b5449015c6f9

21 months agoMerge commit '5229c43ccf77bcbffeced01dccb27398d017fa34'
Ben Gamari [Fri, 10 Nov 2017 14:28:36 +0000 (09:28 -0500)] 
Merge commit '5229c43ccf77bcbffeced01dccb27398d017fa34'

21 months agoFix PPC NCG after blockID patch
Peter Trommler [Thu, 9 Nov 2017 22:55:01 +0000 (17:55 -0500)] 
Fix PPC NCG after blockID patch

Commit rGHC8b007ab assigns the same label to the first basic block
of a proc and to the proc entry point. This violates the PPC 64-bit ELF
v. 1.9 and v. 2.0 ABIs and leads to duplicate symbols.

This patch fixes duplicate symbols caused by block labels

In commit rGHCd7b8da1 an info table label is generated from a block id.
Getting the entry label from that info label leads to an undefined
symbol because a suffix "_entry" that is not present in the block label.

To fix that issue add a new info table label flavour for labels
derived from block ids. Converting such a label with toEntryLabel
produces the original block label.

Fixes #14311

Test Plan: ./validate

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

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14311

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

21 months agoChange `OPTIONS_GHC -O` to `OPTIONS_GHC -O2`
Douglas Wilson [Thu, 9 Nov 2017 22:54:45 +0000 (17:54 -0500)] 
Change `OPTIONS_GHC -O` to `OPTIONS_GHC -O2`

These pragmas were having the perverse effect of having these
performance critical modules be LESS optimized in builds with -O2.

Test Plan: Check on gipedia whether this is worthwhile.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agotestsuite: Add test for #5889
Douglas Wilson [Thu, 9 Nov 2017 22:54:28 +0000 (17:54 -0500)] 
testsuite: Add test for #5889

Test Plan: make test TEST=5889

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #5889

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

21 months agoRemove unreliable Core Lint empty case checks
David Feuer [Thu, 9 Nov 2017 22:54:11 +0000 (17:54 -0500)] 
Remove unreliable Core Lint empty case checks

Trac #13990 shows that the Core Lint checks for empty case are
unreliable, and very hard to make reliable. The consensus (among
simonpj, nomeata, and goldfire) seems to be that they should be
removed altogether. Do that.

Add test

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13990

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

21 months agoUpdate comment in GHC.Real (trac#14432)
Bodigrim [Thu, 9 Nov 2017 22:53:57 +0000 (17:53 -0500)] 
Update comment in GHC.Real (trac#14432)

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14432

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

21 months agobase: Fix #14425
Ben Gamari [Thu, 9 Nov 2017 22:53:39 +0000 (17:53 -0500)] 
base: Fix #14425

Test Plan: Validate

Reviewers: hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #14425

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

21 months agobase: Normalize style of approxRational
Ben Gamari [Thu, 9 Nov 2017 22:53:24 +0000 (17:53 -0500)] 
base: Normalize style of approxRational

Stumbled upon this odd bit of style while looking at #14425. Usually I
don't like to do this sort of reformatting, but this seemed like it
would be necessary in the course fo fixing #14425.

Reviewers: hvr

Subscribers: rwbarton, thomie

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

21 months agobase: Add test for #14425
Ben Gamari [Thu, 9 Nov 2017 22:52:26 +0000 (17:52 -0500)] 
base: Add test for #14425

Test Plan: Validate

Reviewers: hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #14425

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

21 months agoMerge initial Hadrian snapshot
Ben Gamari [Thu, 9 Nov 2017 22:50:42 +0000 (17:50 -0500)] 
Merge initial Hadrian snapshot

We will continue to pull in squashed snapshots periodically until we
eventually discontinue development in Hadrian's GitHub repository.

21 months agoUpdate Win32 version for GHC 8.4.
Tamar Christina [Wed, 8 Nov 2017 06:21:16 +0000 (01:21 -0500)] 
Update Win32 version for GHC 8.4.

Update to Win32 2.6 which is the expected version release for 8.4

This involves moving Cabal forward which brings some backwards incompatible
changes that needs various fixups.

Bump a bunch of submodules

Test Plan: ./validate

Reviewers: austin, bgamari, angerman

Reviewed By: bgamari, angerman

Subscribers: angerman, thomie, rwbarton

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

21 months agotestsuite: Fix output of T14394
Ben Gamari [Thu, 9 Nov 2017 22:07:53 +0000 (17:07 -0500)] 
testsuite: Fix output of T14394

21 months agoRemove left-overs from compareByteArray# inline conversion
Herbert Valerio Riedel [Wed, 8 Nov 2017 23:38:53 +0000 (00:38 +0100)] 
Remove left-overs from compareByteArray# inline conversion

These removes left-overs from e3ba26f8b49700b41ff4672f3f7f6a4e453acdcc
where I implemented `compareByteArray#` as an out-of-line primop, which
got optimised into an inline primop shortly afterwards
(as per 7673561555ae354fd9eed8de1e57c681906e2d49).

21 months agoInvoke lintUnfolding only on top-level unfoldings (#14430)
Joachim Breitner [Wed, 8 Nov 2017 03:17:50 +0000 (22:17 -0500)] 
Invoke lintUnfolding only on top-level unfoldings (#14430)

as nested unfoldings are linted together with the top-level unfolding,
and lintUnfolding does the wrong things for nestd unfoldings that
mention join points.

The easiest way of doing that was to pass a TopLevel flag through
`tcUnfolding`, which is invoked both for top level and nested
unfoldings.

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

21 months agoWIP on Doing a combined Step 1 and 3 for Trees That Grow
Alan Zimmerman [Sun, 5 Nov 2017 19:49:11 +0000 (21:49 +0200)] 
WIP on Doing a combined Step 1 and 3 for Trees That Grow

See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow

Trees that grow extension points are added for
- ValBinds
- HsPat
- HsLit
- HsOverLit
- HsType
- HsTyVarBndr
- HsAppType
- FieldOcc
- AmbiguousFieldOcc

Updates haddock submodule

Test Plan: ./validate

Reviewers: shayan-najd, simonpj, austin, goldfire, bgamari

Subscribers: goldfire, rwbarton, thomie, mpickering

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

21 months agoFix in-scope set in simplifier
Simon Peyton Jones [Wed, 8 Nov 2017 11:09:33 +0000 (11:09 +0000)] 
Fix in-scope set in simplifier

This patch fixes Trac #14408.  The problem was that the StaticEnv
field of an ApplyToVar or Select continuation didn't have enough
variables in scope.  The fix is simple, and I documented the
invariant in Note [StaticEnv invariant] in SimplUtils.

No change in behaviour: this just stops an ASSERT from tripping.

21 months agoMinimise provided dictionaries in pattern synonyms
Simon Peyton Jones [Wed, 8 Nov 2017 08:52:06 +0000 (08:52 +0000)] 
Minimise provided dictionaries in pattern synonyms

Trac #14394 showed that it's possible to get redundant
constraints in the inferred provided constraints of a pattern
synonym.  This patch removes the redundancy with mkMinimalBySCs.

To do this I had to generalise the type of mkMinimalBySCs slightly.
And, to reduce confusing reversal, I made it stable: it now returns
its result in the same order as its input.  That led to a raft of
error message wibbles, mostly for the better.