ghc.git
2 years agoDsMonad: Collect DPH things
Ben Gamari [Tue, 7 Mar 2017 19:28:30 +0000 (14:28 -0500)] 
DsMonad: Collect DPH things

This is just a bit of reorganization, pulling out the DPH things into a
separate section of the file.

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

2 years agoghc-pkg: Consider .conf files when computing package db mtime
Andrzej Rybczak [Tue, 7 Mar 2017 14:55:02 +0000 (09:55 -0500)] 
ghc-pkg: Consider .conf files when computing package db mtime

We can no longer use the mtime of the containing directory since it now
contains a lock file in addition to the .cache and .conf files.

Fixes #13375.

Test Plan: Validate on Windows

Reviewers: austin, arybczak

Subscribers: rwbarton, thomie

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

2 years agobase: kevent.filter is signed
Ben Gamari [Tue, 7 Mar 2017 14:31:42 +0000 (09:31 -0500)] 
base: kevent.filter is signed

I checked both the FreeBSD and Darwin manpages; it's signed in both cases.
This was producing validation failures on OS X due to the new literal
range-check.

2 years agoGenerate better fp abs for X86 and llvm with default cmm otherwise
Dominic Steinitz [Tue, 7 Mar 2017 14:26:16 +0000 (09:26 -0500)] 
Generate better fp abs for X86 and llvm with default cmm otherwise

Currently we have this in libraries/base/GHC/Float.hs:
```
abs x | x == 0    = 0 -- handles (-0.0)
      | x >  0    = x
      | otherwise = negateFloat x
```
But 3-4 years ago it was noted that this was inefficient:
https://mail.haskell.org/pipermail/libraries/2013-April/019690.html

We can generate better code for X86 and llvm and for others generate
some custom cmm code which is similar to what the compiler generates
now.

Reviewers: austin, simonmar, hvr, bgamari

Reviewed By: bgamari

Subscribers: dfeuer, thomie

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

2 years agoFix comment
Ben Gamari [Tue, 7 Mar 2017 03:43:39 +0000 (22:43 -0500)] 
Fix comment

2 years agoTypos in changelog and comments
Gabor Greif [Mon, 6 Mar 2017 16:53:29 +0000 (17:53 +0100)] 
Typos in changelog and comments

2 years agotestsuite: Disable linkwhole test on Windows
Ben Gamari [Mon, 6 Mar 2017 21:50:28 +0000 (16:50 -0500)] 
testsuite: Disable linkwhole test on Windows

It relies on System.Posix.DynamicLinker, which is not available.

2 years agoprimops: Add comment describing type of atomicModifyMutVar#
Ben Gamari [Mon, 6 Mar 2017 22:31:20 +0000 (17:31 -0500)] 
primops: Add comment describing type of atomicModifyMutVar#

This resolves #13130. It's not entirely clear to me why we don't use an
unboxed tuple here but this is at least better than the status quo.

[skip ci]

Test Plan: Read it

Reviewers: simonmar, austin, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, rwbarton, thomie

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

2 years agoMangle .subsections_via_symbols away.
Moritz Angermann [Mon, 6 Mar 2017 22:31:04 +0000 (17:31 -0500)] 
Mangle .subsections_via_symbols away.

This is a rather stupid mangler hack. However, when using prefix data
with llvm, on systems that support -dead_strip (macOS, iOS), the prefix
data is stipped.

llvm generiously adds .subsections_via_symbols for macho in any case.

Thus we use our trusted mangler to drop the .subsections_via_symbols
line from the assembly.

This ultimately means that for (macOS, llvm), and (iOS, llvm) will not
benefit from -dead_strip. Yet, this patch will allow building ghc on
macOS again.

Test Plan: build ghc with llvm on macOS

Reviewers: rwbarton, bgamari, austin

Reviewed By: rwbarton, bgamari

Subscribers: thomie

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

2 years agoAdd rule mapFB c (λx.x) = c
Joachim Breitner [Mon, 6 Mar 2017 22:30:52 +0000 (17:30 -0500)] 
Add rule mapFB c (λx.x) = c

Test Plan: exended T2110 with a case for that.

Reviewers: austin, hvr, dfeuer, bgamari

Reviewed By: dfeuer

Subscribers: dfeuer, thomie

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

2 years agoA few remarks on role subtyping in the manual.
Edward Z. Yang [Mon, 6 Mar 2017 23:22:37 +0000 (15:22 -0800)] 
A few remarks on role subtyping in the manual.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2 years agoUpdate .mailmap [skip ci]
Matthew Pickering [Mon, 6 Mar 2017 22:43:44 +0000 (22:43 +0000)] 
Update .mailmap [skip ci]

2 years agotestsuite: Add test for #11076
Ben Gamari [Mon, 6 Mar 2017 20:54:20 +0000 (15:54 -0500)] 
testsuite: Add test for #11076

2 years agobase: Kill out-of-date Notes
Ben Gamari [Mon, 6 Mar 2017 20:54:35 +0000 (15:54 -0500)] 
base: Kill out-of-date Notes

These were rendered out-of-date by D1103. Resolves #13174.

2 years agoDisallow unboxed string literals in patterns (#13260)
Rupert Horlick [Mon, 6 Mar 2017 18:44:40 +0000 (13:44 -0500)] 
Disallow unboxed string literals in patterns (#13260)

Signed-off-by: Rupert Horlick <ruperthorlick@gmail.com>
Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoadd example documentation for tuple Applicative
GinBaby [Mon, 6 Mar 2017 18:43:57 +0000 (13:43 -0500)] 
add example documentation for tuple Applicative

Reviewers: austin, hvr, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, thomie

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

2 years agoChanged OverLit warnings to work with negative literals (#13257)
Rupert Horlick [Mon, 6 Mar 2017 18:43:34 +0000 (13:43 -0500)] 
Changed OverLit warnings to work with negative literals (#13257)

Test Plan: Validate, check generated warnings

Reviewers: austin, bgamari, dfeuer

Reviewed By: bgamari, dfeuer

Subscribers: dfeuer, thomie

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

2 years agoAdd GCC bin folder to search path.
Tamar Christina [Mon, 6 Mar 2017 18:42:47 +0000 (13:42 -0500)] 
Add GCC bin folder to search path.

D3155 added pthread by default to GHCi.  However this was only tested
using something running in an msys2 shell. As it turns out it's been
picking up pthread in the environment and not the inplace gcc.

This results in an error when using ghci outside of msys2.

Test Plan: start cmd, start ghc-stage2 --interactive

Reviewers: austin, hvr, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, thomie

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

2 years agoRead COMPLETE sets from external packages
Ben Gamari [Mon, 6 Mar 2017 17:20:06 +0000 (12:20 -0500)] 
Read COMPLETE sets from external packages

Currently, `COMPLETE` pragmas are not read from external packages at
all, which quite limits their usefulness. This extends
`ExternalPackageState` to include `COMPLETE` sets from other packages,
and plumbs around the appropriate values to make it work the way you'd
expect it to.

Requires a `binary` submodule update.

Fixes #13350.

Test Plan: make test TEST=T13350

Reviewers: rwbarton, mpickering, austin, simonpj, bgamari

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

2 years agoAdd -dno-debug-output to validate GhcStage1HcOpts
Matthew Pickering [Sat, 4 Mar 2017 21:52:05 +0000 (16:52 -0500)] 
Add -dno-debug-output to validate GhcStage1HcOpts

This flag only affects whether WARNs are printed to the build log.
ASSERT fails will still be printed and cause an abort.

Most of the WARNs in the compiler are speculative and meant to help with
debugging rather than indicative of any real errors. This causes
a lot of noise in the build log which is not helpful and makes them very
long.

Test Plan: Check that the build log is less than 27000 lines long

Reviewers: austin, bgamari, rwbarton

Reviewed By: bgamari

Subscribers: thomie, snowleopard

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

2 years agoAdd SplitSections = NO to build flavors with SplitObjs = NO
Reid Barton [Sat, 4 Mar 2017 21:49:37 +0000 (16:49 -0500)] 
Add SplitSections = NO to build flavors with SplitObjs = NO

Test Plan: harbormaster

Reviewers: nomeata, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, snowleopard

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

2 years agoTypos in comments and manual
Gabor Greif [Mon, 6 Mar 2017 15:55:42 +0000 (16:55 +0100)] 
Typos in comments and manual

2 years agoMake FloatOut/SetLevels idemoptent on bottoming functions
Simon Peyton Jones [Fri, 3 Mar 2017 16:10:06 +0000 (16:10 +0000)] 
Make FloatOut/SetLevels idemoptent on bottoming functions

This fixes Trac #13369.  It turned out that I really had got the
bottoming-float code wrong, again.  The new story is explained in
Note [Bottoming floats], esp item (3), and Note [Floating from a RHS].

I didn't make a regression test; it's hard to to so.

Nofib result are good

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
         banner          -2.2%     -4.6%      0.00      0.00     +0.0%
           bspt          -1.3%     -1.6%      0.01      0.01     +0.0%
      cacheprof          -1.8%     -0.3%     +3.7%     +3.7%     -0.9%
   digits-of-e2          -1.0%     -1.5%     -0.5%     -0.5%     +0.0%
         expert          -1.3%     -0.2%      0.00      0.00     +0.0%
         n-body          -1.1%     -0.2%     +0.1%     +0.1%     +0.0%
        veritas          -2.9%     -0.1%      0.00      0.00     +0.0%
--------------------------------------------------------------------------------
            Min          -2.9%     -4.6%     -7.4%     -7.4%    -19.8%
            Max          -1.0%     +0.0%     +5.2%     +5.1%    +10.0%
 Geometric Mean          -1.2%     -0.1%     +0.5%     +0.5%     -0.1%

I /think/ all this is due to this error-floating change; but it's possible
that some was due to commit "Fix CSE (again) on literal strings" a couple
of commits earlier.

2 years agoComments only
Simon Peyton Jones [Fri, 3 Mar 2017 12:51:46 +0000 (12:51 +0000)] 
Comments only

2 years agoTiny refactor
Simon Peyton Jones [Fri, 3 Mar 2017 12:51:21 +0000 (12:51 +0000)] 
Tiny refactor

2 years agoMake TH_Roles2 less fragile
Simon Peyton Jones [Fri, 3 Mar 2017 11:00:59 +0000 (11:00 +0000)] 
Make TH_Roles2 less fragile

We need -dsuppress-uniques else this test keeps failing spuriously

2 years agoFix CSE (again) on literal strings
Simon Peyton Jones [Fri, 3 Mar 2017 11:00:04 +0000 (11:00 +0000)] 
Fix CSE (again) on literal strings

Fixes Trac #13367.  See Note [Take care with literal strings]

2 years agoDrop HAVE_containers_050 from bootstrap flags
Ben Gamari [Sat, 4 Mar 2017 21:04:37 +0000 (16:04 -0500)] 
Drop HAVE_containers_050 from bootstrap flags

Cabal now sets this itself if MIN_VERSION_containers isn't defined.

2 years agoReexport CmpNat and friends (defined in GHC.TypeNats) from GHC.TypeLits
Ryan Scott [Sat, 4 Mar 2017 02:18:01 +0000 (21:18 -0500)] 
Reexport CmpNat and friends (defined in GHC.TypeNats) from GHC.TypeLits

Previously, there were identical copies of `CmpNat`, `(<=?)`, `(+)`,
etc. spread across `GHC.TypeLits` and `GHC.TypeNats`. This makes
`GHC.TypeNats` the canonical home for them, and reexports them from
`GHC.TypeLits` to avoid confusion.

Test Plan: ./validate

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: thomie, phadej

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

2 years agoFixes a spaceleak in `maximumBy` and `minimumBy` (#10830).
Ryan Scott [Fri, 3 Mar 2017 22:49:35 +0000 (17:49 -0500)] 
Fixes a spaceleak in `maximumBy` and `minimumBy` (#10830).

This involved changing the implementation from using
`foldr11` to using `foldl1`.

Test Plan: validate

Reviewers: austin, hvr, bgamari, dalaing, dfeuer

Reviewed By: bgamari

Subscribers: RyanGlScott, dfeuer, thomie

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

2 years agotestsuite: Bump down allocations for T4029
Ben Gamari [Sat, 4 Mar 2017 20:09:50 +0000 (15:09 -0500)] 
testsuite: Bump down allocations for T4029

Previously I only updated the comment in one case.

2 years agotestsuite: Add expected output for T8848
Ben Gamari [Sat, 4 Mar 2017 20:09:17 +0000 (15:09 -0500)] 
testsuite: Add expected output for T8848

2 years agoconfigure: Don't pass GHC's sanitized triple to libraries' configure
Ben Gamari [Fri, 3 Mar 2017 22:48:50 +0000 (17:48 -0500)] 
configure: Don't pass GHC's sanitized triple to libraries' configure

Reviewers: hvr, rwbarton, austin

Subscribers: thomie, danharaj, erikd

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

2 years agoUpdate dangling Note reference
Joachim Breitner [Wed, 1 Mar 2017 01:29:22 +0000 (17:29 -0800)] 
Update dangling Note reference

2 years agotestsuite: Fix double test of +Infinity
Ben Gamari [Fri, 3 Mar 2017 22:45:04 +0000 (17:45 -0500)] 
testsuite: Fix double test of +Infinity

The second set was supposed to be a NaN.

2 years agoFix a tiny typo
Ingo Blechschmidt [Fri, 3 Mar 2017 21:46:08 +0000 (22:46 +0100)] 
Fix a tiny typo

2 years agotestsuite: Add a NaN case to numrun015
Ben Gamari [Fri, 3 Mar 2017 22:32:23 +0000 (17:32 -0500)] 
testsuite: Add a NaN case to numrun015

2 years agotestsuite: Bump down allocations of T4029
Ben Gamari [Fri, 3 Mar 2017 21:34:52 +0000 (16:34 -0500)] 
testsuite: Bump down allocations of T4029

2 years agoAdd test to ensure that SPEC rules are named deterministically
Ben Gamari [Fri, 3 Mar 2017 20:50:41 +0000 (15:50 -0500)] 
Add test to ensure that SPEC rules are named deterministically

Test Plan: Validate

Reviewers: niteria, austin, dfeuer

Reviewed By: dfeuer

Subscribers: simonpj, thomie

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

2 years agoAllow iOS to load archives through the linker
Moritz Angermann [Fri, 3 Mar 2017 20:50:01 +0000 (15:50 -0500)] 
Allow iOS to load archives through the linker

This basically just adds ios where darwin already was, and is just one
of the pieces for the rts linker support for ios (aarch64-macho)

---

The following diagram and legend tries to explain the dependencies a
bit:
```
  .- This
  v
D3255 <- D3252 <- D3251 <- D3239
  ^
  '- D3238
```

- In D3238 we started allowing preloading object code with mmap
  in iOS, where we can't have r+w+x.
- In D3239 we introduced a richer extension of the object code
  data type to make working with mach-o files easier.
- In D3240 we set the stage to allow loading archives (.a) on iOS
- In D3251 we added init and deinit functions to populate and
  depopulate the enriched object code data structure for mach-o
  files.
- In D3252 we refactored most of the MachO.c file to use the
  new types and data structure.
- in D3255 we finally introduce the aarch64-mach-o linker.

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: bgamari

Subscribers: thomie, ryantrinkle

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

2 years agoComments only, in CSE (#13340)
Reid Barton [Fri, 3 Mar 2017 20:49:51 +0000 (15:49 -0500)] 
Comments only, in CSE (#13340)

Reviewers: simonpj, austin, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: thomie

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

2 years agoDeserialize IfaceId more lazily
Reid Barton [Fri, 3 Mar 2017 20:49:38 +0000 (15:49 -0500)] 
Deserialize IfaceId more lazily

This change sped up the total validate --build-only time by 0.8%
on my test system; hopefully a representative result.

I didn't bother making the other constructors lazy because for
IfaceData and IfaceClass we need to pull on some of the fields
in loadDecl, and all the others seem much more rare than IfaceId.

Test Plan: validate, perf

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agotestsuite: Add test for floating-point abs (numrun015)
Ben Gamari [Fri, 3 Mar 2017 20:49:14 +0000 (15:49 -0500)] 
testsuite: Add test for floating-point abs (numrun015)

Test Plan: Validate

Reviewers: idontgetoutmuch, austin

Subscribers: thomie

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

2 years agoProduce KindReps for common kinds in GHC.Types
Ben Gamari [Fri, 3 Mar 2017 20:47:47 +0000 (15:47 -0500)] 
Produce KindReps for common kinds in GHC.Types

Unfortunately this comes with a fair bit of implementation cost. Perhaps
some refactoring would help, but in the interest of getting 8.2 out the
door I'm pushing as-is.

While this doesn't have nearly the effect on compiler allocations
that D3166 has, it's still nothing to sneeze at. nofib shows,
```
------------------------------------------------------------------------
        Program               master           D3166            D3219
------------------------------------------------------------------------
        -1 s.d.                -----          -3.555%          -4.081%
        +1 s.d.                -----          +1.937%          +1.593%
        Average                -----          -0.847%          -1.285%
```

Test Plan: Validate

Reviewers: austin

Subscribers: thomie, simonmar

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

2 years agoTcTypeable: Try to reuse KindReps
Ben Gamari [Fri, 3 Mar 2017 19:39:00 +0000 (14:39 -0500)] 
TcTypeable: Try to reuse KindReps

Here we rework the TcTypeable implementation to reuse KindRep bindings
when possible. This is an attempt at minimizing the impact of Typeable
binding generation by reducing the number of bindings that we produce.

It turns out that this produces some pretty reasonable compiler
allocations improvements. It seems to erase most of the increases
initially introduced by TTypeable in the testsuite. Moreover, nofib
shows,
```
        -1 s.d.                -----          -3.555%
        +1 s.d.                -----          +1.937%
        Average                -----          -0.847%
```

Here are a few of the high-scorers (ignore last column, which is for
D3219),
```
veritas
          Types             88800920         -18.945%         -21.480%

veritas
        Tactics            540766744         -27.256%         -27.338%

sched
           Main            567013384          -4.947%          -5.358%

listcompr
           Main            532300000          -4.273%          -4.572%

listcopy
           Main            537785392          -4.382%          -4.635%

anna
       BaseDefs           1984225032         -10.639%         -10.832%

```
as expected, these tend to be modules with either very many or very
large types.

Test Plan: Validate

Reviewers: austin, dfeuer

Subscribers: simonmar, dfeuer, thomie

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

2 years agotestsuite: Add comment clarifying intention of completesig04
Ben Gamari [Fri, 3 Mar 2017 16:33:24 +0000 (11:33 -0500)] 
testsuite: Add comment clarifying intention of completesig04

2 years agotestsuite: Bump down allocations for T12707
Ben Gamari [Fri, 3 Mar 2017 16:21:38 +0000 (11:21 -0500)] 
testsuite: Bump down allocations for T12707

2 years agoUpdate test completesig04
Reid Barton [Fri, 3 Mar 2017 14:50:50 +0000 (09:50 -0500)] 
Update test completesig04

It relied on an orphan COMPLETE pragma, so was broken by commit fce3d37c3.

Test Plan: validate

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoRevert "Read COMPLETE sets from external packages"
Ben Gamari [Fri, 3 Mar 2017 15:03:18 +0000 (10:03 -0500)] 
Revert "Read COMPLETE sets from external packages"

This reverts commit 0d2f733050ff656b827351108d988e09abc363fc.

2 years agotestsuite: Fix output due to recent COMPLETE changes
Ben Gamari [Fri, 3 Mar 2017 02:34:51 +0000 (21:34 -0500)] 
testsuite: Fix output due to recent COMPLETE changes

It's unclear why this didn't show up in my initial local validation. Oh
well.

2 years agoRead COMPLETE sets from external packages
Ryan Scott [Fri, 3 Mar 2017 01:16:28 +0000 (20:16 -0500)] 
Read COMPLETE sets from external packages

Currently, `COMPLETE` pragmas are not read from external packages at
all, which quite limits their usefulness. This extends
`ExternalPackageState` to include `COMPLETE` sets from other packages,
and plumbs around the appropriate values to make it work the way you'd
expect it to.

Fixes #13350.

Test Plan: make test TEST=T13350

Reviewers: rwbarton, mpickering, austin, simonpj, bgamari

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

2 years agoShow: Add ShowS for ", "
Ben Gamari [Thu, 2 Mar 2017 23:37:23 +0000 (18:37 -0500)] 
Show: Add ShowS for ", "

This is produced often enough in derived Show instances that it is likely
worthwhile defining it once.

2 years agotestsuite: Move echoing commands in make invocations to VERBOSE=5
Reid Barton [Thu, 2 Mar 2017 21:39:16 +0000 (16:39 -0500)] 
testsuite: Move echoing commands in make invocations to VERBOSE=5

D2894 added a new verbosity level VERBOSE=4 to strip -s/--silent
flags from make invocations in test commands. This will probably
cause the test to fail of course, but is useful for seeing what
a test that's already failing is doing.

However there was already an undocumented meaning of VERBOSE=4,
added in commit cfeededf, that causes the results of performance
tests to be printed unconditionally (even when they are within the
expected range). nomeata's ghc builder uses these figures to
collect historical data on performance test figures. The new
meaning of VERBOSE=4 added in D2894 means that any test that uses
make now fails on the builder.

This commit moves the new behavior of D2894 to the level VERBOSE=5
so that nomeata's ghc builder again produces useful results on
failing tests. It also adds documentation for both settings.

Test Plan: did some manual testing

Reviewers: austin, bgamari, Phyx, nomeata

Reviewed By: bgamari, Phyx

Subscribers: nomeata, thomie, Phyx

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

2 years agoChanged parser message for RankNTypes (#12811)
Rupert Horlick [Thu, 2 Mar 2017 21:35:53 +0000 (16:35 -0500)] 
Changed parser message for RankNTypes (#12811)

Added a check for whether RankNTypes is enabled
and changed error message accordingly

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, mpickering

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

2 years agoAdd suggestion for PatternSynonyms parse error (fixes #12429)
Rupert Horlick [Thu, 2 Mar 2017 21:35:31 +0000 (16:35 -0500)] 
Add suggestion for PatternSynonyms parse error (fixes #12429)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoDon't float out expressions that are okay for speculation
Reid Barton [Thu, 2 Mar 2017 21:30:52 +0000 (16:30 -0500)] 
Don't float out expressions that are okay for speculation

It turned out not to be worth the overhead according to nofib
(+11.62% on fannkuch-redux, +4.3% on k-nucleotide, and some other
smaller losses, with no significant gains).

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

2 years agoFix up test results.
David Feuer [Thu, 2 Mar 2017 21:30:33 +0000 (16:30 -0500)] 
Fix up test results.

Set up test results and Makefile as SPJ intended (I believe).
Previous changes accidentally did something a bit different.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoDon't allow orphan COMPLETE pragmas (#13349)
Reid Barton [Thu, 2 Mar 2017 21:29:55 +0000 (16:29 -0500)] 
Don't allow orphan COMPLETE pragmas (#13349)

We might support them properly in the future, but for now it's simpler
to disallow them.

Test Plan: validate

Reviewers: mpickering, austin, bgamari, simonpj

Reviewed By: mpickering, simonpj

Subscribers: simonpj, thomie

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

2 years agoPrint out sub-libraries of packages more nicely.
Edward Z. Yang [Thu, 2 Mar 2017 21:27:32 +0000 (16:27 -0500)] 
Print out sub-libraries of packages more nicely.

Previously, we would print out the munged package name
which looked like z-bkpcabal01-z-p-0.1.0.0.  Now
it looks like: bkpcabal01-0.1.0.0:p.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, bgamari, austin

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoAdd -fwhole-archive-hs-libs
Simon Marlow [Thu, 2 Mar 2017 21:17:12 +0000 (16:17 -0500)] 
Add -fwhole-archive-hs-libs

We're building a demo to show how to hot-swap Haskell code in a
running process, and unfortunately it wasn't possible to convince GHC
to generate the correct linker command line without this extra knob.

Test Plan:
Tested it on a hot-swapping demo (which is not released yet, but will
be shortly)

Reviewers: niteria, austin, erikd, JonCoens, bgamari

Reviewed By: bgamari

Subscribers: Phyx, rwbarton, thomie

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

2 years agoFix T12234 stat mistakes
David Feuer [Fri, 3 Mar 2017 00:02:02 +0000 (19:02 -0500)] 
Fix T12234 stat mistakes

I goofed up updating the expected and recent historical results
here. They should be right now.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoTypofix.
Edward Z. Yang [Wed, 1 Mar 2017 22:21:48 +0000 (14:21 -0800)] 
Typofix.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2 years agoPrevent users from defining instances for abstract classes.
Edward Z. Yang [Wed, 1 Mar 2017 08:11:43 +0000 (00:11 -0800)] 
Prevent users from defining instances for abstract classes.

Summary:
Fixes #13068.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

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

2 years agoFix roles merging to apply only to non-rep-injective types.
Edward Z. Yang [Wed, 1 Mar 2017 07:55:00 +0000 (23:55 -0800)] 
Fix roles merging to apply only to non-rep-injective types.

Test Plan: validate

Reviewers: simonpj

Subscribers:

2 years agoProperly represent abstract classes in Class and IfaceDecl
Edward Z. Yang [Tue, 28 Feb 2017 07:48:30 +0000 (23:48 -0800)] 
Properly represent abstract classes in Class and IfaceDecl

Summary:
Previously, abstract classes looked very much like normal
classes, except that they happened to have no methods,
superclasses or ATs, and they came from boot files.  This
patch gives abstract classes a proper representation in
Class and IfaceDecl, by moving the things which are never
defined for abstract classes into ClassBody/IfaceClassBody.

Because Class is abstract, this change had ~no disruption
to any of the code in GHC; if you ask about the methods of
an abstract class, we'll just give you an empty list.

This also fixes a bug where abstract type classes were incorrectly
treated as representationally injective (they're not!)

Fixes #13347, and a TODO in the code.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, bgamari, austin

Subscribers: goldfire, thomie

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

2 years agoInjective type families imply nominal injectivity, but NOT rep inj
Edward Z. Yang [Mon, 27 Feb 2017 05:10:15 +0000 (21:10 -0800)] 
Injective type families imply nominal injectivity, but NOT rep inj

Test Plan: validate

Reviewers: simonpj, austin, jstolarek, bgamari, goldfire

Subscribers: thomie

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

2 years agoDisallow non-nullary constraint synonyms on class.
Edward Z. Yang [Mon, 27 Feb 2017 23:52:27 +0000 (15:52 -0800)] 
Disallow non-nullary constraint synonyms on class.

Test Plan: validate

Reviewers: simonpj, bgamari, austin

Subscribers: thomie

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

2 years agoMore comments on role subtyping, unsoundness fix.
Edward Z. Yang [Mon, 27 Feb 2017 04:15:30 +0000 (20:15 -0800)] 
More comments on role subtyping, unsoundness fix.

Summary:
- We incorrectly allowed subroling on injective data in
  some cases. There is now a test to check for this case, and a Note.

- More commentary on how the subtyping with roles works.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: goldfire, austin, simonpj, bgamari

Subscribers: thomie

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

2 years agoExtend Windows runtime loader libsearch
Tamar Christina [Thu, 2 Mar 2017 20:14:34 +0000 (15:14 -0500)] 
Extend Windows runtime loader libsearch

This adds `.obj` extension to the list of valid
object file (we really shouldn't be using extensions
but instead trying to read the file and see if the header
makes sense.). Microsoft compilers use .obj instead of .o
for object files.

This also adds support to finding static archives when the
"lib" prefix is already in the filename. e.g. `-llibfoo` to
find `libfoo.a`. This is inline with binutils.

Test Plan: ./validate

Reviewers: simonmar, erikd, bgamari, hvr, austin

Reviewed By: bgamari

Subscribers: RyanGlScott, thomie, #ghc_windows_task_force

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

2 years agoProhibit RULES changing constructors
David Feuer [Thu, 2 Mar 2017 20:01:26 +0000 (15:01 -0500)] 
Prohibit RULES changing constructors

Previously, `RULES` like

```
{-# RULES
"JustNothing" forall x . Just x = Nothing
 #-}
```

were allowed. Simon Peyton Jones say this seems to have been a
mistake, that such rules have never been supported intentionally,
and that he doesn't know if they can break in horrible ways.
Furthermore, Ben Gamari and Reid Barton are considering trying to
detect the presence of "static data" that the simplifier doesn't
need to traverse at all. Such rules do not play well with that.
So for now, we ban them altogether. In most cases, it's possible
to work around the ban using hand-written wrapper functions.

Reviewers: austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

2 years agoEliminate ListSetOps from imp_trust_pkgs
David Feuer [Thu, 2 Mar 2017 18:45:27 +0000 (13:45 -0500)] 
Eliminate ListSetOps from imp_trust_pkgs

Eliminate ListSetOps from imp_trust_pkgs and imp_dep_pkgs

Replace Map with NameEnv in TmOracle

Reviewers: austin, dfeuer, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoUser manual: Fix GADT paper link
Ömer Sinan Ağacan [Thu, 2 Mar 2017 19:44:56 +0000 (22:44 +0300)] 
User manual: Fix GADT paper link

2 years agotestsuite: Mark T13340 as fixed
Ben Gamari [Thu, 2 Mar 2017 18:09:30 +0000 (13:09 -0500)] 
testsuite: Mark T13340 as fixed

It was fixed by 55efc9718b520ef354e32c15c4b49cdfecce412f

2 years agoProperly acquire locks on not yet existing package databases
Andrzej Rybczak [Thu, 2 Mar 2017 16:26:09 +0000 (11:26 -0500)] 
Properly acquire locks on not yet existing package databases

Reviewers: austin, bgamari, angerman

Reviewed By: bgamari, angerman

Subscribers: angerman, thomie

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

2 years agoSymbolExtras: A bit of spring cleaning
Ben Gamari [Thu, 2 Mar 2017 16:20:12 +0000 (11:20 -0500)] 
SymbolExtras: A bit of spring cleaning

Const-hygiene and use bool when possible.

2 years agoTypeable: Rename KindRep bindings to $krep...
Ben Gamari [Wed, 1 Mar 2017 16:29:10 +0000 (11:29 -0500)] 
Typeable: Rename KindRep bindings to $krep...

2 years agoBump bytes allocated for T12234
David Feuer [Thu, 2 Mar 2017 16:30:48 +0000 (11:30 -0500)] 
Bump bytes allocated for T12234

Reviewers: austin, bgamari

Subscribers: mpickering, thomie

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

2 years agoFix expected result from T13143
David Feuer [Thu, 2 Mar 2017 16:29:39 +0000 (11:29 -0500)] 
Fix expected result from T13143

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoDocument interaction between ApplicativeDo and existentials (#13242)
Simon Marlow [Wed, 1 Mar 2017 14:47:24 +0000 (14:47 +0000)] 
Document interaction between ApplicativeDo and existentials (#13242)

Test Plan: validate

Reviewers: austin, bgamari, erikd

Subscribers: thomie

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

2 years agoUpgrade UniqSet to a newtype
David Feuer [Wed, 1 Mar 2017 18:47:39 +0000 (13:47 -0500)] 
Upgrade UniqSet to a newtype

The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet`
has a key invariant `UniqFM` does not. For example, `fmap` over
`UniqSet` will generally produce nonsense.

* Upgrade `UniqSet` from a type synonym to a newtype.

* Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`.

* Use cached unique in `tyConsOfType` by replacing
  `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`.

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

Reviewed By: niteria

Subscribers: thomie

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

2 years agoChange catch# demand signature
David Feuer [Wed, 1 Mar 2017 06:14:13 +0000 (01:14 -0500)] 
Change catch# demand signature

* Give `catch#` a lazy demand signature, to make it more honest.

* Make `catchException` and `catchAny` force their arguments so they
actually behave as advertised.

* Use `catch` rather than `catchException` in `forkIO`, `forkOn`, and
`forkOS` to avoid losing exceptions.

Fixes #13330

Reviewers: rwbarton, simonpj, simonmar, bgamari, hvr, austin

Subscribers: thomie

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

2 years agorts: Fix build
Ben Gamari [Wed, 1 Mar 2017 03:40:35 +0000 (22:40 -0500)] 
rts: Fix build

I evidently neglected to consider that validate doesn't build profiled
ways. Arg.

2 years agoUpdate containers again
David Feuer [Wed, 1 Mar 2017 03:27:14 +0000 (22:27 -0500)] 
Update containers again

submodule update

Get the version with `COMPLETE` pragmas for `Data.Sequence`.

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoMove isJoinId, isJoinId_maybe to Id
Simon Peyton Jones [Wed, 1 Mar 2017 01:39:02 +0000 (20:39 -0500)] 
Move isJoinId, isJoinId_maybe to Id

This is just a refactoring, moving these two functions where
they belong.

The reason they were there was because of the use of isJoinId_maybe
in the OutputableBndr instance of TaggedBndr, which was in CoreSyn.
I moved it to PprCore, to join the OutputableBndr instance for
Var.  That makes more sense anyway.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoMark non-recursive join lambdas as one-shot
Simon Peyton Jones [Wed, 1 Mar 2017 01:25:33 +0000 (20:25 -0500)] 
Mark non-recursive join lambdas as one-shot

When we have

  join j x y = rhs in ...

we know that the lambdas for 'x' and 'y' are one-shot.
Let's mark them as such!

This doesn't fix a specific bug, but it feels right to me.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: lukemaurer, thomie

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

2 years agoImprove SetLevels for join points
Simon Peyton Jones [Wed, 1 Mar 2017 01:23:15 +0000 (20:23 -0500)] 
Improve SetLevels for join points

C.f. Trac #13286, #13236

* Never destroy a join point unless it goes to top level
  See Note [Floating join point bindings]

* Never float a MFE if it has a free join variable
  Note [Free join points]

* Stop treating nullary join points specially

* Enforce the invariant that le_join_ceil >= le_ctxt_lvl
  (Needs more thought...)

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoImprove pretty-printing of types
Simon Peyton Jones [Wed, 1 Mar 2017 01:20:21 +0000 (20:20 -0500)] 
Improve pretty-printing of types

When doing debug-printing it's really important that the free vars
of a type are printed with their uniques.  The IfaceTcTyVar thing
was a stab in that direction, but it only worked for TcTyVars, not
TyVars.

This patch does it properly, by keeping track of the free vars of the
type when translating Type -> IfaceType, and passing that down through
toIfaceTypeX.  Then when we find a variable, look in that set, and
translate it to IfaceFreeTyVar if so.  (I renamed IfaceTcTyVar to
IfaceFreeTyVar.)

Fiddly but not difficult.

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoAdd VarSet.anyDVarSet, allDVarSet
Simon Peyton Jones [Wed, 1 Mar 2017 01:17:10 +0000 (20:17 -0500)] 
Add VarSet.anyDVarSet, allDVarSet

I need these in a later commit.

Also rename
  varSetAny  -->  anyVarSet
  varSetAll  -->  allVarSet
for consistency with other functions; eg filterVarSet

Reviewers: austin, goldfire, bgamari

Subscribers: niteria, thomie

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

2 years agoFix redundant import in CSE
David Feuer [Wed, 1 Mar 2017 00:46:35 +0000 (19:46 -0500)] 
Fix redundant import in CSE

2 years agoThe Early Inline Patch
Simon Peyton Jones [Tue, 28 Feb 2017 21:07:20 +0000 (16:07 -0500)] 
The Early Inline Patch

This very small patch switches on sm_inline even in the InitialPhase
(aka "gentle" phase).   There is no reason not to... and the results
are astonishing.

I think the peformance of GHC itself improves by about 5%; and some
programs get much smaller, quicker.  Result: across the board
irmprovements in
compile time performance.  Here are the changes in perf/compiler;
the numbers are decreases in compiler bytes-allocated:

  3%   T5837
  7%   parsing001
  9%   T12234
  35%  T9020
  9%   T3064
  13%  T9961
  20%  T13056
  5%   T9872d
  5%   T9872c
  5%   T9872b
  7%   T9872a
  5%   T783
  35%  T12227
  20%  T1969

Plus in perf/should_run

  5%   lazy-bs-alloc

It wasn't as easy as it sounds: I did a raft of preparatory work in
earlier patches.  But it's great!

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoCombine identical case alternatives in CSE
Simon Peyton Jones [Tue, 28 Feb 2017 21:00:49 +0000 (16:00 -0500)] 
Combine identical case alternatives in CSE

See Note [Combine case alternatives] in CSE.  This opportunity
surfaced when I was was studying early inlining.  It's easy (and
cheap) to exploit, and sometimes makes a worthwhile saving.

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agotestsuite: Bump down T5837 and T10370 allocations
Ben Gamari [Tue, 28 Feb 2017 19:32:52 +0000 (14:32 -0500)] 
testsuite: Bump down T5837 and T10370 allocations

2 years agoTry submodule bumps again
Ben Gamari [Tue, 28 Feb 2017 16:20:13 +0000 (11:20 -0500)] 
Try submodule bumps again

Bumps containers, time, and unix submodules.

This reverts commit c347a121b07d22fb91172337407986b6541e319d.

2 years agoAdd COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms
Ryan Scott [Tue, 28 Feb 2017 16:11:48 +0000 (11:11 -0500)] 
Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms

When programming with the pattern synonyms for `TypeRep`, I noticed that
I was receiving spurious non-exhaustive pattern-match warnings.  This
can be easily fixed by adding `COMPLETE` pragmas for them.

Moreover, there's another pattern synonym in `base`: `ErrorCall`. In
fact, in the original ticket for `COMPLETE` pragmas (#8779), someone
requested that `ErrorCall` be given a `COMPLETE` pragma as well
(https://ghc.haskell.org/trac/ghc/ticket/8779#comment:21).  I decided to
do that as well while I was in town.

Reviewers: bgamari, mpickering, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoDrop copy step from the rts/ghc.mk
Moritz Angermann [Tue, 28 Feb 2017 16:09:22 +0000 (11:09 -0500)] 
Drop copy step from the rts/ghc.mk

Recently I've used a different build system for building the
rts (Xcode).  And in doing so, I looked through the rts/ghc.mk
to figure out how to build the rts.

In general it's quite straight forward to just compile all the
c files with the proper flags.

However there is one rather awkward copy step that copies some
files for special handling for the rts way.

I'm wondering if the proposed solution in this diff is better
or worse than the current situation?

The idea is to keep the files, but use #includes to produce
identical files with just an additional define. It does however
produce empty objects for non threaded ways.

Reviewers: ezyang, bgamari, austin, erikd, simonmar, rwbarton

Reviewed By: bgamari, simonmar, rwbarton

Subscribers: rwbarton, thomie, snowleopard

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

2 years agoImprove documentation for CreateBCOs Message.
Moritz Angermann [Tue, 28 Feb 2017 16:08:55 +0000 (11:08 -0500)] 
Improve documentation for CreateBCOs Message.

After falling over the CreateBCOs message, and expecting it to contain
ByteStrings encoding `ResolvedBCO`s instead of `[ResolvedBCO]`s, when
deubbing issues with iserv, I'd like to extend the documentation here
a bit, so the next one won't fall over it.

Reviewers: simonmar, austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoiOS: shared objects have .dylib extension.
Moritz Angermann [Tue, 28 Feb 2017 16:07:45 +0000 (11:07 -0500)] 
iOS: shared objects have .dylib extension.

Reviewers: austin, rwbarton, bgamari

Reviewed By: rwbarton

Subscribers: thomie

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

2 years agoconfig.mk.in: Disable terminfo support on iOS
Ben Gamari [Tue, 28 Feb 2017 16:01:01 +0000 (11:01 -0500)] 
config.mk.in: Disable terminfo support on iOS

Test Plan: Validate

Reviewers: angerman, austin, rwbarton

Subscribers: thomie, snowleopard

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

2 years agoInline data constructor wrappers in phase 2 only
Simon Peyton Jones [Tue, 28 Feb 2017 19:04:40 +0000 (14:04 -0500)] 
Inline data constructor wrappers in phase 2 only

This patch prepares for my upcoming early-inlining patch. It arranges
that data constructor wrappers are not inlined until Phase 2 (the
first of the "normal" phases.)  That gives rules a chance to fire
in the InitialPhase (aka "gentle").

This has been a bit of a problem for a while, so it's nice to have
a fix.  It should make no difference immediately, becuase currently
nothing is inlined in the InitialPhase anyway.

Reviewers: austin, bgamari

Subscribers: thomie

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

2 years agoMake Specialise work with casts
Simon Peyton Jones [Tue, 28 Feb 2017 17:11:33 +0000 (12:11 -0500)] 
Make Specialise work with casts

With my upcoming early-inlining patch it turned out that Specialise
was getting stuck on casts.  This patch fixes it; see Note
[Account for casts in binding] in Specialise.

Reviewers: austin, goldfire, bgamari

Subscribers: thomie

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