ghc.git
2 years agoghc.mk: fix 'make install' for cross-mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:31:13 +0000 (15:31 +0100)] 
ghc.mk: fix 'make install' for cross-mingw32

Attempt to install cross-compiled mingw32 GHC built on linux failed as:

    $ make install DESTDIR=$(pwd)/__i__

    "mv" "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2" \
         "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc"
    mv: failed to stat
         '$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2': \
         No such file or directory

The rename should not be performed for windows targets.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoghc: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:10:26 +0000 (15:10 +0100)] 
ghc: tweak cross-compilation to mingw32

The build failure when cross-compiling from
linux to windows looks like:

    HC [stage 1] ghc/stage2/build/tmp/ghc-stage2.exe
      Call hs_init_ghc() from your main() function to set these options.
  /usr/libexec/gcc/i686-w64-mingw32/ld: cannot find -lHSghc-8.3-0

Similar to commit 745032dd02da511067c2939259ed212852187e0f
("rts: tweak cross-compilation to mingw32") decision to split
stage2 should be done based based on TargetOS, not HostOS.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoFix compilation for !HAVE_FLOCK
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:41:50 +0000 (15:41 +0200)] 
Fix compilation for !HAVE_FLOCK

2 years agoMinor reordering of `#include`s fixing compilation on AIX
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:28:52 +0000 (15:28 +0200)] 
Minor reordering of `#include`s fixing compilation on AIX

This helps ensure that system includes on some more fragile
platforms (like e.g. AIX) see a more consistent set of CPP defines,
and consequently reduce the risk of conflicting typdefs/prototypes
being exposed.

2 years agorts: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 10:44:45 +0000 (11:44 +0100)] 
rts: tweak cross-compilation to mingw32

Found the problem on x86_64-linux host where
I tried to cross-compile GHC to windows as:

    $ ./configure --target=i686-w64-mingw32 \
                  Windres=i686-w64-mingw32-windres \
                  DllWrap=i686-w64-mingw32-dllwrap

As a result build failed as POSIX bits of RTS.
For example 'rts/posix/OSMem.c' contains unix-specific
mmap() syscalls and constants and thus can't be compiled
by i686-w64-mingw32 toolchain.

It's caused by the following part of 'rts/ghc.mk':

  ifeq "$(HostOS_CPP)" "mingw32"
  ALL_DIRS += win32
  else
  ALL_DIRS += posix
  endif

In our case _CPP variables are defined this way (project.mk):
  BuildOS_CPP                = linux
  HostOS_CPP                 = linux
  TargetOS_CPP               = mingw32

RTS should never be built for 'BuildOS' or 'HostOS' as it's
always built by ghc-stage1 (targeted at TargetOS).

The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoaclocal.m4: treat '*-w64-mingw32' targets as windows
Sergei Trofimovich [Sun, 23 Apr 2017 10:25:29 +0000 (11:25 +0100)] 
aclocal.m4: treat '*-w64-mingw32' targets as windows

Noticed when tried to cross-compile GHC from x86_64-linux
to --target=i686-w64-mingw32. Final ghc executables did
not have '.exe' extensions.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoconfigure.ac: print paths to dllwrap and windres
Sergei Trofimovich [Sun, 23 Apr 2017 10:22:44 +0000 (11:22 +0100)] 
configure.ac: print paths to dllwrap and windres

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoFirst update mingw-w64 packages for 8.4
Tamar Christina [Sun, 23 Apr 2017 10:21:18 +0000 (11:21 +0100)] 
First update mingw-w64 packages for 8.4

Summary: Updating to get latest binutils etc.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, snowleopard

GHC Trac Issues: #12913

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

2 years agoskip T13525 when running on Windows.
Tamar Christina [Sun, 23 Apr 2017 09:44:54 +0000 (10:44 +0100)] 
skip T13525 when running on Windows.

2 years agoHaddock submodule update.
Edward Z. Yang [Sun, 23 Apr 2017 03:39:18 +0000 (20:39 -0700)] 
Haddock submodule update.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2 years agoBump time submodule
Ben Gamari [Fri, 21 Apr 2017 16:42:50 +0000 (12:42 -0400)] 
Bump time submodule

2 years agoBump filepath submodule
Ben Gamari [Fri, 21 Apr 2017 16:39:35 +0000 (12:39 -0400)] 
Bump filepath submodule

2 years agoBump deepseeq submodule
Ben Gamari [Fri, 21 Apr 2017 16:36:33 +0000 (12:36 -0400)] 
Bump deepseeq submodule

2 years agobase: update comment to match the change from e134af01
Andrzej Rybczak [Sat, 22 Apr 2017 00:11:35 +0000 (20:11 -0400)] 
base: update comment to match the change from e134af01

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agotestsuite: Update performance metrics
Ben Gamari [Sat, 22 Apr 2017 00:06:27 +0000 (20:06 -0400)] 
testsuite: Update performance metrics

2 years agoEdit eventlog-formats.rst to match implementation
Mitsutoshi Aoe [Sun, 16 Apr 2017 21:08:25 +0000 (06:08 +0900)] 
Edit eventlog-formats.rst to match implementation

* Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them
* EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling
* Modify EVENT_HEAP_PROF_SAMPLE_STRING's format
* Biography break-down isn't implemented

2 years agoSync up terminfo submodule to 0.4.1.0 release tag
Herbert Valerio Riedel [Fri, 21 Apr 2017 22:50:26 +0000 (00:50 +0200)] 
Sync up terminfo submodule to 0.4.1.0 release tag

2 years agoBuild system: fix bindist for cross-build GHC
Fangrui Song [Fri, 21 Apr 2017 00:03:30 +0000 (17:03 -0700)] 
Build system: fix bindist for cross-build GHC

The change fixes case of installing cross-built GHC
from bindist (BINDIST=YES) on TARGET.

In this case we need to use TARGET tools in `INSTALLED_GHC{,_PKG}_REAL`.

The original change is provided by Fangrui Song
as pull request https://github.com/ghc/ghc/pull/34

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoBump haskeline and terminfo submodules
Ben Gamari [Fri, 21 Apr 2017 15:33:47 +0000 (11:33 -0400)] 
Bump haskeline and terminfo submodules

2 years agolinters/check-cpp: Demote #if lints to warnings
Ben Gamari [Fri, 21 Apr 2017 16:27:51 +0000 (12:27 -0400)] 
linters/check-cpp: Demote #if lints to warnings

Errors trigger even for lines which the author didn't touch, which is undesired.

2 years agocatch the case where there is no symCmd
Moritz Angermann [Fri, 21 Apr 2017 16:12:01 +0000 (12:12 -0400)] 
catch the case where there is no symCmd

We do check for symCmd, to set the info->nlist value, but forgot to do
the same check for info->names.  Thus when trying to extract stroff from
symCmd, we hit a segfault.

Test Plan: The validation failure on windows is rather suspicious...
let's try this one

Reviewers: bgamari, adinapoli, austin, erikd, simonmar

Reviewed By: adinapoli

Subscribers: thomie, rwbarton

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

2 years agoFix build on DragonflyBSD
Ben Gamari [Fri, 21 Apr 2017 16:11:41 +0000 (12:11 -0400)] 
Fix build on DragonflyBSD

Test Plan: Validate on DragonflyBSD

Reviewers: austin, erikd, simonmar

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

2 years agobase: Fix hWaitForInput with timeout on POSIX
Ben Gamari [Fri, 21 Apr 2017 16:11:28 +0000 (12:11 -0400)] 
base: Fix hWaitForInput with timeout on POSIX

This was previously broken (#13252) by
f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady
function from `select` to `poll` and in so doing dropping support for
timeouts. Unfortunately, while `select` tells us the amount of time not
slept (on Linux anyways; it turns out this is implementation dependent),
`poll` does not give us this luxury. Consequently, we manually need to
track time slept in this case.

Unfortunately, portably measuring time is hard. Ideally we would use
`clock_gettime` with the monotonic clock here, but sadly this isn't
supported on most versions of Darwin. Consequently, we instead use
`gettimeofday`, running the risk of system time changes messing us up.

Test Plan: Validate

Reviewers: simonmar, austin, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #13252

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

2 years agotestsuite: Bump timeout multiplier for T11195
Ben Gamari [Fri, 21 Apr 2017 02:34:21 +0000 (22:34 -0400)] 
testsuite: Bump timeout multiplier for T11195

This test has been occassionally failing on the Darwin build bot for some time
now.

(cherry picked from commit b3a4dd1152884ff1240824137eca0a49cb6e5a2c)

2 years agobase: Fix offset initialization of Windows hLock implementation
Ben Gamari [Fri, 21 Apr 2017 16:10:33 +0000 (12:10 -0400)] 
base: Fix offset initialization of Windows hLock implementation

The previous implementation swapped the buffer size with the byte to be
set, essentially resulting in an uninitialized buffer.

Test Plan: Validate on Windows

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13599

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

2 years agoSync up haskeline submodule to 0.7.4.0 release tag
Herbert Valerio Riedel [Thu, 20 Apr 2017 23:44:03 +0000 (01:44 +0200)] 
Sync up haskeline submodule to 0.7.4.0 release tag

2 years agoutils/debugNCG: remove old tool
Sergei Trofimovich [Fri, 21 Apr 2017 07:27:58 +0000 (08:27 +0100)] 
utils/debugNCG: remove old tool

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agopprDebugCLabel: drop duplicate trailing ')'
Sergei Trofimovich [Thu, 20 Apr 2017 19:49:26 +0000 (20:49 +0100)] 
pprDebugCLabel: drop duplicate trailing ')'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agotestsuite: disable 'optllvm' for unregisterised compiler
Sergei Trofimovich [Thu, 20 Apr 2017 19:13:25 +0000 (20:13 +0100)] 
testsuite: disable 'optllvm' for unregisterised compiler

commit 74615f412ad3de2910a156ff494bfe5497fada7e
("UNREG: ignore -fllvm (Trac #13495)") enabled
'optllvm' tests to be ran in 'make fulltest' mode.

As a result many (~1000) tests fail due to stderr misamatch:
  +when making flags consistent: warning:
  +    Compiler unregisterised, so compiling via C

The change removes 'optllvm' tests for unregisterised compiler.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoSimplify StgCases when all alts refer to the case binder
Joachim Breitner [Tue, 18 Apr 2017 21:20:59 +0000 (17:20 -0400)] 
Simplify StgCases when all alts refer to the case binder

as proposed in #13588.

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

2 years agoRevert "linker/mach-o: Catch the case where there is no symCmd"
Ben Gamari [Tue, 18 Apr 2017 01:02:07 +0000 (21:02 -0400)] 
Revert "linker/mach-o: Catch the case where there is no symCmd"

This causes validation failures on Windows.

This reverts commit 6c05b27e5bafe9f232e7014f4760335f5e3ba591.

2 years agoAdd failing test case for #13588
Joachim Breitner [Tue, 18 Apr 2017 21:05:10 +0000 (17:05 -0400)] 
Add failing test case for #13588

2 years agoFix LaTeX in core-spec
Joachim Breitner [Tue, 18 Apr 2017 20:18:33 +0000 (16:18 -0400)] 
Fix LaTeX in core-spec

where d49b2bb21691892ca6ac8f2403e31f2a5e53feb3 introduced some TeX
breakage, and re-generate core-spec.pdf.

2 years agoUpdate xhtml submodule to potential 3000.2.2 release commit
Herbert Valerio Riedel [Tue, 18 Apr 2017 15:22:50 +0000 (17:22 +0200)] 
Update xhtml submodule to potential 3000.2.2 release commit

2 years agoCaret diag.: Avoid decoding whole module if only specific line is needed
alexbiehl [Mon, 17 Apr 2017 16:51:10 +0000 (12:51 -0400)] 
Caret diag.: Avoid decoding whole module if only specific line is needed

Before we were decoding the whole file to get to the desired line. This
patch introduces a fast function which searches a StringBuffer for the
desired line so we only need to utf8 decode a little portion.

This is especially interesting if we have big modules with lots of
warnings.

Reviewers: austin, bgamari, Rufflewind, trofi

Reviewed By: Rufflewind, trofi

Subscribers: rwbarton, thomie

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

2 years agoUse intersect and minus instead of filter
Bartosz Nitka [Mon, 17 Apr 2017 16:50:10 +0000 (12:50 -0400)] 
Use intersect and minus instead of filter

These are asymptotically better and convey the intent
a bit better.

Test Plan: ./validate

Reviewers: simonpj, bgamari, austin, goldfire

Reviewed By: bgamari

Subscribers: rwbarton, thomie, simonmar

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

2 years agoFix "Glasgow Haskell Compiler <release> Users Guide"
Bartosz Nitka [Mon, 17 Apr 2017 16:49:34 +0000 (12:49 -0400)] 
Fix "Glasgow Haskell Compiler <release> Users Guide"

If you go to
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html
the window title has `<release>` in it.  I don't understand how it all
works, but inspired by the line below which produces a correct string in
the docs I just blindly changed it in the same way.  Cabal appears to
have the same problem.

Test Plan:
it'd be nice if I could check the result
on harbormaster, can I?

Reviewers: thomie, bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, simonmar

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

2 years agoRemove redundant flag (-O) registration (fixes #13392)
Santiago Munin [Mon, 17 Apr 2017 16:44:52 +0000 (12:44 -0400)] 
Remove redundant flag (-O) registration (fixes #13392)

Reviewers: austin, bgamari, dfeuer

Reviewed By: bgamari, dfeuer

Subscribers: rwbarton, thomie

GHC Trac Issues: #13392

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

2 years ago[iserv] drop cryptonite dependency.
Moritz Angermann [Mon, 17 Apr 2017 16:28:22 +0000 (12:28 -0400)] 
[iserv] drop cryptonite dependency.

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoutils: Lazily decode UTF8 strings
Ben Gamari [Mon, 17 Apr 2017 16:26:56 +0000 (12:26 -0400)] 
utils: Lazily decode UTF8 strings

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13527

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

2 years agoFix space leak in sortBy
Gregory [Mon, 17 Apr 2017 15:24:31 +0000 (11:24 -0400)] 
Fix space leak in sortBy

This makes yields a small improvement in sort performance: around 3.5% in
runtime on random Ints.

Reviewers: austin, hvr, mpickering

Subscribers: siddhanathan, rwbarton, thomie

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

2 years agobase: Track timer PSQ timeouts as Word64 instead of Double
Ben Gamari [Mon, 17 Apr 2017 15:17:00 +0000 (11:17 -0400)] 
base: Track timer PSQ timeouts as Word64 instead of Double

Test Plan: Validate on all the platforms

Reviewers: nh2, hvr, austin

Subscribers: Phyx, nh2, rwbarton, thomie

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

2 years agoaclocal.m4: respect user's --with-ar= choice
Sergei Trofimovich [Mon, 17 Apr 2017 08:41:49 +0000 (09:41 +0100)] 
aclocal.m4: respect user's --with-ar= choice

'FP_PROG_AR' macro has a minor bug: it ignores
already existing value stored in '$fp_prog_ar'.

I've noticed it when tried to built UNREG ghc using thin LTO:

  $ ./configure --enable-unregisterised \
                --with-nm=gcc-nm \
                --with-ar=gcc-ar \
                --with-ranlib=gcc-ranlib \

./configure refused to use 'gcc-ar' (LTO-aware variant of 'ar')
and kept using 'ar'.

'$fp_prog_ar' is initialized (in a complex manner) in 'configure.ac' as:

    FP_ARG_WITH_PATH_GNU_PROG([AR], [ar], [ar])
    ArCmd="$AR"
    fp_prog_ar="$AR"
    AC_SUBST([ArCmd])

The change keeps that value.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoconfigure.ac: print resolved 'ar' and 'ranlib' tools
Sergei Trofimovich [Mon, 17 Apr 2017 08:40:17 +0000 (09:40 +0100)] 
configure.ac: print resolved 'ar' and 'ranlib' tools

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agohs_add_root() RTS API removal
Sergei Trofimovich [Mon, 17 Apr 2017 11:56:20 +0000 (12:56 +0100)] 
hs_add_root() RTS API removal

Before ghc-7.2 hs_add_root() had to be used to initialize haskell
modules when haskell was called from FFI.

commit a52ff7619e8b7d74a9d933d922eeea49f580bca8
("Change the way module initialisation is done (#3252, #4417)")
removed needs for hs_add_root() and made function a no-op.
For backward compatibility '__stginit_<module>' symbol was
not removed.

This change removes no-op hs_add_root() function and unused
'__stginit_<module>' symbol from each haskell module.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ./validate

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agoUNREG: fix spelling of '-split-objs' in warning
Sergei Trofimovich [Sun, 16 Apr 2017 16:56:35 +0000 (17:56 +0100)] 
UNREG: fix spelling of '-split-objs' in warning

Spelling if warning message slightly mismathed passed commandline:

  $ ghc-stage2 -split-objs -C N.hs
  on the commandline: warning: ignoring -fsplit-objs

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoUNREG: remove dead code around -split-objs
Sergei Trofimovich [Sun, 16 Apr 2017 16:20:54 +0000 (17:20 +0100)] 
UNREG: remove dead code around -split-objs

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agorts/RtsUtils.c: drop stale comments
Sergei Trofimovich [Sun, 16 Apr 2017 09:45:00 +0000 (10:45 +0100)] 
rts/RtsUtils.c: drop stale comments

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agolinker/mach-o: Catch the case where there is no symCmd
Moritz Angermann [Sun, 16 Apr 2017 01:30:10 +0000 (21:30 -0400)] 
linker/mach-o: Catch the case where there is no symCmd

We do check for symCmd, to set the info->nlist value, but
forgot to do the same check for info->names.  Thus when trying to
extract stroff from symCmd, we hit a segfault.

Reviewers: bgamari, adinapoli, austin, erikd, simonmar

Reviewed By: bgamari, adinapoli

Subscribers: rwbarton, thomie

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

2 years agolinters/cpp: Catch #ifndef
Ben Gamari [Fri, 14 Apr 2017 02:04:48 +0000 (22:04 -0400)] 
linters/cpp: Catch #ifndef

2 years agoFix typo in TcErrors.hs
Matthías Páll Gissurarson [Fri, 17 Mar 2017 00:46:58 +0000 (01:46 +0100)] 
Fix typo in TcErrors.hs

This fixes a very simple typo in TcErrors.hs. I hope this is small
enough in scope to be accepted through GitHub.

2 years agoDoc typo
Alex Biehl [Wed, 22 Mar 2017 09:25:24 +0000 (10:25 +0100)] 
Doc typo

2 years agoComments only in Type.isPredTy
Simon Peyton Jones [Thu, 13 Apr 2017 08:23:39 +0000 (09:23 +0100)] 
Comments only in Type.isPredTy

2 years agoRemove dead quantifyTyVars
Simon Peyton Jones [Wed, 12 Apr 2017 15:20:13 +0000 (16:20 +0100)] 
Remove dead quantifyTyVars

This patch

* removes a function TcMType.quantifyTyVars
  that was never called

* renames quantifyZonkedTyVars to quantifyTyVars

Plus a few comments.  No functional change at all

2 years agoYet more work on TcSimplify.simplifyInfer
Simon Peyton Jones [Wed, 12 Apr 2017 14:09:37 +0000 (15:09 +0100)] 
Yet more work on TcSimplify.simplifyInfer

The proximate cause for this patch is Trac #13482, which pointed out
further subtle interactions between
   - Inferring the most general type of a function
   - A partial type signature for that function

That led me into /further/ changes to the shiny new stuff in
TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars,
and related functions.

Happily, I was able to make some of it quite a bit simpler,
notably the bit about promoting free tyvars.  I'm happy with
the result.

Moreover I fixed Trac #13524 at the same time.  Happy days.

2 years agoFix a couple of user-manual typos
Simon Peyton Jones [Tue, 11 Apr 2017 14:24:42 +0000 (15:24 +0100)] 
Fix a couple of user-manual typos

2 years agoSplit up RnEnv into 4 modules, RnUnbound, RnUtils and RnFixity
Matthew Pickering [Sat, 8 Apr 2017 15:42:32 +0000 (16:42 +0100)] 
Split up RnEnv into 4 modules, RnUnbound, RnUtils and RnFixity

Summary:
RnEnv contains functions which convertn RdrNames into Names.

RnUnbound contains helper functions for reporting and creating
unbound variables.

RnFixity contains code which maintains the fixity environent
whilst renaming.

RnUtils contains the other stuff in RnEnv.

Reviewers: austin, goldfire, bgamari

Subscribers: goldfire, rwbarton, thomie, snowleopard

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

2 years agoDrop special handling of iOS
Moritz Angermann [Wed, 12 Apr 2017 18:12:33 +0000 (14:12 -0400)] 
Drop special handling of iOS

iOS at least since iOS8 (we are currently at iOS10.3), allows for
dynamic libaries, hence any artificail restriction on dyanmic
libraries should be lifted.

Please ping me with any iOS related issues that should potentially
resurface.  The iOS toolchain has considerably changed over the
years, and I'm willing to drop work arounds in good faith.

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13559, #7722

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

2 years agoFix typo in ReadP (succeds -> succeeds)
Chris Martin [Wed, 12 Apr 2017 18:12:05 +0000 (14:12 -0400)] 
Fix typo in ReadP (succeds -> succeeds)

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years ago[linker] Remove dead code (ELF_FUNCTION_DESC)
Moritz Angermann [Wed, 12 Apr 2017 18:11:41 +0000 (14:11 -0400)] 
[linker] Remove dead code (ELF_FUNCTION_DESC)

Reviewers: bgamari, austin, erikd, simonmar, rwbarton

Reviewed By: bgamari, rwbarton

Subscribers: rwbarton, thomie

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

2 years agoAllow qualified names to be children in export lists
Matthew Pickering [Wed, 12 Apr 2017 18:10:54 +0000 (14:10 -0400)] 
Allow qualified names to be children in export lists

When doing this I noticed a horrible amount of duplication between
lookupSubBndrOcc and lookupExportChild (which I am responsible for).
I opened #13545 to keep track of this.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13528

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

2 years agoSuggest correct replacement flag name for -dppr-ticks
Reid Barton [Wed, 12 Apr 2017 18:10:39 +0000 (14:10 -0400)] 
Suggest correct replacement flag name for -dppr-ticks

It told me to use -fno-suppress-ticks, but it should have been
-dno-suppress-ticks.

Test Plan: tested -dppr-ticks and -frewrite-rules manually

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoRemove GhcDynamic (in favor of DYNAMIC_GHC_PROGRAMS)
Reid Barton [Wed, 12 Apr 2017 18:10:12 +0000 (14:10 -0400)] 
Remove GhcDynamic (in favor of DYNAMIC_GHC_PROGRAMS)

DYNAMIC_GHC_PROGRAMS and GhcDynamic both tried to control whether
the ghc binary was built as a dynamic executable, with confusing
results. In particular, setting GhcDynamic=NO has no effect on
systems where DYNAMIC_GHC_PROGRAMS defaults to YES.

DYNAMIC_GHC_PROGRAMS is more fully-featured (it ensures that the
correct flavor of the libraries is built, for example) so let's
keep it and remove GhcDynamic to reduce confusion.

This effectively reverts commit 3c6190b0.

Test Plan: tested locally; harbormaster

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, snowleopard

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

2 years agoarc-linters: Add linting of #ifdef x and #if defined x
Ben Gamari [Wed, 12 Apr 2017 18:10:01 +0000 (14:10 -0400)] 
arc-linters: Add linting of #ifdef x and #if defined x

Reviewers: austin, erikd

Reviewed By: erikd

Subscribers: rwbarton, thomie, erikd

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

2 years agobase: Implement bit casts between word and float types
Erik de Castro Lopo [Wed, 12 Apr 2017 18:09:49 +0000 (14:09 -0400)] 
base: Implement bit casts between word and float types

Test Plan: Test on x86 and x86_64

Reviewers: duncan, trofi, simonmar, tibbe, hvr, austin, rwbarton,
bgamari

Reviewed By: duncan

Subscribers: Phyx, DemiMarie, rwbarton, thomie

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

2 years agoRnEnv cleanup
Matthew Pickering [Wed, 12 Apr 2017 18:06:15 +0000 (14:06 -0400)] 
RnEnv cleanup

unless (not ..) -> when

Remove unused getLookupOccRn

Remove lookupGreRn2

It was only called in one place in a very strange way. It is easier
to just use lookupGreRn which has nearly the same implementation and
then directly call `unboundName`.

Remove unused function mapFvRnCPS

Remove unused functions bindLocatedLocalsRn and bindLocatedLocalsFV

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoUse -G1 for reliable peak mem usage
Simon Peyton Jones [Tue, 11 Apr 2017 15:09:42 +0000 (16:09 +0100)] 
Use -G1 for reliable peak mem usage

2 years agoMake let and app consistent in exprIsCheapX
Simon Peyton Jones [Tue, 11 Apr 2017 14:39:09 +0000 (15:39 +0100)] 
Make let and app consistent in exprIsCheapX

This fixes Trac #13558, by making App and Let behave
consistently; see Note [Arguments and let-bindings exprIsCheapX]

I renamed the mysterious exprIsOk to exprIsCheapX.  (The "X"
is because it is parameterised over a CheapAppFun.)

2 years agoAdd Outputable instance for ArityType
Simon Peyton Jones [Tue, 11 Apr 2017 14:36:30 +0000 (15:36 +0100)] 
Add Outputable instance for ArityType

2 years agoFix another literal-string buglet
Simon Peyton Jones [Tue, 11 Apr 2017 14:34:12 +0000 (15:34 +0100)] 
Fix another literal-string buglet

We were failing to float a nested binding
   x :: Addr# = "foo"#
to top level, even though we /were/ floating string
literals themselves.  A small oversight, easily fixed.

2 years agoImprove demand analysis for join points
Simon Peyton Jones [Mon, 10 Apr 2017 07:51:49 +0000 (08:51 +0100)] 
Improve demand analysis for join points

I realised (Trac #13543) that we can improve demand analysis for
join point quite straightforwardly.

The idea is explained in
    Note [Demand analysis for join points]
in DmdAnal

2 years agoKill off complications in CoreFVs
Simon Peyton Jones [Fri, 7 Apr 2017 16:10:07 +0000 (17:10 +0100)] 
Kill off complications in CoreFVs

When doing type-in-type, Richard introduce some substantial
complications in CoreFVs, gathering types and free variables
of type.  In Trac #13160 we decided that this complication was
unnecessary, so this patch removes it.

Unfortnately I then fell down a twisty rabbit hole.  Roughly:

* An apparently-innocuous change in the AnnApp case of
  fiExpr made the fuction a little bit stricter, so we ended
  up peering into the arguments when we didn't before (namely
  when there are no bindings being floated inwards).  I've
  rejigged it so that it's not fragile any more.

* Peering into the arguments was sometimes expensive, becuase
  exprIsExpandable can be expensive because it looks deeply into
  the expression.

* The combination of the two led to a non-linear explosion
  of work when the argument of a function is a deeep nest
  of constructors.  This bug has been lurking for ages.

  I solved it by replacing exprIsExpandable with exprIsHNF
  + exprIsTrivial; see Note [noFloatInto considerations]

* The code around floating case-expressions turned out to be
  very delicate, because can_fail primops (which we want to
  float inwards) can't be floated outwards; so we have to be
  careful never to float them too far. Note [Floating primops]
  has the details

* I ended up refactoring some rather opaque code in
  sepBindsByDropPoint.

Working all this out meant that I rewrote quite a bit of
code, so it's now a reasonably substantial patch.  But it's
a net improvement.

2 years agoTypos in comments [ci skip]
Gabor Greif [Thu, 6 Apr 2017 13:13:55 +0000 (15:13 +0200)] 
Typos in comments [ci skip]

2 years ago[Elf/arm] Thumb indicator bit only for STT_FUNC
Moritz Angermann [Tue, 11 Apr 2017 01:39:19 +0000 (21:39 -0400)] 
[Elf/arm] Thumb indicator bit only for STT_FUNC

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

Reviewed By: trofi

Subscribers: trofi, thomie

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

2 years ago[MachO] Use OBJFORMAT_MACHO.
Moritz Angermann [Tue, 11 Apr 2017 01:39:02 +0000 (21:39 -0400)] 
[MachO] Use OBJFORMAT_MACHO.

Reviewers: bgamari, austin, erikd, simonmar, rwbarton

Reviewed By: rwbarton

Subscribers: rwbarton, thomie

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

2 years agoEnter iserv-proxy
Moritz Angermann [Tue, 11 Apr 2017 01:38:45 +0000 (21:38 -0400)] 
Enter iserv-proxy

With the introduction of -fexternal-interpreter we are
now able to compile template haskell via an extern iserv process.

This however is restricted to the same host, and can therefore
not be used with crosscompilers where the iserv slave process
needs to run on a different machine than the cross compiling
haskell compiler.

This diff breaks up iserv into a library and the iserv-bin binary.
It also introduces the iserv-proxy, a proxy instance that the
haskell compiler can talk to, and which forwards the calls
to the iserv slave on a different machine, as well as providing
some extra functionarily (sending files that are not available
on the machine the slave runs on), as well as forwarding from
the slave to the haskell compiler, when the slave needs to
interrogate the haskell compiler.

The iserv library now also exports the startSlave function to be
called by the application that implements the slave on the target.

The simplest such app would probably look something like:

```
extern void startServ(bool, const char *);

int main(int argc, char * argv[]) {
  hs_init(NULL, NULL);
  startServ(false,"/tmp");
  while(1);
}
```

Special thanks to Shea Levy for the first draft of the iserv-remote,
from which I took some inspiration.

The `Buildable` flags are due to ghc-cabal not being able to build
more than a single target.  Please note that only the stock iserv-bin
is supposed to be built *with* ghc.  The library and proxy are supposed
to be built outside of ghc.  Yet I believe that this code should live
together with iserv.

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

Reviewed By: simonmar

Subscribers: luite, ryantrinkle, shlevy, thomie

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

2 years agoFix form of note
Ben Gamari [Tue, 11 Apr 2017 01:35:06 +0000 (21:35 -0400)] 
Fix form of note

2 years agobase: Fix erroneous reference to Data.Reflection in documentation
Ben Gamari [Mon, 10 Apr 2017 18:07:42 +0000 (14:07 -0400)] 
base: Fix erroneous reference to Data.Reflection in documentation

2 years agoImprove `readChan` documentation:
Ömer Sinan Ağacan [Mon, 10 Apr 2017 17:36:45 +0000 (20:36 +0300)] 
Improve `readChan` documentation:

- Mention that the read end is an `MVar`, so fairness guarantees are
  inherited.

- Mention that it can throw `BlockedIndefinitelyOnMVar` exception.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #5466

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

2 years agoTypos in bang patterns user manual [skip ci]
Ömer Sinan Ağacan [Mon, 10 Apr 2017 15:38:31 +0000 (18:38 +0300)] 
Typos in bang patterns user manual [skip ci]

2 years agoAdd a second regression test for #13536
Joachim Breitner [Mon, 10 Apr 2017 15:21:52 +0000 (11:21 -0400)] 
Add a second regression test for #13536

which counts allocations instead of observing recomputation directly.

2 years agoStgCse: Do not re-use trivial case scrutinees
Joachim Breitner [Sun, 9 Apr 2017 23:40:02 +0000 (19:40 -0400)] 
StgCse: Do not re-use trivial case scrutinees

as they might be marked as one-shot, and suddenly we’d evaluate them
multiple times. This came up in #13536 (test cases included).

The solution was layed out by SPJ in ticket:13536#comment:12.

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

2 years agoAdd a Note [Call Arity and Join Points]
Joachim Breitner [Sun, 9 Apr 2017 17:41:40 +0000 (13:41 -0400)] 
Add a Note [Call Arity and Join Points]

as discussed in #13479.

2 years agoParenthesize type/data families correctly for -ddump-splices
Alan Zimmerman [Sun, 9 Apr 2017 19:06:06 +0000 (21:06 +0200)] 
Parenthesize type/data families correctly for -ddump-splices

Fix a regression in the pretty-printed code for -ddump-splices, which regressed
since 8.0.

Closes trac issue #13550

2 years agocross-build 'unlit' and 'hp2ps' for stage2 install
Sergei Trofimovich [Sat, 8 Apr 2017 09:02:34 +0000 (10:02 +0100)] 
cross-build 'unlit' and 'hp2ps' for stage2 install

In navive build case it does not matter much if we build
'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1:
both GHCs are native compilers and both tools are written
in C (have no haskell code).

But in cross-case the difference is substantial:
In Stag1Only=YES case we need to install native tools built
by ghc-stage0/${host}-cc.
In Stag1Only=NO  case we need to install cross-built tools
built by ghc-stage1/${target}-cc.

Before this change GHC did not have a rule to build cross-built
'unlit' and 'hp2ps'.

The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install'
targets.

'inplace/lib/bin/unlit.bin' target is unchanged and still contains
native binary.

As a result this change allows cross-building and packaging whole
GHC for target platform!

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agofix 'make install' for cross-stage2
Sergei Trofimovich [Fri, 7 Apr 2017 09:08:58 +0000 (10:08 +0100)] 
fix 'make install' for cross-stage2

When cross-built GHC is being installed one of
latest steps is to register installed libraries
with 'ghc-pkg'.

GHC uses freshly installed 'ghc-pkg' and 'ghc-stage2'
for that.

Tested as:
    ./configure --target=aarch64-unknown-linux-gnu
    make install DESTDIR=$(pwd)/__s2 STRIP_CMD=:

Before the change install failed on ghc-pkg execution phase:

    ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg" \
        --force \
        --global-package-db \
        ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/package.conf.d" \
        update rts/dist/package.conf.install
    /bin/sh: .../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg: \
        No such file or directory

To avoid breakage we use 'ghc' and 'ghc-pkg' built by stage0.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: run 'make install' on stage2 crosscompiler

Reviewers: rwbarton, austin, bgamari

Subscribers: thomie, snowleopard

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

2 years agoDo Note [Improving seq] always
Simon Peyton Jones [Fri, 7 Apr 2017 15:19:56 +0000 (16:19 +0100)] 
Do Note [Improving seq] always

This patch fixes Trac #13468, and at the same time makes the
code simpler and more uniform.  In particular, I've eliminated
the awkward conflict between the old built-in rule for seq
(which elimianted a cast), and the desire to make case scrutinse
a data type by doing type-family reduction (which adds a cast).

Nice.

2 years agoadd $(CrossCompilePrefix) to 'runghc' and 'ghci'
Sergei Trofimovich [Thu, 6 Apr 2017 21:48:13 +0000 (22:48 +0100)] 
add $(CrossCompilePrefix) to 'runghc' and 'ghci'

When Stage1Only=YES install mode is used one of rare tools
that lack $(CrossCompilePrefix) prefix are 'runghc' and 'ghci'.

This causes file collisions when multiple GHC crosscompilers
are installed in system.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoMore changes to fix a space leak in the simplifier (#13426)
Reid Barton [Thu, 6 Apr 2017 21:44:08 +0000 (17:44 -0400)] 
More changes to fix a space leak in the simplifier (#13426)

Part of e13419c55 was accidentally lost during a rebase. This commit
adds the missing change, along with some more improvements
regarding where we do and don't use `seqType`.

Also include a comment about where the space leak showed up
and a Note explaining the strategy being used here.

Test Plan: harbormaster, plus local testing on DynFlags

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agotestsuite: Update expected performance numbers on 32-bit Linux
Ben Gamari [Thu, 6 Apr 2017 21:22:28 +0000 (17:22 -0400)] 
testsuite: Update expected performance numbers on 32-bit Linux

The Harbormaster build seems to slightly disagree with my local build machine on
a few of these. In the case of `haddock.compiler` the difference is nearly an
order of magnitude. Odd.

2 years agobase: Run num009 with -msse2 on i386
Ben Gamari [Thu, 6 Apr 2017 21:14:47 +0000 (17:14 -0400)] 
base: Run num009 with -msse2 on i386

x87's transcendental instructions are terribly imprecise and fail this test.
Moreover, we really ouch to enable -mse2 on i386 by default as it is nearly
universally supported at this point. See #13540.

2 years agoAdd regression test for #13538
Ryan Scott [Thu, 6 Apr 2017 20:42:39 +0000 (16:42 -0400)] 
Add regression test for #13538

Commit 2b64e926a628fb2a3710b0360123ea73331166fe (#13135) ended
up fixing #13538 as well. Let's add a regression test so that it stays
fixed.

Test Plan: make test TEST=T13538

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13538

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

2 years agoEnable lint checking of levity polymorphic coercions
Ben Gamari [Thu, 6 Apr 2017 20:38:45 +0000 (16:38 -0400)] 
Enable lint checking of levity polymorphic coercions

This reverts commit 03c7dd0941fb4974be54026ef3e4bb97451c3b1f and fixes
the coercions.

2 years agoFix name of Note
Ben Gamari [Thu, 6 Apr 2017 19:58:08 +0000 (15:58 -0400)] 
Fix name of Note

2 years agoBe less aggressive about fragile-context warrnings
Simon Peyton Jones [Thu, 6 Apr 2017 11:27:43 +0000 (12:27 +0100)] 
Be less aggressive about fragile-context warrnings

In the implementation of WarnSimplifiableClassConstraints, be
less aggressive about reporting a problem. We were complaining
about a "fragile" case that in fact was not fragile.

See Note [Simplifiable given constraints] in TcValidity.

This fixes Trac #13526.

2 years agoComments only
Simon Peyton Jones [Thu, 6 Apr 2017 07:26:18 +0000 (08:26 +0100)] 
Comments only

2 years agoYet another attempt at inferring the right quantification
Simon Peyton Jones [Wed, 5 Apr 2017 12:46:03 +0000 (13:46 +0100)] 
Yet another attempt at inferring the right quantification

TcSimplify.decideQuantification is truly a tricky function!
Trac #13509 showed that we were being over-eager with defaulting
of runtime-rep variables (levity polymorphism), which meant that
a program was wrongly rejected, and with a very odd error message
(c.f. Trac #13530)

I spent an unreasonably long time figuring out how to fix this
in a decent way, and ended up with a major refactoring of
decideQuantification, with a kock-on effect in simplifyInfer.

It is at least a bit more comprehensible now; but I still
can't say I like it.

2 years agoComments and eta expand only
Simon Peyton Jones [Wed, 5 Apr 2017 12:45:30 +0000 (13:45 +0100)] 
Comments and eta expand only

2 years agoAdd a missing addDeferredBinding
Simon Peyton Jones [Wed, 5 Apr 2017 12:39:51 +0000 (13:39 +0100)] 
Add a missing addDeferredBinding

I'd forgotten to add deferred bindings for user type
errors.  Fixes Trac #13487.

2 years agoDon't report fundep wanted/wanted errors
Simon Peyton Jones [Wed, 5 Apr 2017 12:37:28 +0000 (13:37 +0100)] 
Don't report fundep wanted/wanted errors

This makes GHC drop derived FunDep errors when they
are come from wanted/wanted interactions.  Much along
the lines of "don't rewrite wanteds with wanteds".

See TcRnTypes Note [Dropping derived constraints]
and the new code in isDroppableDerivedLoc.

Fixes Trac #13506.