ghc.git
2 years agoconfigure.ac: Bump version to 8.3 ghc-8.3-start
Ben Gamari [Thu, 9 Mar 2017 18:01:03 +0000 (13:01 -0500)] 
configure.ac: Bump version to 8.3

Bumps haddock submodule

2 years agoFix typo in base changelog
Ryan Scott [Thu, 9 Mar 2017 23:10:56 +0000 (18:10 -0500)] 
Fix typo in base changelog

Replace `Data.Reflection` with `Type.Reflection`.

2 years agoData.Typeable: Export splitTyConApp, typeRepArgs, and typeRepTyCon
Ben Gamari [Thu, 9 Mar 2017 21:20:38 +0000 (16:20 -0500)] 
Data.Typeable: Export splitTyConApp, typeRepArgs, and typeRepTyCon

Test Plan: Validate

Reviewers: austin, hvr, RyanGlScott

Subscribers: rwbarton, thomie

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

2 years agoconfigure.ac: Ensure that we handle case of non-present --target
Ben Gamari [Thu, 9 Mar 2017 21:19:56 +0000 (16:19 -0500)] 
configure.ac: Ensure that we handle case of non-present --target

@rwbarton pointed out that this could be an issue during review, but I
assumed from my point sample of three test builds that this wouldn't be
necessary.  Sadly, none of these builds were on Windows, which indeed
does fail.

Strangely, only Simon and Harbormaster have been able to replicate the
issue (which apparently manifests as libffi thinking it's building for
unix).  I've been completely unable to replicate the failure in my own
builds, neither locally nor on the Harbormaster machine.

Test Plan: Validate on Windows

Reviewers: austin, Phyx, hvr

Reviewed By: Phyx

Subscribers: thomie, rwbarton, erikd

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

2 years agoFix test results for T13380
David Feuer [Thu, 9 Mar 2017 21:01:50 +0000 (16:01 -0500)] 
Fix test results for T13380

They were `expect_broken` without any output. Add the actual
output and remove the `expect_broken`.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoRevert "configure.ac: Bump version to 8.3"
Ben Gamari [Thu, 9 Mar 2017 17:59:16 +0000 (12:59 -0500)] 
Revert "configure.ac: Bump version to 8.3"

This reverts commit 5dce2160a1b361eba7d0109d314246c8ec97878b as it
didn't build.

2 years agointegerConstantFolding: no longer broken with -DDEBUG (#1106)
Joachim Breitner [Thu, 9 Mar 2017 17:13:32 +0000 (18:13 +0100)] 
integerConstantFolding: no longer broken with -DDEBUG (#1106)

2 years agoconfigure.ac: Bump version to 8.3
Ben Gamari [Thu, 9 Mar 2017 15:48:13 +0000 (10:48 -0500)] 
configure.ac: Bump version to 8.3

2 years agollvm backend: Put string constants in .rodata.str.* sections (#13265)
Reid Barton [Thu, 9 Mar 2017 15:42:49 +0000 (10:42 -0500)] 
llvm backend: Put string constants in .rodata.str.* sections (#13265)

The .cstring.* sections don't get merged by the linker (bfd or gold).
That's bad, and especially bad in #13265 where it caused the number of
sections to exceed what is apparently an internal limit in ld.bfd.

Test Plan:
I can only test this on Linux, and I am guessing at what
the correct behavior is on Mac OS and Windows (and AIX I suppose).
Testers on other platforms would be much appreciated, though I
understand that the LLVM backend is broken on Mac OS currently for
other reasons (#13378).

Reviewers: olsner, austin, xnyhps, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoMake raiseIO# produce topRes
David Feuer [Thu, 9 Mar 2017 15:34:42 +0000 (10:34 -0500)] 
Make raiseIO# produce topRes

Make `raiseIO#` produce `topRes` instead of `ExnRes`. `ExnRes` leads to
demand analysis being too aggressive, IMO, allowing imprecise exceptions
produced by `throw` to replace exceptions thrown by `throwIO` that
would like to think of as precise.

This fixes that, but is certanly much more conservative than we would
ideally like. Let's see how bad it is.

Fixes Trac #13380

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

2 years agoget-win32-tarballs: More reworking of tarball maintenance
Ben Gamari [Thu, 9 Mar 2017 14:25:50 +0000 (09:25 -0500)] 
get-win32-tarballs: More reworking of tarball maintenance

This fixes fetching of signatures and sources for inconsistently named msys2
tarballs.

2 years agoAdd a comment to the mapFB rules
Joachim Breitner [Thu, 9 Mar 2017 15:13:08 +0000 (16:13 +0100)] 
Add a comment to the mapFB rules

to amend 2fa44217c1d9722227297eefb0d6c6aed7e128ca.

2 years agoget-win32-tarballs: Rework handling of hashing
Ben Gamari [Thu, 9 Mar 2017 02:25:32 +0000 (21:25 -0500)] 
get-win32-tarballs: Rework handling of hashing

This pulls out the hashes into a separate file, making them far easier to
update.

2 years agoget-win32-tarballs: Use haskell.org mirror
Ben Gamari [Wed, 8 Mar 2017 04:46:50 +0000 (23:46 -0500)] 
get-win32-tarballs: Use haskell.org mirror

2 years agoUpdate crt to latest.
Tamar Christina [Wed, 8 Mar 2017 04:40:03 +0000 (23:40 -0500)] 
Update crt to latest.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

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

2 years agoComments only [ci skip]
Gabor Greif [Thu, 9 Mar 2017 09:22:28 +0000 (10:22 +0100)] 
Comments only [ci skip]

2 years agoKQueue.hsc: fix build failure on FreeBSD
Sergei Trofimovich [Thu, 9 Mar 2017 08:35:58 +0000 (08:35 +0000)] 
KQueue.hsc: fix build failure on FreeBSD

Build failed as:
  libraries/base/GHC/Event/KQueue.hsc:192:25: error:
      Not in scope: type constructor or class ‘Int16’
      |
  192 | newtype Filter = Filter Int16
      |                         ^^^^^

If was caused by an import tweak from Word16 to Int16.
Adjust imports to make KQueue compile cleanly.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build on freebsd

Reviewers: bgamari, austin, hvr

Subscribers: rwbarton, thomie

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

2 years agotestsuite: Bump allocations of T4029
Ben Gamari [Wed, 8 Mar 2017 04:51:19 +0000 (23:51 -0500)] 
testsuite: Bump allocations of T4029

2 years agoAllow compilation of C/C++/ObjC/ObjC++ files with module from TH
Francesco Mazzoli [Wed, 8 Mar 2017 04:39:51 +0000 (23:39 -0500)] 
Allow compilation of C/C++/ObjC/ObjC++ files with module from TH

The main goal is to easily allow the inline-c project (and
similar projects such as inline-java) to emit C/C++ files to
be compiled and linked with the current module.

Moreover, `addCStub` is removed, since it's quite fragile. Most
notably, the C stubs end up in the file generated by
`CodeOutput.outputForeignStubs`, which is tuned towards
generating a file for stubs coming from `capi` and Haskell-to-C
exports.

Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari

Reviewed By: dfeuer, bgamari

Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes

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

2 years agobase: Import Data.Int in KQueue
Ben Gamari [Wed, 8 Mar 2017 23:24:03 +0000 (18:24 -0500)] 
base: Import Data.Int in KQueue

This was broken in the ecb880caea441b6dd7f75a555546e55abe11c233.

2 years agoBump haskeline submodule to fix Windows build.
Tamar Christina [Wed, 8 Mar 2017 23:33:17 +0000 (23:33 +0000)] 
Bump haskeline submodule to fix Windows build.

2 years agoFix strictness for catchSTM
David Feuer [Wed, 8 Mar 2017 21:30:08 +0000 (16:30 -0500)] 
Fix strictness for catchSTM

* Fix demand analysist for `catchSTM#`.

* Add more notes on demand analysis of `catch`-like functions.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoComments only [ci skip]
Reid Barton [Wed, 8 Mar 2017 20:42:49 +0000 (15:42 -0500)] 
Comments only [ci skip]

2 years agoJoin points can be levity-polymorphic
Simon Peyton Jones [Wed, 8 Mar 2017 09:39:29 +0000 (09:39 +0000)] 
Join points can be levity-polymorphic

It's ok to have a levity-polymorphic join point, thus
   let j :: r :: TYPE l = blah
   in ...

Usually we don't allow levity-polymorphic binders, but join points
are different because they are not first class.  I updated the
invariants in CoreSyn.

This commit fixes Trac #13394.

2 years agoWin32: bump submodule to v2.5.2.0
Tamar Christina [Tue, 7 Mar 2017 22:21:00 +0000 (22:21 +0000)] 
Win32: bump submodule to v2.5.2.0

Summary: This fixes the Windows build after the latest -Werror patches landed.

Test Plan: ./validate

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

2 years agoDesugar: Refactor initDs
Ben Gamari [Tue, 7 Mar 2017 19:30:38 +0000 (14:30 -0500)] 
Desugar: Refactor initDs

As far as I can tell we were unnecessarily building a new TcgEnv when we
already had one on hand. TcRnMonad now sports an initTcWithGbl function,
which allows us to run a TcM monad in the context of this TcgEnv. This
appears to simplify things nicely.

Test Plan: Validate

Reviewers: austin

Subscribers: dfeuer, simonpj, thomie

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

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