ghc.git
19 months agousers-guide: Remove release notes for 8.2 ghc-8.4.1-alpha1
Ben Gamari [Thu, 14 Dec 2017 22:04:19 +0000 (17:04 -0500)] 
users-guide: Remove release notes for 8.2

19 months agousers-guide: Fix various bits of markup
Ben Gamari [Thu, 14 Dec 2017 21:52:59 +0000 (16:52 -0500)] 
users-guide: Fix various bits of markup

19 months agousers-guide: Consistently document LLVM version requirement
Ben Gamari [Thu, 14 Dec 2017 18:44:52 +0000 (13:44 -0500)] 
users-guide: Consistently document LLVM version requirement

19 months agoFix #14135 by validity checking matches
Carlos Tomé [Mon, 11 Dec 2017 20:38:03 +0000 (15:38 -0500)] 
Fix #14135 by validity checking matches

We filter the complete patterns given in a COMPLETE set to only those that
subsume the type we are matching. Otherwise we end up introducing an ill-typed
equation into the overlap checking, provoking a crash. This was the cause of
Trac #14135.

Reviewers: austin, bgamari, mpickering, gkaracha, simonpj, RyanGlScott,
carlostome

Reviewed By: bgamari

Subscribers: carter, dfeuer, RyanGlScott, goldfire, rwbarton, thomie

GHC Trac Issues: #14135

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

(cherry picked from commit 16c7d9dc9ea7505256e0792c958cab8ae7c8a5c4)

19 months agoImprove Control.Monad.guard and Control.Monad.MonadPlus docs
Nathan Collins [Mon, 11 Dec 2017 17:52:55 +0000 (12:52 -0500)] 
Improve Control.Monad.guard and Control.Monad.MonadPlus docs

This fixes Issue #12372: documentation for Control.Monad.guard not
useful after AMP.

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit 6847c6bf5777eaf507f1cef28c1fc75a2c68bdef)

19 months agoOnly look for locales of the form LL.VV
Gabor Greif [Thu, 30 Nov 2017 19:49:03 +0000 (20:49 +0100)] 
Only look for locales of the form LL.VV

Because in recent RHEL7 suddenly locales like `bokmål` pop up, which
screw up reading-in of ASCII strings a line later. This additional
criterion reliably eliminates those unicode characters.

(cherry picked from commit abd5db6072218ada2b4a21177f5200ea0d3273a0)

19 months agoAllow users to ignore optimization changes
David Feuer [Mon, 11 Dec 2017 18:03:52 +0000 (13:03 -0500)] 
Allow users to ignore optimization changes

* Add a new flag, `-fignore-optim-changes`, allowing them to avoid
  recompilation if the only changes are to the `-O` level or to
  flags controlling optimizations.

* When `-fignore-optim-changes` is *off*, recompile when optimization
  flags (e.g., `-fno-full-laziness`) change. Previously, we ignored
  these unconditionally when deciding whether to recompile a module.

Reviewers: austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: duog, carter, simonmar, rwbarton, thomie

GHC Trac Issues: #13604

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

(cherry picked from commit 708ed9ca4dbf372817fe84a2fe486940123bddfb)

19 months agorts: Don't default to single capability when profiled
Ben Gamari [Mon, 11 Dec 2017 17:55:31 +0000 (12:55 -0500)] 
rts: Don't default to single capability when profiled

This was presumably a vestige of the days when the profiled RTS couldn't
run threaded. Fixes #14545.

Test Plan: simonmar

Reviewers: erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14545

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

(cherry picked from commit 4bfff7a507b5807736e9c6ce9814a9cfa60faeff)

19 months agoAlways use the safe open() call
Simon Marlow [Mon, 11 Dec 2017 17:56:09 +0000 (12:56 -0500)] 
Always use the safe open() call

open() can sometimes take a long time, for example on NFS or FUSE
filesystems.  We recently had a case where open() was taking multiple
seconds to return for a (presumably overloaded) FUSE filesystem, which
blocked GC and caused severe issues.

Test Plan: validate

Reviewers: niteria, bgamari, nh2, hvr, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13296

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

(cherry picked from commit cafe98345cb5d4b11f2059d60d2f20e976ef4f2a)

19 months agoAdd hadrian as a submodule
Ben Gamari [Fri, 8 Dec 2017 18:02:06 +0000 (13:02 -0500)] 
Add hadrian as a submodule

It will remain a submodule until we are ready to merge Hadrian into the
tree.

19 months agoRip out hadrian subtree
Ben Gamari [Fri, 8 Dec 2017 17:42:35 +0000 (12:42 -0500)] 
Rip out hadrian subtree

Sadly subtrees haven't worked quite as well as we would have liked for
developers. See Hadrian #440.

19 months agoBump version to 8.4
Ben Gamari [Mon, 4 Dec 2017 22:01:15 +0000 (17:01 -0500)] 
Bump version to 8.4

Updates haddock dsubmodule

19 months agoFix ghc_packages
Ben Gamari [Mon, 4 Dec 2017 21:15:52 +0000 (16:15 -0500)] 
Fix ghc_packages

The LaTeX produced by this previously failed to compile. Changing the first cell
of the row from an inline to a paragraph fixes this. Then I noticed that the
table overflowed the page. This is fixed by applying the longtable class.

19 months agotemplate-haskell: Rip out FamFlavour
Ben Gamari [Mon, 4 Dec 2017 18:50:36 +0000 (13:50 -0500)] 
template-haskell: Rip out FamFlavour

This was scheduled to happen for 8.2, it looks like it will actually
happen in 8.4.

19 months agoMake the Con and Con' patterns produce evidence
David Feuer [Mon, 4 Dec 2017 13:27:18 +0000 (08:27 -0500)] 
Make the Con and Con' patterns produce evidence

Matching with the `Con` and `Con'` patterns can reveal evidence
that the type in question is *not* an application. This can help
the pattern checker.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: carter, rwbarton, thomie

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

19 months agoCache TypeRep kinds aggressively
David Feuer [Fri, 1 Dec 2017 22:00:24 +0000 (17:00 -0500)] 
Cache TypeRep kinds aggressively

Cache `TypeRep k` in each `TrApp` or `TrTyCon` constructor of
`TypeRep (a :: k)`. This makes `typeRepKind` cheap.

With this change, we won't need any special effort to deserialize
typereps efficiently. The downside, of course, is that we make
`TypeRep`s slightly larger.

Reviewers: austin, hvr, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: carter, simonpj, rwbarton, thomie

GHC Trac Issues: #14254

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

19 months agoAdd trace injection
David Feuer [Fri, 1 Dec 2017 20:59:24 +0000 (15:59 -0500)] 
Add trace injection

Add support for injecting runtime calls to `trace` in `DsM`. This
allows the desugarer to add compile-time information to a runtime
trace.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: carter, thomie, rwbarton

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

19 months agoHandle CPP properly in Backpack
Edward Z. Yang [Sat, 25 Nov 2017 02:12:05 +0000 (10:12 +0800)] 
Handle CPP properly in Backpack

Summary:
Previously, we attempted to lookup 'hole' packages for
include directories; this obviously is not going to work.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: validate

Reviewers: ekmett, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14525

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

19 months agoMake use of boot TyThings during typechecking.
Edward Z. Yang [Mon, 30 Oct 2017 00:15:07 +0000 (20:15 -0400)] 
Make use of boot TyThings during typechecking.

Summary:
Suppose that you are typechecking A.hs, which transitively imports,
via B.hs, A.hs-boot.  When we poke on B.hs and discover that it
has a reference to a type from A, what TyThing should we wire
it up with?  Clearly, if we have already typechecked A, we
should use the most up-to-date TyThing: the one we freshly
generated when we typechecked A.  But what if we haven't typechecked
it yet?

For the longest time, GHC adopted the policy that this was
*an error condition*; that you MUST NEVER poke on B.hs's reference
to a thing defined in A.hs until A.hs has gotten around to checking
this.  However, actually ensuring this is the case has proven
to be a bug farm.  The problem was especially poignant with
type family consistency checks, which eagerly happen before
any typechecking takes place.

This patch takes a different strategy: if we ever try to access
an entity from A which doesn't exist, we just fall back on the
definition of A from the hs-boot file.  This means that you may
end up with a mix of A.hs and A.hs-boot TyThings during the
course of typechecking.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: validate

Reviewers: simonpj, bgamari, austin, goldfire

Subscribers: thomie, rwbarton

GHC Trac Issues: #14396

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

19 months agoDarwin: Use gmp from homebrew
Ben Gamari [Wed, 29 Nov 2017 22:02:17 +0000 (17:02 -0500)] 
Darwin: Use gmp from homebrew

As discussed on ghc-devs, OS X appears to ship an old or otherwise broken gmp.

https://mail.haskell.org/pipermail/ghc-devs/2017-June/014321.html

19 months agoDarwin: Set deployment target
Ben Gamari [Wed, 29 Nov 2017 22:01:07 +0000 (17:01 -0500)] 
Darwin: Set deployment target

19 months agoBump unix submodule
Ben Gamari [Wed, 29 Nov 2017 20:23:41 +0000 (15:23 -0500)] 
Bump unix submodule

Fixes FreeBSD build.

19 months agoComments only: Trac #14511
Simon Peyton Jones [Tue, 28 Nov 2017 16:02:18 +0000 (16:02 +0000)] 
Comments only: Trac #14511

19 months agoMinor tweaks to codegens.rst
Steven Shaw [Wed, 29 Nov 2017 07:16:14 +0000 (17:16 +1000)] 
Minor tweaks to codegens.rst

A couple of nits involving the letter 'C'.

19 months agoCircleCI: Freeze all packages at fixed index state
Ben Gamari [Wed, 29 Nov 2017 15:22:50 +0000 (10:22 -0500)] 
CircleCI: Freeze all packages at fixed index state

We will periodically bump this as necessary.

19 months agoCircleCI: Disallow hscolour 1.24.3
Ben Gamari [Wed, 29 Nov 2017 14:58:42 +0000 (09:58 -0500)] 
CircleCI: Disallow hscolour 1.24.3

This release does not build.

19 months agoCLabel: A bit of documentation
Ben Gamari [Tue, 28 Nov 2017 20:35:32 +0000 (15:35 -0500)] 
CLabel: A bit of documentation

19 months agoCmm: Add missing cases for BlockInfoTable
Ben Gamari [Tue, 28 Nov 2017 19:32:34 +0000 (14:32 -0500)] 
Cmm: Add missing cases for BlockInfoTable

Silly rabbit, BlockInfoTables are data. This fixes the unregisterised build,
finally fixing #14454.

19 months agoCLabel: More specific debug output from CLabel
Ben Gamari [Tue, 28 Nov 2017 19:23:02 +0000 (14:23 -0500)] 
CLabel: More specific debug output from CLabel

19 months agonativeGen: Use foldl' instead of foldl
Ben Gamari [Tue, 28 Nov 2017 01:02:55 +0000 (20:02 -0500)] 
nativeGen: Use foldl' instead of foldl

19 months agonativeGen: Use plusUFMList instead of foldr
Ben Gamari [Tue, 28 Nov 2017 01:02:25 +0000 (20:02 -0500)] 
nativeGen: Use plusUFMList instead of foldr

19 months agoCLabel: Refactor pprDynamicLinkerAsmLabel
Ben Gamari [Tue, 14 Nov 2017 19:58:40 +0000 (14:58 -0500)] 
CLabel: Refactor pprDynamicLinkerAsmLabel

19 months agocmm: Use LocalBlockLabel instead of AsmTempLabel to represent blocks
Ben Gamari [Mon, 13 Nov 2017 17:34:54 +0000 (12:34 -0500)] 
cmm: Use LocalBlockLabel instead of AsmTempLabel to represent blocks

blockLbl was originally changed in 8b007abbeb3045900a11529d907a835080129176 to
use mkTempAsmLabel to fix an inconsistency resulting in #14221. However, this
breaks the C code generator, which doesn't support AsmTempLabels (#14454).

Instead let's try going the other direction: use a new CLabel variety,
LocalBlockLabel. Then we can teach the C code generator to deal with
these as well.

19 months agoCLabel.labelType: Make catch-all case explicit
Ben Gamari [Tue, 14 Nov 2017 22:34:36 +0000 (17:34 -0500)] 
CLabel.labelType: Make catch-all case explicit

19 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

19 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

19 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

19 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

19 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.

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

19 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

19 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

19 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

19 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

19 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.

19 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

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

19 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

19 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

19 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

19 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

19 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.

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

19 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

19 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

19 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.

19 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.

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

19 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

19 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.

19 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.

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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

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

19 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

19 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.

19 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

19 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

19 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.

19 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

19 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

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

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

19 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

19 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

19 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

19 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

19 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.

19 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`.

19 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

19 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

19 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

19 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.

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

19 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

19 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'

19 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

19 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

19 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

19 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

19 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

19 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