ghc.git
20 months agoChange `OPTIONS_GHC -O` to `OPTIONS_GHC -O2` wip/use-O2
Douglas Wilson [Mon, 6 Nov 2017 21:50:39 +0000 (16:50 -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

Subscribers: rwbarton, thomie

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

20 months agobase: Add examples to Bifunctor documentation
Julie Moronuki [Wed, 1 Nov 2017 03:28:46 +0000 (23:28 -0400)] 
base: Add examples to Bifunctor documentation

20 months agoSpecialise lcm :: Word -> Word -> Word (trac#14424)
Bodigrim [Mon, 6 Nov 2017 19:49:11 +0000 (21:49 +0200)] 
Specialise lcm :: Word -> Word -> Word (trac#14424)

20 months agoUpdate autoconf test for gcc to require 4.7 and up
Peter Trommler [Mon, 6 Nov 2017 20:35:30 +0000 (15:35 -0500)] 
Update autoconf test for gcc to require 4.7 and up

Fixing #14244 required the newer gcc atomic built-ins that are provided
from 4.7 and up. This updates the test to check for minimum gcc version
4.7.

The version tests for 3.4 (!), 4.4, and 4.6 are no longer needed and can
be removed. This makes the build system simpler.

Test Plan: validate

Reviewers: austin, bgamari, hvr, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

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

20 months agoDynFlags: Introduce -show-mods-loaded flag
Ben Gamari [Mon, 6 Nov 2017 20:35:19 +0000 (15:35 -0500)] 
DynFlags: Introduce -show-mods-loaded flag

This flag reintroduces the verbose module name output produced by GHCi's
:load command behind a new flag, -show-mods-loaded. This was originally
removed in D3651 but apparently some tools (e.g. haskell-mode) rely on
this output.

Addresses #14427.

Test Plan: Validate

Reviewers: svenpanne

Reviewed By: svenpanne

Subscribers: rwbarton, thomie

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

20 months agoUpdate ErrorCall documentation for the location argument
Ömer Sinan Ağacan [Mon, 6 Nov 2017 20:35:08 +0000 (15:35 -0500)] 
Update ErrorCall documentation for the location argument

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoTypo in glasgow_exts.rst
Douglas Wilson [Mon, 6 Nov 2017 20:34:51 +0000 (15:34 -0500)] 
Typo in glasgow_exts.rst

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agocmm/CBE: Fix a few more zip uses
Ben Gamari [Mon, 6 Nov 2017 20:34:37 +0000 (15:34 -0500)] 
cmm/CBE: Fix a few more zip uses

Ensure that we don't consider lists of equal length to be equal when
they are not. I noticed these while working on the fix for #14361.

Reviewers: austin, simonmar, michalt

Reviewed By: michalt

Subscribers: rwbarton, thomie

GHC Trac Issues: #14361

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

20 months agocmm/CBE: Fix comparison between blocks of different lengths
Ben Gamari [Mon, 6 Nov 2017 20:33:26 +0000 (15:33 -0500)] 
cmm/CBE: Fix comparison between blocks of different lengths

Previously CBE computed equality by taking the lists of middle nodes of
the blocks being compared and zipping them together. It would then map
over this list with the equality relation, and accumulate the result.

However, this is completely wrong: Consider what will happen when we
compare a block with no middle nodes with one with one or more. The
result of `zip` will be empty and consequently the pass may conclude
that the two are indeed equivalent (if their last nodes also match).
This is very bad and the cause of #14361.

The solution I chose was just to write out an explicit recursion, like I
distinctly recall considering doing when I first wrote this code.
Unfortunately I was feeling clever at the time.

Unfortunately this case was just rare enough not to be triggered by the
testsuite. I still need to find a testcase that doesn't have external
dependencies.

Test Plan: Need to find a more minimal testcase

Reviewers: austin, simonmar, michalt

Reviewed By: michalt

Subscribers: michalt, rwbarton, thomie, hvr

GHC Trac Issues: #14361

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

20 months agorts/win32: Emit exception handler output to stderr
Ben Gamari [Mon, 6 Nov 2017 20:33:18 +0000 (15:33 -0500)] 
rts/win32: Emit exception handler output to stderr

Test Plan: Validate

Reviewers: Phyx, austin, erikd, simonmar

Reviewed By: Phyx

Subscribers: rwbarton, thomie

GHC Trac Issues: #14415

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

20 months agotestsuite: Bump metrics of haddock.Cabal
Ben Gamari [Mon, 6 Nov 2017 20:23:45 +0000 (15:23 -0500)] 
testsuite: Bump metrics of haddock.Cabal

20 months agoClean up comments about match algorithm a bit.
klebinger.andreas@gmx.at [Sun, 29 Oct 2017 19:26:51 +0000 (20:26 +0100)] 
Clean up comments about match algorithm a bit.

20 months agochange example from msum to mfilter
Julie Moronuki [Tue, 31 Oct 2017 05:15:41 +0000 (01:15 -0400)] 
change example from msum to mfilter

20 months agoFix documentation and comment issues
Cyd Parser [Wed, 1 Nov 2017 06:13:50 +0000 (23:13 -0700)] 
Fix documentation and comment issues

20 months agoDeserialize all function TypeReps
David Feuer [Thu, 2 Nov 2017 21:30:59 +0000 (17:30 -0400)] 
Deserialize all function TypeReps

Previously, we could only deserialize `TypeRep (a -> b)` if
both `a` and `b` had kind `Type`. Now, we do it regardless of
their runtime representations.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoName TypeRep constructor fields
David Feuer [Thu, 2 Nov 2017 21:30:23 +0000 (17:30 -0400)] 
Name TypeRep constructor fields

Give `TypeRep` constructor fields names, and use them when pattern
matching and constructing values. This is a bit verbose, but makes
it obvious which field means what.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoBump haddock submodule
alexbiehl [Thu, 2 Nov 2017 21:29:08 +0000 (17:29 -0400)] 
Bump haddock submodule

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

20 months agollvmGen: Pass vector arguments in vector registers by default
Ben Gamari [Thu, 2 Nov 2017 21:28:40 +0000 (17:28 -0400)] 
llvmGen: Pass vector arguments in vector registers by default

Earlier this year Edward Kmett requested [1] that we enable passing of
vector values in vector registers by default. The GHC calling convention
changes have been in LLVM for a number of years now so let's just flip
the switch.

[1] https://mail.haskell.org/pipermail/ghc-devs/2017-March/013905.html

Reviewers: austin

Subscribers: rwbarton, thomie

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

20 months agoCmmSink: Use a IntSet instead of a list
alexbiehl [Thu, 2 Nov 2017 21:27:37 +0000 (17:27 -0400)] 
CmmSink: Use a IntSet instead of a list

CmmProcs which have *lots* of local variables take a considerable
amount of time in CmmSink. This was noticed by @tdammers in #7258
while compiling files with large records (~200-400 fields).

Before:

```
        Sun Oct 29 19:58 2017 Time and Allocation Profiling Report (Final)

           ghc-stage2 +RTS -p -RTS
-B/Users/alexbiehl/git/ghc/inplace/lib /Users/alexbiehl/Downloads/W2.hs
-fforce-recomp -O2

        total time  =       26.00 secs   (25996 ticks @ 1000 us, 1 processor)
        total alloc = 14,921,627,912 bytes  (excludes profiling overheads)

COST CENTRE     MODULE      SRC %time %alloc

sink            CmmPipeline
compiler/cmm/CmmPipeline.hs:(104,13)-(105,59)        55.7   15.9
SimplTopBinds   SimplCore   compiler/simplCore/SimplCore.hs:761:39-74 19.5   30.6
FloatOutwards   SimplCore   compiler/simplCore/SimplCore.hs:471:40-66 4.2    9.0
RegAlloc-linear AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(658,27)-(660,55)    4.0   11.1
pprNativeCode   AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(529,37)-(530,65)    2.8    6.3
NewStranal      SimplCore   compiler/simplCore/SimplCore.hs:480:40-63 1.6    3.7
OccAnal         SimplCore compiler/simplCore/SimplCore.hs:(739,22)-(740,67)     1.5    3.5
StgCmm          HscMain compiler/main/HscMain.hs:(1426,13)-(1427,62)          1.2    2.4
regLiveness     AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(591,17)-(593,52)    1.2    1.9
genMachCode     AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(580,17)-(582,62)    0.9    1.8
NativeCodeGen   CodeOutput  compiler/main/CodeOutput.hs:171:18-78 0.9    2.1
CoreTidy        HscMain     compiler/main/HscMain.hs:1253:27-67 0.8    1.9
```

After:

```
        Sun Oct 29 19:18 2017 Time and Allocation Profiling Report (Final)

           ghc-stage2 +RTS -p -RTS
-B/Users/alexbiehl/git/ghc/inplace/lib /Users/alexbiehl/Downloads/W2.hs
-fforce-recomp -O2

        total time  =       13.31 secs   (13307 ticks @ 1000 us, 1 processor)
        total alloc = 15,772,184,488 bytes  (excludes profiling overheads)

COST CENTRE     MODULE         SRC %time %alloc

SimplTopBinds   SimplCore
compiler/simplCore/SimplCore.hs:761:39-74            38.3   29.0
sink            CmmPipeline compiler/cmm/CmmPipeline.hs:(104,13)-(105,59)        13.2   20.3
RegAlloc-linear AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(658,27)-(660,55)    8.3   10.5
FloatOutwards   SimplCore compiler/simplCore/SimplCore.hs:471:40-66             8.1    8.5
pprNativeCode   AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(529,37)-(530,65)    5.4    5.9
NewStranal      SimplCore compiler/simplCore/SimplCore.hs:480:40-63             3.1    3.5
OccAnal         SimplCore compiler/simplCore/SimplCore.hs:(739,22)-(740,67)     2.9    3.3
StgCmm          HscMain compiler/main/HscMain.hs:(1426,13)-(1427,62)          2.3    2.3
regLiveness     AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(591,17)-(593,52)    2.1    1.8
NativeCodeGen   CodeOutput     compiler/main/CodeOutput.hs:171:18-78 1.7    2.0
genMachCode     AsmCodeGen compiler/nativeGen/AsmCodeGen.hs:(580,17)-(582,62)    1.6    1.7
CoreTidy        HscMain        compiler/main/HscMain.hs:1253:27-67 1.4    1.8
foldNodesBwdOO  Hoopl.Dataflow compiler/cmm/Hoopl/Dataflow.hs:(397,1)-(403,17)       1.1    0.8
```

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari

Subscribers: duog, rwbarton, thomie, tdammers

GHC Trac Issues: #7258

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

20 months agorts/PrimOps.cmm: add declaration for heapOverflow closure
Sergei Trofimovich [Thu, 2 Nov 2017 23:07:57 +0000 (23:07 +0000)] 
rts/PrimOps.cmm: add declaration for heapOverflow closure

Before the change UNREG ghc build failed as:
```
  rts_dist_HC rts/dist/build/PrimOps.o
/tmp/ghc2370_0/ghc_4.hc: In function 'stg_newByteArrayzh':

/tmp/ghc2370_0/ghc_4.hc:26:13: error:
     error: 'base_GHCziIOziException_heapOverflow_closure'
         undeclared (first use in this function)
     R1.w = (W_)&base_GHCziIOziException_heapOverflow_closure;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   |
26 | R1.w = (W_)&base_GHCziIOziException_heapOverflow_closure;
   |             ^
```

It's an UNREG-specific failure because C backend always requires
declarations to be known.

Added missing declaration.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
20 months agoRevert "Move check-ppr and check-api-annotations to testsuite/utils"
Ben Gamari [Thu, 2 Nov 2017 18:35:01 +0000 (14:35 -0400)] 
Revert "Move check-ppr and check-api-annotations to testsuite/utils"

Unfortunately this (ironically) ended up breaking bindist testing since
we didn't have a package-data.mk. Unfortunately there is no easy way to
fix this.

This reverts commit 1e9f90af7311c33de0f7f5b7dba594725596d675.

20 months agoFix atomicread/write operations
Peter Trommler [Thu, 2 Nov 2017 17:34:41 +0000 (13:34 -0400)] 
Fix atomicread/write operations

In `libraries/ghc-prim/cbits/atomic.c` no barriers were issued for
atomic read and write operations. Starting with gcc 4.7 compiler
intrinsics are offered. The atomic intrinisics are also available in
clang. Use these to implement `hs_atomicread*` and `hs_atomicwrite`.

Test Plan: validate on OSX and Windows

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

Reviewed By: bgamari

Subscribers: dfeuer, rwbarton, thomie

GHC Trac Issues: #14244

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

20 months agoIntroduce -dsuppress-stg-free-vars flag
Ben Gamari [Thu, 2 Nov 2017 17:32:21 +0000 (13:32 -0400)] 
Introduce -dsuppress-stg-free-vars flag

This breaks out control over STG free variable list output from
-dppr-debug into its own distinct flag. This makes it more discoverable
and easier to change independently from other dump output.

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

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

20 months agoTcRnDriver: Bracket family instance consistency output in -ddump-rn-trace
Ben Gamari [Thu, 2 Nov 2017 16:07:50 +0000 (12:07 -0400)] 
TcRnDriver: Bracket family instance consistency output in -ddump-rn-trace

Reviewers: austin

Subscribers: rwbarton, thomie

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

20 months agoAdd custom exception for fixIO
David Feuer [Thu, 2 Nov 2017 16:06:56 +0000 (12:06 -0400)] 
Add custom exception for fixIO

Traditionally, `fixIO f` throws `BlockedIndefinitelyOnMVar` if
`f` is strict. This is not particularly friendly, since the
`MVar` in question is just part of the way `fixIO` happens to be
implemented. Instead, throw a new `FixIOException` with a better
explanation of the problem.

Reviewers: austin, hvr, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14356

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

20 months agoUse proper Unique for Name
alexbiehl [Thu, 2 Nov 2017 16:06:21 +0000 (12:06 -0400)] 
Use proper Unique for Name

I noticed this while tinkering in haddock. This might be a relict from
ancient times where newtypes wouldn't optimize well.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoImplement the basics of hex floating point literals
Iavor Diatchki [Thu, 2 Nov 2017 16:02:22 +0000 (12:02 -0400)] 
Implement the basics of hex floating point literals

Implement hexadecmial floating point literals.

The digits of the mantissa are hexadecimal.
The exponent is written in base 10, and the base for the exponentiation is 2.
Hexadecimal literals look a lot like ordinary decimal literals, except that
they use hexadecmial digits, and the exponent is written using `p` rather than `e`.

The specification of the feature is available here:
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0004-hexFloats.rst

For a discussion of the various choices:
https://github.com/ghc-proposals/ghc-proposals/pull/37

Reviewers: mpickering, goldfire, austin, bgamari, hvr

Reviewed By: bgamari

Subscribers: mpickering, thomie

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

20 months agoPPC NCG: Impl branch prediction, atomic ops.
Peter Trommler [Thu, 2 Nov 2017 15:57:05 +0000 (11:57 -0400)] 
PPC NCG: Impl branch prediction, atomic ops.

Implement AtomicRMW ops, atomic read, atomic write
in PowerPC native code generator. Also implement
branch prediction because we need it in atomic ops
anyway.

This patch improves the issue in #12537 a bit but
does not fix it entirely.

The fallback operations for atomicread and atomicwrite
in libraries/ghc-prim/cbits/atomic.c are incorrect.
This patch avoids those functions by implementing the
operations directly in the native code generator. This
is also what the x86/amd64 NCG and the LLVM backend
do.

Test Plan: validate on AIX and PowerPC (32-bit) Linux

Reviewers: erikd, hvr, austin, bgamari, simonmar

Reviewed By: hvr, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12537

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

20 months agoImplement the EmptyDataDeriving proposal
Ryan Scott [Thu, 2 Nov 2017 15:52:50 +0000 (11:52 -0400)] 
Implement the EmptyDataDeriving proposal

This implements the `EmptyDataDeriving` proposal put forth in
https://github.com/ghc-proposals/ghc-proposals/blob/dbf51608/proposals/0006-deriving-empty.rst.
This has two major changes:

* The introduction of an `EmptyDataDeriving` extension, which
  permits directly deriving `Eq`, `Ord`, `Read`, and `Show` instances
  for empty data types.
* An overhaul in the code that is emitted in derived instances for
  empty data types. To see an overview of the changes brought forth,
  refer to the changes to the 8.4.1 release notes.

Test Plan: ./validate

Reviewers: bgamari, dfeuer, austin, hvr, goldfire

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #7401, #10577, #13117

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

20 months agoTidy up IfaceEqualityTyCon
Simon Peyton Jones [Tue, 31 Oct 2017 11:01:17 +0000 (11:01 +0000)] 
Tidy up IfaceEqualityTyCon

This commit

  commit 85aa1f4253163985fe07d172f8da73b784bb7b4b
  Date:   Sun Oct 29 20:48:19 2017 -0400
    Fix #14390 by making toIfaceTyCon aware of equality

was a bit over-complicated. This patch simplifies the (horribly
ad-hoc) treatement of IfaceEqualityTyCon, and documents it better.

No visible change in behaviour.

20 months agocore-spec: Add join points to formalism
Luke Maurer [Mon, 30 Oct 2017 21:18:11 +0000 (17:18 -0400)] 
core-spec: Add join points to formalism

20 months agoAdd Note [Setting the right in-scope set]
Simon Peyton Jones [Mon, 30 Oct 2017 14:56:58 +0000 (14:56 +0000)] 
Add Note [Setting the right in-scope set]

20 months agoCatch a few more typos in comments
Gabor Greif [Mon, 30 Oct 2017 11:21:49 +0000 (12:21 +0100)] 
Catch a few more typos in comments

20 months agominor wordsmithing
Gabor Greif [Mon, 30 Oct 2017 11:03:30 +0000 (12:03 +0100)] 
minor wordsmithing

20 months agoTypofixes in comments
Gabor Greif [Tue, 24 Oct 2017 21:25:56 +0000 (23:25 +0200)] 
Typofixes in comments

20 months agoTypofix in panic
Gabor Greif [Sun, 22 Oct 2017 21:05:02 +0000 (23:05 +0200)] 
Typofix in panic

20 months agoFix typo in accessor name
Gabor Greif [Fri, 27 Oct 2017 20:59:18 +0000 (22:59 +0200)] 
Fix typo in accessor name

and in comments

20 months agoA bit more tc-tracing
Simon Peyton Jones [Mon, 16 Oct 2017 15:15:08 +0000 (16:15 +0100)] 
A bit more tc-tracing

20 months agoAllow packing constructor fields
Michal Terepeta [Mon, 30 Oct 2017 00:49:32 +0000 (20:49 -0400)] 
Allow packing constructor fields

This is another step for fixing #13825 and is based on D38 by Simon
Marlow.

The change allows storing multiple constructor fields within the same
word. This currently applies only to `Float`s, e.g.,
```
data Foo = Foo {-# UNPACK #-} !Float {-# UNPACK #-} !Float
```
on 64-bit arch, will now store both fields within the same constructor
word. For `WordX/IntX` we'll need to introduce new primop types.

Main changes:

- We now use sizes in bytes when we compute the offsets for
  constructor fields in `StgCmmLayout` and introduce padding if
  necessary (word-sized fields are still word-aligned)

- `ByteCodeGen` had to be updated to correctly construct the data
  types. This required some new bytecode instructions to allow pushing
  things that are not full words onto the stack (and updating
  `Interpreter.c`). Note that we only use the packed stuff when
  constructing data types (i.e., for `PACK`), in all other cases the
  behavior should not change.

- `RtClosureInspect` was changed to handle the new layout when
  extracting subterms. This seems to be used by things like `:print`.
  I've also added a test for this.

- I deviated slightly from Simon's approach and use `PrimRep` instead
  of `ArgRep` for computing the size of fields.  This seemed more
  natural and in the future we'll probably want to introduce new
  primitive types (e.g., `Int8#`) and `PrimRep` seems like a better
  place to do that (where we already have `Int64Rep` for example).
  `ArgRep` on the other hand seems to be more focused on calling
  functions.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

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

Reviewed By: bgamari

Subscribers: maoe, rwbarton, thomie

GHC Trac Issues: #13825

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

20 months agoFix #14390 by making toIfaceTyCon aware of equality
Ryan Scott [Mon, 30 Oct 2017 00:48:19 +0000 (20:48 -0400)] 
Fix #14390 by making toIfaceTyCon aware of equality

GHC was panicking when pretty-printing a heterogeneous
equality type constructor (#14390) because the function which
produced the type constructor, `toIfaceTyCon`, wasn't attaching the
appropriate `IfaceTyConSort` for equality type constructors, which
is `IfaceEqualityTyCon`. This is fixed easily enough.

Test Plan: make test TEST=T14390

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14390

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

20 months agoTurn `compareByteArrays#` out-of-line primop into inline primop
alexbiehl [Mon, 30 Oct 2017 00:47:26 +0000 (20:47 -0400)] 
Turn `compareByteArrays#` out-of-line primop into inline primop

Depends on D4090

Reviewers: austin, bgamari, erikd, simonmar, alexbiehl

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoAdd -falignment-sanitization flag
Ben Gamari [Mon, 30 Oct 2017 00:46:45 +0000 (20:46 -0400)] 
Add -falignment-sanitization flag

Here we add a flag to instruct the native code generator to add
alignment checks in all info table dereferences. This is helpful in
catching pointer tagging issues.

Thanks to @jrtc27 for uncovering the tagging issues on Sparc which
inspired this flag.

Test Plan: Validate

Reviewers: simonmar, austin, erikd

Reviewed By: simonmar

Subscribers: rwbarton, trofi, thomie, jrtc27

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

20 months agobase: Implement file locking in terms of POSIX locks
Ben Gamari [Mon, 30 Oct 2017 00:46:21 +0000 (20:46 -0400)] 
base: Implement file locking in terms of POSIX locks

Hopefully these are more robust to NFS malfunction than BSD flock-style
locks.  See #13945.

Test Plan: Validate via @simonpj

Reviewers: austin, hvr

Subscribers: rwbarton, thomie, erikd, simonpj

GHC Trac Issues: #13945

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

20 months agoImplement a dedicated exitfication pass #14152
Joachim Breitner [Sat, 26 Aug 2017 12:35:50 +0000 (14:35 +0200)] 
Implement a dedicated exitfication pass #14152

The idea is described in #14152, and can be summarized: Float the exit
path out of a joinrec, so that the simplifier can do more with it.
See the test case for a nice example.

The floating goes against what the simplifier usually does, hence we
need to be careful not inline them back.

The position of exitification in the pipeline was chosen after a small
amount of experimentation, but may need to be improved. For example,
exitification can allow rewrite rules to fire, but for that it would
have to happen before the `simpl_phases`.

Perf.haskell.org reports these nice performance wins:

    Nofib allocations
    fannkuch-redux    78446640  - 99.92%      64560
    k-nucleotide     109466384  - 91.32%    9502040
    simple            72424696  -  5.96%   68109560

    Nofib instruction counts
    fannkuch-redux  1744331636  -  3.86% 1676999519
    k-nucleotide    2318221965  -  6.30% 2172067260
    scs             1978470869  -  3.35% 1912263779
    simple           669858104  -  3.38%  647206739
    spectral-norm    186423292  -  5.37%  176411536

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

20 months agosimplNonRecJoinPoint: Handle Shadowing correctly
Joachim Breitner [Thu, 26 Oct 2017 23:36:24 +0000 (19:36 -0400)] 
simplNonRecJoinPoint: Handle Shadowing correctly

Previously, (since 33452df), simplNonRecJoinPoint would do the wrong
thing in the presence of shadowing: It analyzed the RHS of a join
binding with the environment for the body. In particular, with

    foo x =
      join x = x * x
      in x

where there is shadowing, it renames the inner x to x1, and should
produce

    foo x =
      join x1 = x * x
      in x1

but because the substitution (x ↦ x1) is also used on the RHS we get the
bogus

    foo x =
      join x1 = x1 * x1
      in x1

Fixed this by adding a `rhs_se` parameter, analogous to `simplNonRecE`
and `simplLazyBind`.

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

20 months agoManual: The -ddump-cmm-* flags had a wrong spelling in the manual
Joachim Breitner [Sat, 28 Oct 2017 21:35:31 +0000 (17:35 -0400)] 
Manual: The -ddump-cmm-* flags had a wrong spelling in the manual

20 months agoMake tagForCon non-linear
Bartosz Nitka [Fri, 20 Oct 2017 19:30:52 +0000 (20:30 +0100)] 
Make tagForCon non-linear

Computing the number of constructors for TyCon is linear
in the number of constructors.
That's wasteful if all you want to check is if that
number is smaller than what fits in tag bits
(usually 8 things).

What this change does is to use a function that can
determine the ineqaulity without computing the size.

This improves compile time on a module with a
data type that has 10k constructors.
The variance in total time is (suspiciously) high,
but going by the best of 3 the numbers are 8.186s vs 7.511s.
For 1000 constructors the difference isn't noticeable:
0.646s vs 0.624s.
The hot spots were cgDataCon and cgEnumerationTyCon
where tagForCon is called in a loop.

One alternative would be to pass down the size.

Test Plan: harbormaster

Reviewers: bgamari, simonmar, austin

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

20 months agorelnotes: Fix a few minor formatting issues
Ben Gamari [Fri, 27 Oct 2017 18:02:19 +0000 (14:02 -0400)] 
relnotes: Fix a few minor formatting issues

20 months agoApplicativeDo: handle BodyStmt (#12143)
Simon Marlow [Thu, 26 Oct 2017 10:23:23 +0000 (11:23 +0100)] 
ApplicativeDo: handle BodyStmt (#12143)

Summary:
It's simple to treat BodyStmt just like a BindStmt with a wildcard
pattern, which is enough to fix #12143 without going all the way to
using `<*` and `*>` (#10892).

Test Plan:
* new test cases in `ado004.hs`
* validate

Reviewers: niteria, simonpj, bgamari, austin, erikd

Subscribers: rwbarton, thomie

GHC Trac Issues: #12143

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

20 months agoFix an exponential-blowup case in SpecConstr
Simon Peyton Jones [Thu, 26 Oct 2017 16:24:52 +0000 (17:24 +0100)] 
Fix an exponential-blowup case in SpecConstr

Trac #14379 showed a case where use of "forcing" to do
"damn the torpedos" specialisation without resource limits
(which 'vector' does a lot) led to exponential blowup.

The fix is easy.  Finding it wasn't.  See Note [Forcing
specialisation] and the one-line change in decreaseSpecCount.

20 months agoAdd more pprTrace to SpecConstr (debug only)
Simon Peyton Jones [Thu, 26 Oct 2017 16:12:17 +0000 (17:12 +0100)] 
Add more pprTrace to SpecConstr (debug only)

20 months agoDon't use $SHELL in wrapper scripts
Joachim Breitner [Tue, 1 Aug 2017 19:30:09 +0000 (19:30 +0000)] 
Don't use $SHELL in wrapper scripts

Do not use $SHELL as $SHELL is the user's preferred interactive shell.
We do not want this to leak into the wrapper scripts.

20 months agoconfigure: Add Alpine Linux to checkVendor
Tuncer Ayaz [Tue, 1 Aug 2017 19:25:25 +0000 (19:25 +0000)] 
configure: Add Alpine Linux to checkVendor

20 months agousers-guide: Disable index node generation
Ben Gamari [Thu, 26 Oct 2017 23:11:58 +0000 (19:11 -0400)] 
users-guide: Disable index node generation

This is breaking the build on some platforms. It's unclear exactly why but I
don't have time to investigate at the moment.

20 months agoDeclare upstram repo location for hsc2hs
Herbert Valerio Riedel [Thu, 26 Oct 2017 13:47:45 +0000 (15:47 +0200)] 
Declare upstram repo location for hsc2hs

[skip ci]

20 months agoFactor out readField (#14364)
Tobias Dammers [Wed, 25 Oct 2017 23:09:03 +0000 (19:09 -0400)] 
Factor out readField (#14364)

Improves compiler performance of deriving Read instances, as suggested
in the issue.

Additionally, we introduce `readSymField`, a companion to `readField`
that parses symbol-type fields (where the field name is a symbol, e.g.
`(#)`, rather than an alphanumeric identifier. The decision between
these two functions is made a compile time, because we already know
which one we need based on the field name.

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

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

20 months agobase: Enable listToMaybe to fuse via foldr/build
Douglas Wilson [Wed, 25 Oct 2017 23:05:30 +0000 (19:05 -0400)] 
base: Enable listToMaybe to fuse via foldr/build

Test Plan: Consider whether this is a good idea.

Reviewers: austin, hvr, bgamari, nomeata

Reviewed By: bgamari, nomeata

Subscribers: nomeata, rwbarton, thomie

GHC Trac Issues: #14387

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

20 months agouser-guide: Clarify default optimization flags
Ben Gamari [Wed, 25 Oct 2017 19:53:40 +0000 (15:53 -0400)] 
user-guide: Clarify default optimization flags

Begins to fix #14214.

[skip ci]

Test Plan: Read it.

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14214

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

20 months agoFix a bug in 'alexInputPrevChar'
Alec Theriault [Wed, 25 Oct 2017 19:52:38 +0000 (15:52 -0400)] 
Fix a bug in 'alexInputPrevChar'

The lexer hacks around unicode by squishing any character into a 'Word8'
and then storing the actual character in its state. This happens at
'alexGetByte'.

That is all and well, but we ought to be careful that the characters we
retrieve via 'alexInputPrevChar' also fit this convention.

In fact, #13986 exposes nicely what can go wrong: the regex in the left
context of the type application rule uses the '$idchar' character set
which relies on the unicode hack. However, a left context corresponds
to a call to 'alexInputPrevChar', and we end up passing full blown
unicode characters to '$idchar', despite it not being equipped to deal
with these.

Test Plan: Added a regression test case

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13986

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

20 months agoImplement `-Wpartial-fields` warning (#7169)
Daishi Nakajima [Wed, 25 Oct 2017 19:51:01 +0000 (15:51 -0400)] 
Implement `-Wpartial-fields` warning (#7169)

Warning on declaring a partial record selector.
However, disable warn with field names that start with underscore.

Test Plan: Added 1 test case.

Reviewers: austin, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: goldfire, simonpj, duog, rwbarton, thomie

GHC Trac Issues: #7169

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

20 months agoPerformance improvements linear regAlloc (#7258)
Tobias Dammers [Wed, 25 Oct 2017 19:50:32 +0000 (15:50 -0400)] 
Performance improvements linear regAlloc (#7258)

When allocating and potentially spilling registers, we need to check
the desired allocations against current allocations to decide where we
can spill to, cq. which allocations we can toss and if so, how.
Previously, this was done by walking the Cartesian product of the
current allocations (`assig`) and the allocations to keep (`keep`),
which has quadratic complexity. This patch introduces two improvements:

1. pre-filter the `assig` list, because we are only interested in two
types of allocations (in register, and in register+memory), which will
only make up a small and constant portion of the list; and
2. use set / map operations instead of lists, which reduces algorithmic
complexity.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoFix space leak in BinIface.getSymbolTable
Douglas Wilson [Wed, 25 Oct 2017 18:20:06 +0000 (14:20 -0400)] 
Fix space leak in BinIface.getSymbolTable

Replace a call to mapAccumR, which uses linear stack space, with a
gadget that uses constant space.

Remove an unused parameter from fromOnDiskName.

The tests T1292_imports and T4239 are now reporting imported names in a
different order. I don't completely understand why, but I presume it is
because the symbol tables are now read more strictly. The new order
seems better in T1792_imports, and equally random in T4239.

There are several performance test improvements.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: alexbiehl, rwbarton, thomie

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

20 months agoWindows: Update the mirror script to generate hashes and use mirror fallback
Tamar Christina [Wed, 25 Oct 2017 18:19:44 +0000 (14:19 -0400)] 
Windows: Update the mirror script to generate hashes and use mirror fallback

This fixes the mirror script so it correctly queries haskell.org and if
packages aren't found check repo.msys2.org.

Also the mirror functionality now generates the md5 hashes after a
mirror fetch that can be placed in the md5sums file.

Test Plan:
 mk/get-win32-tarballs.sh fetch mirror

 and ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoMake layLeft and reduceDoc stricter (#7258)
Tobias Dammers [Wed, 25 Oct 2017 18:17:58 +0000 (14:17 -0400)] 
Make layLeft and reduceDoc stricter (#7258)

Making the pretty-printer based assembly output stricter in
strategically chosen locations produces a minor performance improvement
when compiling large derived Read instance (on the order of 5-10%).

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoAdd info about Github pull requests.
AndreasPK [Fri, 20 Oct 2017 21:53:54 +0000 (23:53 +0200)] 
Add info about Github pull requests.

20 months agotypecheck: Clarify errors mentioned in #14385
Ben Gamari [Tue, 24 Oct 2017 17:56:29 +0000 (13:56 -0400)] 
typecheck: Clarify errors mentioned in #14385

20 months agoMake language extensions their own category in the documentation
Joachim Breitner [Thu, 19 Oct 2017 18:21:49 +0000 (14:21 -0400)] 
Make language extensions their own category in the documentation

I.e. instead of

    .. ghc-flag:: -XUnboxedTuples
        :shortdesc: Enable the use of unboxed tuple syntax.
        :type: dynamic
        :reverse: -XNoUnboxedTuples
        :category:

one simply writes

    .. extension:: UnboxedTuples
        :shortdesc: Enable the use of unboxed tuple syntax.

This allows language extensions to be referenced as

    If :extension:`UnboxedTuples` is enabled, then...

This directive still creates the entries for the `-XUnboxedTuples` flag,
so in particular,

    Set :ghc-flag:`-XUnboxedTuples` if you have to.

still works, and lists of flags in general (e.g. for the manpage)
include these.

I also removed lots of links from the shortdesc of the extensions, when
this link simply points to the section where the extension is defined.

I removed the list of `-X` flags from the flag reference table, but added a
table of extension under “10.1. Language options”

Lots of text in the manual now refers to “extension `Foo`” rather than
“flag `-XFoo`”.

I consider `-XFoo` a historic artifact that stems from when language
extensions were really just flags. These days, the use of `-XFoo` is
(IMHO) deprecated: You should be using `LANGUAGE Foo`, or maybe the
appropriate field in a `.cabal` file. See 9278994 which did this change
to error messages already.

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

20 months agoRevert "Update Win32 version for GHC 8.4."
Tamar Christina [Wed, 25 Oct 2017 08:53:54 +0000 (09:53 +0100)] 
Revert "Update Win32 version for GHC 8.4."

This reverts commit 561bdca16e2fe88d0b96fc10098955eabca81bba.

submodule

20 months agoRevert "ghc-cabal: Inline removed function ..."
Tamar Christina [Wed, 25 Oct 2017 08:53:25 +0000 (09:53 +0100)] 
Revert "ghc-cabal: Inline removed function ..."

This reverts commit f744261ad25942e8a747821fc468f1a21c9c705c.

20 months agoghc-cabal: Inline removed function from Cabal.
Tamar Christina [Wed, 25 Oct 2017 08:30:52 +0000 (09:30 +0100)] 
ghc-cabal: Inline removed function from Cabal.

20 months agoUpdate Win32 version for GHC 8.4.
Tamar Christina [Wed, 25 Oct 2017 07:51:00 +0000 (08:51 +0100)] 
Update Win32 version for GHC 8.4.

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

This bumps the required submodule s as well.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

20 months agoRevert "Windows: Bump to GCC 7.2 for GHC 8.4"
Tamar Christina [Wed, 25 Oct 2017 07:45:24 +0000 (08:45 +0100)] 
Revert "Windows: Bump to GCC 7.2 for GHC 8.4"

This reverts commit b62097d10e0ff490f862661a24e3ca1cc1bba841.

20 months agoWindows: Bump to GCC 7.2 for GHC 8.4
Tamar Christina [Wed, 25 Oct 2017 07:13:55 +0000 (08:13 +0100)] 
Windows: Bump to GCC 7.2 for GHC 8.4

Summary:
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

Subscribers: rwbarton, thomie

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

20 months agoRemove the 'legroom' part of the timeout-accurate-pure test.
Tom Sydney Kerckhove [Wed, 25 Oct 2017 07:09:35 +0000 (08:09 +0100)] 
Remove the 'legroom' part of the timeout-accurate-pure test.

Summary:
This removes the part of the test that checks whether the timeout happened in
a 'reasonable' amount of time, because it is flaky.
In subsequent work, we can turn this into a benchmark.

Test Plan: This _is_ a test

Reviewers: nh2, bgamari, Phyx, austin, hvr

Reviewed By: Phyx

Subscribers: rwbarton, thomie

GHC Trac Issues: #8684

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

20 months agoInclude usg_file_hash in ghc --show-iface output
Simon Marlow [Fri, 20 Oct 2017 16:07:27 +0000 (17:07 +0100)] 
Include usg_file_hash in ghc --show-iface output

Summary:
Otherwise we can get an iface hash difference, but no indication of what
caused it in the --show-iface output.

Test Plan: Harbourmaster

Reviewers: austin, bgamari, erikd

Subscribers: rwbarton, thomie

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

20 months agoUser’s guide: Properly link to RTS flag -V
Joachim Breitner [Tue, 24 Oct 2017 14:36:49 +0000 (10:36 -0400)] 
User’s guide: Properly link to RTS flag -V

20 months agoTemporary fix to Trac #14380
Simon Peyton Jones [Tue, 24 Oct 2017 10:12:43 +0000 (11:12 +0100)] 
Temporary fix to Trac #14380

This fix replaces an utterly bogus error message with a decent one,
rejecting a pattern synonym with a list pattern and rebindable syntax.

Not hard to fix properly, but I'm going to wait for a willing volunteer
and/or more user pressure.

20 months agoComments only
Simon Peyton Jones [Mon, 23 Oct 2017 08:08:16 +0000 (09:08 +0100)] 
Comments only

20 months agosubmodule nofib: Add digits-of-e2.faststdout
Joachim Breitner [Mon, 23 Oct 2017 04:57:33 +0000 (00:57 -0400)] 
submodule nofib: Add digits-of-e2.faststdout

20 months agosubmodule nofib: Add digits-of-e1.faststdout
Joachim Breitner [Mon, 23 Oct 2017 03:45:10 +0000 (23:45 -0400)] 
submodule nofib: Add digits-of-e1.faststdout

20 months agonofib submodule: Fix a problem with fasta-c.c
Joachim Breitner [Mon, 23 Oct 2017 02:44:39 +0000 (22:44 -0400)] 
nofib submodule: Fix a problem with fasta-c.c

20 months agoAdd stack traces on crashes on Windows
Tamar Christina [Sun, 22 Oct 2017 11:14:22 +0000 (12:14 +0100)] 
Add stack traces on crashes on Windows

Summary:
This patch adds the ability to generate stack traces on crashes for Windows.
When running in the interpreter this attempts to use symbol information from
the interpreter and information we know about the loaded object files to
resolve addresses to symbols.

When running compiled it doesn't have this information and then defaults
to using symbol information from PDB files. Which for now means only
files compiled with ICC or MSVC will show traces compiled.

But I have a future patch that may address this shortcoming.

Also since I don't know how to walk a pure haskell stack, I can for now
only show the last entry. I'm hoping to figure out how Apply.cmm works to
be able to walk the stalk and give more entries for pure haskell code.

In GHCi

```
$ echo main | inplace/bin/ghc-stage2.exe --interactive ./testsuite/tests/rts/derefnull.hs
GHCi, version 8.3.20170830: http://www.haskell.org/ghc/  :? for help
Ok, 1 module loaded.
Prelude Main>
Access violation in generated code when reading 0x0

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x77cde10    0xc370229 E:\..\base\dist-install\build\HSbase-4.10.0.0.o+0x190031
                 (base_ForeignziStorable_zdfStorableInt4_info+0x3f)
```

and compiled

```
Access violation in generated code when reading 0x0

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0xf0dbd0     0x40bb01 E:\..\rts\derefnull.run\derefnull.exe+0xbb01
```

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoUpdate record-wildcard docs
Simon Peyton Jones [Fri, 20 Oct 2017 12:49:11 +0000 (13:49 +0100)] 
Update record-wildcard docs

This patch clarifies the story for record wildcards,
following the discussion on Trac #14347.

21 months agoImprove kick-out in the constraint solver
Simon Peyton Jones [Fri, 20 Oct 2017 11:08:04 +0000 (12:08 +0100)] 
Improve kick-out in the constraint solver

This patch was provoked by Trac #14363.  Turned out that we were
kicking out too many constraints in TcSMonad.kickOutRewritable, and
that mean that the work-list never became empty: infinite loop!

That in turn made me look harder at the Main Theorem in
Note [Extending the inert equalities].

Main changes

* Replace TcType.isTyVarExposed by TcType.isTyVarHead.  The
  over-agressive isTyVarExposed is what caused Trac #14363.
  See Note [K3: completeness of solving] in TcSMonad.

* TcType.Make anyRewriteableTyVar role-aware.  In particular,
      a ~R ty
  cannot rewrite
      b ~R f a
  See Note [anyRewriteableTyVar must be role-aware].  That means
  it has to be given a role argument, which forces a little
  refactoring.

  I think this change is fixing a bug that hasn't yet been reported.
  The actual reported bug is handled by the previous bullet.  But
  this change is definitely the Right Thing

The main changes are in TcSMonad.kick_out_rewritable, and in TcType
(isTyVarExposed ---> isTyVarHead).

I did a little unforced refactoring:

 * Use the cc_eq_rel field of a CTyEqCan when it is available, rather
   than recomputing it.

 * Define eqCanRewrite :: EqRel -> EqRel -> EqRel, and use it, instead
   of duplicating its logic

21 months agoComments and white space
Simon Peyton Jones [Wed, 18 Oct 2017 14:21:16 +0000 (15:21 +0100)] 
Comments and white space

21 months agoOutputable: Add pprTraceException
Ben Gamari [Thu, 19 Oct 2017 17:25:51 +0000 (13:25 -0400)] 
Outputable: Add pprTraceException

21 months agoAdd Functor Bag instance
Ben Gamari [Thu, 19 Oct 2017 17:25:02 +0000 (13:25 -0400)] 
Add Functor Bag instance

21 months agoUntag the potential AP_STACK in stg_getApStackValzh
James Clarke [Wed, 18 Oct 2017 20:33:28 +0000 (16:33 -0400)] 
Untag the potential AP_STACK in stg_getApStackValzh

If the AP_STACK has been evaluated and a GC has run, the BLACKHOLE
indirection will have been removed, and the StablePtr for the original
AP_STACK referred to be GHCi will therefore now point directly to the
value, and may be tagged. Add a hist002 test for this, and make sure
hist001 doesn't do an idle GC, so the case when it's still a BLACKHOLE
is definitely also tested.

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

21 months agoGive a reference to Foreign.Concurrent.
Edward Z. Yang [Wed, 18 Oct 2017 20:32:17 +0000 (16:32 -0400)] 
Give a reference to Foreign.Concurrent.

Test Plan: none

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoAdded a test for 'timeout' to be accurate.
Tom Sydney Kerckhove [Wed, 18 Oct 2017 20:27:56 +0000 (16:27 -0400)] 
Added a test for 'timeout' to be accurate.

This is the first in a series of regression tests prompted by
https://ghc.haskell.org/trac/ghc/ticket/8684 and D4011, D4012, D4041

Test Plan: This _is_ a test.

Reviewers: nh2, austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #8684

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

21 months agoExpose monotonic time from GHC.Event.Clock
Tom Sydney Kerckhove [Wed, 18 Oct 2017 20:24:46 +0000 (16:24 -0400)] 
Expose monotonic time from GHC.Event.Clock

This diff exposes the monotonic time api from GHC.Event.Clock.

This is necessary for future work on regression tests (#D4074) for
the timeout problems (8684, for example) in #D4041, #D4011, #D4012

Test Plan: Still builds ...

Reviewers: nh2, bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoBump arcanist-external-json-linter submodule
Ben Gamari [Thu, 19 Oct 2017 13:12:00 +0000 (09:12 -0400)] 
Bump arcanist-external-json-linter submodule

21 months agoUser's guide: Fix the category of some flags
Joachim Breitner [Thu, 19 Oct 2017 15:45:19 +0000 (11:45 -0400)] 
User's guide: Fix the category of some flags

so now “7.6.12. Language options” only lists `-X` flags, as it should.

21 months agoExport injectiveVarsOf{Binder,Type} from TyCoRep
Ryan Scott [Thu, 19 Oct 2017 14:21:33 +0000 (10:21 -0400)] 
Export injectiveVarsOf{Binder,Type} from TyCoRep

Summary:
I ended up needing to use the functionality of
`injectiveVarsOfBinder`/`injectiveVarsOfType` in this Haddock PR
(https://github.com/haskell/haddock/pull/681), but alas, neither of
these functions were exported. Let's do so.

Test Plan: Does it compile?

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoFix #14369 by making injectivity warnings finer-grained
Ryan Scott [Thu, 19 Oct 2017 14:21:28 +0000 (10:21 -0400)] 
Fix #14369 by making injectivity warnings finer-grained

Summary:
Previously, GHC would always raise the possibility that a
type family might not be injective in certain error messages, even if
that type family actually //was// injective. Fix this by actually
checking for a type family's lack of injectivity before emitting
such an error message.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14369

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

21 months agoError when deriving instances in hs-boot files
Ryan Scott [Thu, 19 Oct 2017 14:21:17 +0000 (10:21 -0400)] 
Error when deriving instances in hs-boot files

Summary:
According to the GHC users' guide, one cannot derive
instances for data types in `.hs-boot` files.
However, GHC was not enforcing this in practice, which led to
#14365.

Fix this by actually throwing an error if a derived instance is
detected in an `.hs-boot` file (and recommend how to fix it in the
error message.)

Test Plan: make test TEST=T14365

Reviewers: ezyang, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14365

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

21 months agoDisable -XRebindableSyntax when running internal GHCi expressions
Ryan Scott [Thu, 19 Oct 2017 13:50:17 +0000 (09:50 -0400)] 
Disable -XRebindableSyntax when running internal GHCi expressions

Summary:
It's well known that `-XRebindableSyntax` doesn't play
nicely with some of the internal expressions that GHCi runs. #13385
was one example where this problem arose, which was fixed at the time
by simply avoiding the use of `do`-notation in these internal GHCi
expressions. That seemed to work, but it was a technique that proved
not to scale, as #14342 demonstrated //another// example where
`-XRebindableSyntax` can bite.

Instead of delicately arranging the internal GHCi expressions to
avoid anything that might be covered under `-XRebindableSyntax`,
this patch takes the much more direct approach of disabling
`-XRebindableSyntax` entirely when running any internal GHCi
expression. This shouldn't hurt, since nothing internal to GHCi was
taking advantage of the extension in the first place, and moreover,
we can have greater confidence that some other obscure
`-XRebindableSyntax` corner case won't pop up in the future. As an
added bonus, this lets us once again use `do`-notation in the code
that had to be changed when #13385 was (hackily) fixed before.

Test Plan: make test TEST=T14342

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14342

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

21 months agoAccept test output for #14350
Ryan Scott [Thu, 19 Oct 2017 13:49:48 +0000 (09:49 -0400)] 
Accept test output for #14350

21 months agowhitespace only
Gabor Greif [Wed, 18 Oct 2017 09:47:52 +0000 (11:47 +0200)] 
whitespace only

21 months agoTypofix in comment
Gabor Greif [Wed, 18 Oct 2017 06:49:21 +0000 (08:49 +0200)] 
Typofix in comment