ghc.git
3 years agoSupport more sphinx-build versions in configure script
Bartosz Nitka [Sat, 24 Oct 2015 00:12:16 +0000 (02:12 +0200)] 
Support more sphinx-build versions in configure script

`sphinx-build` on CentOS
(`python-sphinx10-doc-1.0.8-1.el6.centos.noarch`) responds with this on
`stderr`:
```
$ sphinx-1.0-build --version
Sphinx v1.0.8
Usage: /usr/bin/sphinx-1.0-build [options] sourcedir outdir
[filenames...]
Options: -b <builder> -- builder to use; default is html
         -a        -- write all files; default is to only write new and
changed files
...
Modi:
* without -a and without filenames, write new and changed files.
* with -a, write all files.
* with filenames, write these.
```

This should make it work for the old and the new format.

Test Plan:
```
$ echo "Sphinx (sphinx-build) 1.0.1" | sed 's/Sphinx\(
(sphinx-build)\)\? v\?\([0-9]\.[0-9]\.[0-9]\)/\2/'
1.0.1
$ echo "Sphinx v1.0.1" | sed 's/Sphinx\( (sphinx-build)\)\?
v\?\([0-9]\.[0-9]\.[0-9]\)/\2/'
1.0.1
```

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

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

3 years agoFix broken .arclint
Bartosz Nitka [Fri, 23 Oct 2015 22:54:10 +0000 (00:54 +0200)] 
Fix broken .arclint

Test Plan: the linter works now

Reviewers: ezyang, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agogitignore: Ignore sphinx doctrees directories
Ben Gamari [Fri, 23 Oct 2015 10:06:59 +0000 (12:06 +0200)] 
gitignore: Ignore sphinx doctrees directories

3 years agoVerify minimum required version of sphinx-build
Ben Gamari [Fri, 23 Oct 2015 10:27:35 +0000 (12:27 +0200)] 
Verify minimum required version of sphinx-build

CentOS 6.6 includes sphinx-build 0.6.6 which is woefully inadequate to
build the users guide. In particular it fails as it lacks
`sphinx.ext.extlinks`, which was introduced in 1.0.0. Looking at the
changelog it appears that 1.0.0 ought to work.

3 years agobase: Note platform dependence of registerFd
Ben Gamari [Fri, 23 Oct 2015 15:09:31 +0000 (17:09 +0200)] 
base: Note platform dependence of registerFd

Just a documentation change. Fixes #10736.

3 years agoarclint: ReST doesn't need ArcanistMergeConflictLinter
Ben Gamari [Fri, 23 Oct 2015 15:25:59 +0000 (17:25 +0200)] 
arclint: ReST doesn't need ArcanistMergeConflictLinter

The section heading syntax trips up this linter. Fixes #10979.

3 years agoAdd testcase for #10426
Ben Gamari [Fri, 23 Oct 2015 15:42:11 +0000 (17:42 +0200)] 
Add testcase for #10426

3 years agoQuote GHC_PKG in Makefile.
Edward Z. Yang [Thu, 22 Oct 2015 20:10:43 +0000 (13:10 -0700)] 
Quote GHC_PKG in Makefile.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoQuote GHC path in configure so we can deal with multiple spaces.
Edward Z. Yang [Thu, 22 Oct 2015 07:01:41 +0000 (00:01 -0700)] 
Quote GHC path in configure so we can deal with multiple spaces.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoSuggest chmod 755 instead of 644
Ben Gamari [Thu, 22 Oct 2015 15:35:18 +0000 (17:35 +0200)] 
Suggest chmod 755 instead of 644

Previous suggestion would clear executable bit, meaning directory
couldn't be entered. Fixes #11003.

Test Plan: Read message.

Reviewers: austin, thomie, dfeuer

Reviewed By: thomie, dfeuer

Subscribers: thomie

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

GHC Trac Issues: #11003

3 years agoMake stronglyConnCompFromEdgedVertices deterministic
Bartosz Nitka [Thu, 22 Oct 2015 13:30:56 +0000 (15:30 +0200)] 
Make stronglyConnCompFromEdgedVertices deterministic

This makes it so the result of computing SCC's depends on the order
the nodes were passed to it, but not on the order on the user provided
key type.
The key type is usually `Unique` which is known to be nondeterministic.

Test Plan:
`text` and `aeson` become deterministic after this
./validate

Compare compile time for `text`:
```
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real    0m59.459s
user    0m57.862s
sys     0m1.185s
$ cabal clean && time cabal build
real    1m0.037s
user    0m58.350s
sys     0m1.199s
$ cabal clean && time cabal build
real    0m57.634s
user    0m56.118s
sys     0m1.202s
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real    0m59.867s
user    0m58.176s
sys     0m1.188s
$ cabal clean && time cabal build
real    1m0.157s
user    0m58.622s
sys     0m1.177s
$ cabal clean && time cabal build
real    1m0.950s
user    0m59.397s
sys     0m1.083s
```

Reviewers: ezyang, simonmar, austin, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoAdd missing stderr file
Ben Gamari [Thu, 22 Oct 2015 13:29:10 +0000 (15:29 +0200)] 
Add missing stderr file

3 years agorts/Schedule.c: remove unused variable
Ömer Sinan Ağacan [Thu, 22 Oct 2015 11:41:48 +0000 (13:41 +0200)] 
rts/Schedule.c: remove unused variable

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

3 years agoSuggest enabling PatternSynonyms (#10943)
Moritz Kiefer [Thu, 22 Oct 2015 11:40:41 +0000 (13:40 +0200)] 
Suggest enabling PatternSynonyms (#10943)

Suggest enabling PatternSynonyms if we find an invalid
signature that looks like a pattern synonym.

Reviewed By: austin, thomie

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

3 years agoAdd another test for #10549
Ben Gamari [Thu, 22 Oct 2015 11:34:30 +0000 (13:34 +0200)] 
Add another test for #10549

3 years agoStop the pipeline when it doesn't need to be run.
Edward Z. Yang [Tue, 20 Oct 2015 06:53:33 +0000 (23:53 -0700)] 
Stop the pipeline when it doesn't need to be run.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoRemove old trace statement
Richard Eisenberg [Wed, 21 Oct 2015 18:08:12 +0000 (14:08 -0400)] 
Remove old trace statement

3 years agoFix breakage in the GHCi debugger
Simon Marlow [Wed, 21 Oct 2015 13:30:06 +0000 (14:30 +0100)] 
Fix breakage in the GHCi debugger

Summary:
There was a broken offset calculation that only worked when the
sections of the binary were in a particular order, and this
broke (sometimes) after we started mapping the sections separately in
the linker (see D975).

Test Plan: ghci debugger tests now work with DYNAMIC_GHC_PROGRAMS=NO

Reviewers: austin, hvr, bgamari, erikd

Reviewed By: bgamari

Subscribers: Phyx, thomie, trommler

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

GHC Trac Issues: #10994

3 years agoFix caching of pagesize
Simon Marlow [Wed, 21 Oct 2015 09:42:57 +0000 (10:42 +0100)] 
Fix caching of pagesize

Summary: Spotted by @erikd

Test Plan: validate

Reviewers: austin, bgamari, erikd

Subscribers: thomie, erikd

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

3 years agoTestsuite: add test for #10997
Thomas Miedema [Wed, 21 Oct 2015 12:31:39 +0000 (14:31 +0200)] 
Testsuite: add test for #10997

3 years agoExtended default rules now specialize Foldable, Traversable to [] (#10971)
David Kraeutmann [Tue, 20 Oct 2015 20:39:51 +0000 (22:39 +0200)] 
Extended default rules now specialize Foldable, Traversable to [] (#10971)

Default rules deliberately accept any kind.

Reviewed By: simonpj, thomie, goldfire

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

3 years agoReject top-level typed TH splices. Fixes #10945
Jan Stolarek [Tue, 20 Oct 2015 12:09:13 +0000 (14:09 +0200)] 
Reject top-level typed TH splices. Fixes #10945

When TemplateHaskell language extension is enabled it is valid to have
top-level expressions.  Each such expression is treated as a contents
of a splice.  The problem arises with typed splices.  They are not valid
at the top level and therefore we should interpret them not as a splice
but as a top-level expression (aka. implicit splice).  So saying:

$$foo

is equivalent of:

$( $$foo )

This patch makes sure that this is indeed the case.  Until now we
incorrectly treated typed splices as explicit splices.

3 years agoTestsuite Windows: don't use forward slashes in topdir path
Thomas Miedema [Mon, 19 Oct 2015 15:23:44 +0000 (17:23 +0200)] 
Testsuite Windows: don't use forward slashes in topdir path

Changing backwards slashes to forward slashes apparently confuses
msys2/mingw magic path handling. I don't quite understand why, but this
fixes it.

Test Plan: on Windows, make sure PATH does not contain
'inplace/mingw/bin' (let the testsuite driver add it), then run: make
TEST='ghcilink003 ghcilink006'. Before this patch, it would fail.

Reviewed by: Phyx, bgamari, austin

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

3 years agoSystools.hs: Improve detection of GCC and Clang
Erik de Castro Lopo [Sat, 17 Oct 2015 08:33:38 +0000 (19:33 +1100)] 
Systools.hs: Improve detection of GCC and Clang

Test Plan: Build on Debian using `--with-gcc=clang`

Reviewers: austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #10981

3 years agobase: Have the argument of mask restore the state.
Facundo Domínguez [Mon, 19 Oct 2015 16:16:55 +0000 (18:16 +0200)] 
base: Have the argument of mask restore the state.

The implementation of `mask` and `uninterruptibleMask` assumed so far
that the restore argument would be called in a context with the same
masking state as that set by `mask` or `uninterruptibleMask`.

This patch has the restore argument restore the masking, whatever the
current masking state is.

Test Plan: validate

Reviewers: simonmar, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, qnikst

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

GHC Trac Issues: #10149

3 years agoDriver: `ghci -e` should behave like `ghc -e` (#9360)
Thomas Miedema [Sat, 17 Oct 2015 10:15:32 +0000 (12:15 +0200)] 
Driver: `ghci -e` should behave like `ghc -e` (#9360)

Patch by lukyanov.

Reviewed by: bgamari

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

3 years agofix RTS linker compilation failure on Solaris
Karel Gardas [Sun, 18 Oct 2015 20:41:40 +0000 (22:41 +0200)] 
fix RTS linker compilation failure on Solaris

Reviewers: bgamari, austin

Subscribers: thomie

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

3 years agotemplate-haskell: set explicit return=pure
Herbert Valerio Riedel [Sun, 18 Oct 2015 09:53:23 +0000 (11:53 +0200)] 
template-haskell: set explicit return=pure

This fixups a thinko in c6781a5064049e0a7c17c1f2239567a3c44955af

3 years agoMRP-refactor `GHCi` Applicative/Monad instance
Herbert Valerio Riedel [Sun, 18 Oct 2015 07:37:43 +0000 (09:37 +0200)] 
MRP-refactor `GHCi` Applicative/Monad instance

As GHCi is compiled by stage1+ GHC only, we can
drop the explicit `return` definition rightaway.

3 years agotemplate-haskell: MRP-refactor Applicative/Monad instances
Herbert Valerio Riedel [Sun, 18 Oct 2015 07:20:30 +0000 (09:20 +0200)] 
template-haskell: MRP-refactor Applicative/Monad instances

As `template-haskell` is compiled by stage1+ GHC only, we can
drop the explicit `return` definition rightaway.

3 years agoghc-pkg: Express return-method in terms of pure
Herbert Valerio Riedel [Sun, 18 Oct 2015 07:18:33 +0000 (09:18 +0200)] 
ghc-pkg: Express return-method in terms of pure

3 years agoSignals: Always install SIGUSR2 handler
Ben Gamari [Sat, 17 Oct 2015 22:07:15 +0000 (00:07 +0200)] 
Signals: Always install SIGUSR2 handler

Even if libdw isn't available.

3 years agoCmmParse: Clarify description of calling convention
Ben Gamari [Fri, 2 Oct 2015 21:49:35 +0000 (23:49 +0200)] 
CmmParse: Clarify description of calling convention

3 years agoMake Monad/Applicative instances MRP-friendly
Herbert Valerio Riedel [Sat, 17 Oct 2015 14:47:51 +0000 (16:47 +0200)] 
Make Monad/Applicative instances MRP-friendly

This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e.
such that the explicit definitions for `return` and `(>>)` match the
MRP-style default-implementation, i.e.

  return = pure

and

  (>>) = (*>)

This way, e.g. all `return = pure` definitions can easily be grepped and
removed in GHC 8.1;

Test Plan: Harbormaster

Reviewers: goldfire, alanz, bgamari, quchen, austin

Reviewed By: quchen, austin

Subscribers: thomie

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

3 years agoSignals: Print backtrace on SIGUSR2
Ben Gamari [Sat, 17 Oct 2015 14:45:26 +0000 (16:45 +0200)] 
Signals: Print backtrace on SIGUSR2

This uses the backtrace support introduced in D1196 to provide
backtraces from Haskell processes when SIGUSR2 is thrown.

Test Plan: Need to add a test.

Reviewers: scpmw, simonmar, Tarrasch, austin

Reviewed By: austin

Subscribers: thomie

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

3 years agoLibdw: Add libdw-based stack unwinding
Ben Gamari [Sat, 17 Oct 2015 14:44:01 +0000 (16:44 +0200)] 
Libdw: Add libdw-based stack unwinding

This adds basic support to the RTS for DWARF-assisted unwinding of the
Haskell and C stack via libdw. This only adds the infrastructure;
consumers of this functionality will be introduced in future diffs.

Currently we are carrying the initial register collection code in
Libdw.c but this will eventually make its way upstream to libdw.

Test Plan: See future patches

Reviewers: Tarrasch, scpmw, austin, simonmar

Reviewed By: austin, simonmar

Subscribers: simonmar, thomie, erikd

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

GHC Trac Issues: #10656

3 years agoMove Control.Monad.IO.Class to base from transformers
RyanGlScott [Sat, 17 Oct 2015 14:43:22 +0000 (16:43 +0200)] 
Move Control.Monad.IO.Class to base from transformers

See Trac #10773

Remove Control.Monad.IO.Class from `transformers`. Updates
`transformers` submodule.

See Trac #10773

Test Plan: ./validate

Reviewers: ekmett, hvr, bgamari, austin

Reviewed By: hvr, bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #10773

3 years agoSilence the linker on Windows so tests pass
Tamar Christina [Sat, 17 Oct 2015 13:19:56 +0000 (15:19 +0200)] 
Silence the linker on Windows so tests pass

Silence the unconditional debugBelch statements recently added to HEAD
which on Windows cause debug information to always be printed.

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

3 years agoBuild system: fix `make -j1` (#10973)
Thomas Miedema [Fri, 16 Oct 2015 18:28:05 +0000 (20:28 +0200)] 
Build system: fix `make -j1` (#10973)

There are multiple hacks all over the build system to account for the
fact that the ghc package uses different build subdirectories
(stage1/stage2) than the other packages (dist/dist-install).

One such hack filtered on 'ghc%', with the intention of filtering the
ghc package only. After renaming bin-package-db to ghc-boot
(d2f9972a35ce05ceb8a78893e433ef1df06f73ef, Phab:D1313, #10796), ghc-boot
also got caught in the hack, which broke the build when running without
parallelism.

This patch replaces the before mentioned hack by a different one, such
that filtering on 'ghc%' is no longer necessary. See Note [inconsistent
distdirs].

Reviewed by: austin

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

3 years agobase: MINIMAL pragmas for Arrow/ArrowChoice
Austin Seipp [Fri, 16 Oct 2015 20:56:18 +0000 (15:56 -0500)] 
base: MINIMAL pragmas for Arrow/ArrowChoice

Summary: This was left off in the previous commits.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Reviewed By: ekmett

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

3 years agobase: changelog entries for Arrow/ArrowChoice
Austin Seipp [Fri, 16 Oct 2015 19:27:52 +0000 (14:27 -0500)] 
base: changelog entries for Arrow/ArrowChoice

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agoAllow left ∨ (+++) as minimal definition of ArrowChoice instance
M Farkas-Dyck [Wed, 23 Sep 2015 17:35:34 +0000 (10:35 -0700)] 
Allow left ∨ (+++) as minimal definition of ArrowChoice instance

See #10911.

Reviewers: ekmett

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agoAdd typed holes support in Template Haskell.
Jan Stolarek [Tue, 8 Sep 2015 17:19:44 +0000 (19:19 +0200)] 
Add typed holes support in Template Haskell.

Fixes #10267. Typed holes in typed Template Haskell currently don't work.
See #10945 and #10946.

3 years agoImplement DuplicateRecordFields
Adam Gundry [Fri, 16 Oct 2015 15:08:31 +0000 (16:08 +0100)] 
Implement DuplicateRecordFields

This implements DuplicateRecordFields, the first part of the
OverloadedRecordFields extension, as described at
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields

This includes fairly wide-ranging changes in order to allow multiple
records within the same module to use the same field names.  Note that
it does *not* allow record selector functions to be used if they are
ambiguous, and it does not have any form of type-based disambiguation
for selectors (but it does for updates). Subsequent parts will make
overloading selectors possible using orthogonal extensions, as
described on the wiki pages.  This part touches quite a lot of the
codebase, and requires changes to several GHC API datatypes in order
to distinguish between field labels (which may be overloaded) and
selector function names (which are always unique).

The Haddock submodule has been adapted to compile with the GHC API
changes, but it will need further work to properly support modules
that use the DuplicateRecordFields extension.

Test Plan: New tests added in testsuite/tests/overloadedrecflds; these
will be extended once the other parts are implemented.

Reviewers: goldfire, bgamari, simonpj, austin

Subscribers: sjcjoosten, haggholm, mpickering, bgamari, tibbe, thomie,
goldfire

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

3 years agoRemove dead function patSynTyDetails
Simon Peyton Jones [Fri, 16 Oct 2015 11:08:35 +0000 (12:08 +0100)] 
Remove dead function patSynTyDetails

And that allows us to remove the nasty import of HsBinds,
which has no business in this module.

3 years agorts/Linker.c : Fix armhf build (#10977)
Erik de Castro Lopo [Fri, 16 Oct 2015 06:00:43 +0000 (17:00 +1100)] 
rts/Linker.c : Fix armhf build (#10977)

Test Plan: Validate on x86_64, PowerPC and Arm

Reviewers: simonmar, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #10977

3 years agoFix windows build after D975
Tamar Christina [Fri, 16 Oct 2015 07:46:59 +0000 (09:46 +0200)] 
Fix windows build after D975

Add a missing #ifdef

Reviewed By: simonmar

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

3 years agoELF/x86_64: map object file sections separately into the low 2GB
Simon Marlow [Thu, 15 Oct 2015 15:17:06 +0000 (16:17 +0100)] 
ELF/x86_64: map object file sections separately into the low 2GB

On 64-bit ELF we need to link object files into the low 2GB due to the
small memory model.  Previously we would map the entire object file
using MAP_32BIT, but the object file can consist of 75% or more
symbols, which only need to be present during linking, so this is
wasteful.  In our particular application, we're already running out of
space here.

This patch changes the way we load object files on ELF platforms so
that the object is first mapped above the 2GB boundary, parsed, and
then the important sections are re-mapped into the low 2GB area.

Test Plan:
validate
(also needs testing on OS X & Windows, preferably 32 & 64 bit)

Reviewers: Phyx, trommler, bgamari, austin

Subscribers: hsyl20, thomie, bgamari

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

3 years agoMinor stylistic update.
Edward Z. Yang [Thu, 15 Oct 2015 04:07:03 +0000 (21:07 -0700)] 
Minor stylistic update.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoRename PACKAGE_KEY and LIB_NAME in build system.
Edward Z. Yang [Sun, 11 Oct 2015 20:41:20 +0000 (13:41 -0700)] 
Rename PACKAGE_KEY and LIB_NAME in build system.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoRename package key to unit ID, and installed package ID to component ID.
Edward Z. Yang [Sun, 11 Oct 2015 18:03:10 +0000 (11:03 -0700)] 
Rename package key to unit ID, and installed package ID to component ID.

Comes with Haddock submodule update.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoUpdate Cabal to HEAD, IPID renamed to Component ID.
Edward Z. Yang [Tue, 25 Aug 2015 18:24:28 +0000 (11:24 -0700)] 
Update Cabal to HEAD, IPID renamed to Component ID.

This commit contains a Cabal submodule update which unifies installed
package IDs and package keys under a single notion, a Component ID.
We update GHC to keep follow this unification.  However, this commit
does NOT rename installed package ID to component ID and package key to
unit ID; the plan is to do that in a companion commit.

    - Compiler info now has "Requires unified installed package IDs"

    - 'exposed' is now expected to contain unit keys, not IPIDs.

    - Shadowing is no more.  We now just have a very simple strategy
      to deal with duplicate unit keys in combined package databases:
      if their ABIs are the same, use the latest one; otherwise error.
      Package databases maintain the invariant that there can only
      be one entry of a unit ID.

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

Reviewers: simonpj, austin, bgamari, hvr, goldfire

Subscribers: thomie

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

GHC Trac Issues: #10714

3 years agoUser should use -package-id flag if value in question is IPID.
Edward Z. Yang [Sun, 11 Oct 2015 18:21:31 +0000 (11:21 -0700)] 
User should use -package-id flag if value in question is IPID.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoFix GHCi on Arm (#10375).
Erik de Castro Lopo [Sun, 11 Oct 2015 05:48:11 +0000 (16:48 +1100)] 
Fix GHCi on Arm (#10375).

Arm has two instruction sets, Arm and Thumb, and an execution mode for each.
Executing Arm code in Thumb mode or vice-versa will likely result in an
Illegal instruction exception.

Furthermore, Haskell code compiled via LLVM was generating Arm instructions
while C code compiled via GCC was generating Thumb code by default. When
these two object code types were being linked by the system linker, all was
fine, because the system linker knows how to jump and call from one
instruction set to the other.

The first problem was with GHCi's object code loader which did not know
about Thumb vs Arm. When loading an object file `StgCRun` would jump
into the loaded object which could change the mode causing a crash after
it returned. This was fixed by forcing all C code to generate Arm
instructions by passing `-marm` to GCC.

The second problem was the `mkJumpToAddr` function which was generating
Thumb instructions. Changing that to generate Arm instructions instead
results in a working GHCi on Arm.

Test Plan: validate on x86_64 and arm

Reviewers: bgamari, austin, hvr

Subscribers: thomie

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

GHC Trac Issues: #10375

3 years agotravis: use LLVM 3.7
Austin Seipp [Wed, 14 Oct 2015 00:14:01 +0000 (19:14 -0500)] 
travis: use LLVM 3.7

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agoSwitch to LLVM version 3.7
Erik de Castro Lopo [Fri, 9 Oct 2015 23:54:24 +0000 (10:54 +1100)] 
Switch to LLVM version 3.7

Before this commit, GHC only supported LLVM 3.6. Now it only supports
LLVM 3.7 which was released in August 2015. LLVM version 3.6 and earlier
do not work on AArch64/Arm64, but 3.7 does.

Also:
* Add CC_Ghc constructor to LlvmCallConvention.
* Replace `maxSupportLlvmVersion`/`minSupportLlvmVersion` with
  a single `supportedLlvmVersion` variable.
* Get `supportedLlvmVersion` from version specified in configure.ac.
* Drop llvmVersion field from DynFlags (no longer needed because only
  one version is supported).

Test Plan: Validate on x86_64 and arm

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #10953

3 years agoAllow arr ∧ (first ∨ (***)) as minimal definition of Arrow instance
M Farkas-Dyck [Mon, 30 Mar 2015 03:57:46 +0000 (22:57 -0500)] 
Allow arr ∧ (first ∨ (***)) as minimal definition of Arrow instance

See #10216.

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agobase: Add forkOSWithUnmask
Joey Adams [Sat, 22 Jun 2013 03:19:34 +0000 (23:19 -0400)] 
base: Add forkOSWithUnmask

Fixes #8010, according to the specified libraries proposal. [1]

Also, some minor wordsmithing.

  [1] http://thread.gmane.org/gmane.comp.lang.haskell.libraries/22709

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agodocs: overhaul Derive{Functor,Foldable,Traversable} notes
RyanGlScott [Tue, 13 Oct 2015 05:58:13 +0000 (00:58 -0500)] 
docs: overhaul Derive{Functor,Foldable,Traversable} notes

The previous users' guide documentation was too implementation-oriented. This
attempts to make it more accessible to those who aren't familiar with how
`-XDeriveFunctor` and friends work (and more importantly, what will not work
when using them).

Fixes #10831.

Reviewed By: austin

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

GHC Trac Issues: #10831

3 years agoFix incorrect import warnings when methods with identical names are imported
Ömer Sinan Ağacan [Tue, 13 Oct 2015 05:47:28 +0000 (00:47 -0500)] 
Fix incorrect import warnings when methods with identical names are imported

Currently, GHC's warning generation code is assuming that a name (`RdrName`)
can be imported at most once. This is a correct assumption, because 1) it's OK
to import same names as long as we don't use any of them 2) when we use one of
them, GHC generates an error because it doesn't disambiguate it automatically.

But apparently the story is different with typeclass methods. If I import two
methods with same names, it's OK to use them in typeclass instance
declarations, because the context specifies which one to use. For example, this
is OK (where modules A and B define typeclasses A and B, both with a function
has),

    import A
    import B

    data Blah = Blah

    instance A Blah where
      has = Blah

    instance B Blah where
      has = Blah

But GHC's warning generator is not taking this into account, and so if I change
import list of this program to:

    import A (A (has))
    import B (B (has))

GHC is printing these warnings:

    Main.hs:5:1: Warning:
        The import of ‘A.has’ from module ‘A’ is redundant

    Main.hs:6:1: Warning:
        The import of ‘B.has’ from module ‘B’ is redundant

Why? Because warning generation code is _silently_ ignoring multiple symbols
with same names.

With this patch, GHC takes this into account. If there's only one name, then
this patch reduces to the previous version, that is, it works exactly the same
as current GHC (thanks goes to @quchen for realizing this).

Reviewed By: austin

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

GHC Trac Issues: #10890

3 years agoMake dataToQa aware of Data instances which use functions to implement toConstr
RyanGlScott [Tue, 13 Oct 2015 05:43:32 +0000 (00:43 -0500)] 
Make dataToQa aware of Data instances which use functions to implement toConstr

Trac #10796 exposes a way to make `template-haskell`'s `dataToQa` function
freak out if using a `Data` instance that produces a `Constr` (by means of
`toConstr`) using a function name instead of a data constructor name. While
such `Data` instances are somewhat questionable, they are nevertheless present
in popular libraries (e.g., `containers`), so we can at least make `dataToQa`
aware of their existence.

In order to properly distinguish strings which represent variables (as opposed
to data constructors), it was necessary to move functionality from `Lexeme` (in
`ghc`) to `GHC.Lexeme` in a new `ghc-boot` library (which was previously named
`bin-package-db`).

Reviewed By: goldfire, thomie

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

GHC Trac Issues: #10796

3 years agoSlightly wibble TcSimplify documentation
Alexander Berntsen [Tue, 13 Oct 2015 05:35:22 +0000 (00:35 -0500)] 
Slightly wibble TcSimplify documentation

Add some commas, fix some typos, etc.

Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
Reviewed By: austin

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

3 years agotestsuite: attempt fixing T10935 output
Austin Seipp [Tue, 13 Oct 2015 02:35:25 +0000 (21:35 -0500)] 
testsuite: attempt fixing T10935 output

This fallout was caused by f8fbf385b879fe17740 (see #10935), and looks easy
enough, but admittedly I just tried patching the output, so we're doing it
live.

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agoDon't inline/apply other rules when simplifying a rule RHS.
Andrew Farmer [Tue, 13 Oct 2015 02:27:41 +0000 (21:27 -0500)] 
Don't inline/apply other rules when simplifying a rule RHS.

HERMIT users depend on RULES to specify equational properties. 7.10.2
performed both inlining and simplification in both sides of the rules, meaning
they can't really be used for this. This breaks most HERMIT use cases.  A
separate commit already disabled this for the LHS of rules. This does so for
the RHS.

See Trac #10829 for nofib results.

Reviewed By: austin, bgamari, simonpj

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

GHC Trac Issues: #10829

3 years agoReinstate monomorphism-restriction warnings
Simon Peyton Jones [Mon, 12 Oct 2015 15:23:56 +0000 (16:23 +0100)] 
Reinstate monomorphism-restriction warnings

This patch is driven by Trac #10935, and reinstates the
-fwarn-monomorphism-restriction warning.  It was first lost in 2010:
d2ce0f52d "Super-monster patch implementing the new typechecker -- at
last"

I think the existing documentation is accurate; it is not even
turned on by -Wall.

I added one test.

3 years agoTest Trac #10931
Simon Peyton Jones [Tue, 6 Oct 2015 11:43:10 +0000 (12:43 +0100)] 
Test Trac #10931

3 years agobase: MRP-refactoring of AMP instances
Herbert Valerio Riedel [Mon, 12 Oct 2015 09:36:01 +0000 (11:36 +0200)] 
base: MRP-refactoring of AMP instances

This refactors `(>>)`/`(*>)`/`return`/`pure` methods into normal form.

The redundant explicit `return` method definitions are dropped
altogether.

The explicit `(>>) = (*>)` definitions can't be removed yet, as
the default implementation of `(>>)` is still in terms of `(*>)`
(even though that should have been changed according to the AMP but
wasn't -- see note in GHC.Base for details why this had to be postponed)

A nofib comparision shows this refactoring to result in minor runtime
improvements (unless those are within normal measurement fluctuations):

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
  -------------------------------------------------------------------------
            Min          -0.0%     -0.0%     -1.6%     -3.9%     -1.1%
            Max          -0.0%     +0.0%     +0.5%     +0.5%      0.0%
  Geometric Mean         -0.0%     -0.0%     -0.4%     -0.5%     -0.0%

Full `nofib` report at https://phabricator.haskell.org/P68

Reviewers: quchen, alanz, austin, #core_libraries_committee, bgamari

Reviewed By: bgamari

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

3 years agoPPC: Fix right shift by 32 bits #10870
Erik de Castro Lopo [Sun, 13 Sep 2015 08:57:40 +0000 (18:57 +1000)] 
PPC: Fix right shift by 32 bits #10870

Summary: Test included.

Test Plan: Run test T10870.hs on X86/X86_64/Arm/Arm64 etc

Reviewers: bgamari, nomeata, austin

Subscribers: thomie

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

GHC Trac Issues: #10870

3 years agocompiler/nativeGen/PPC/Ppr.hs: Whitespace
Erik de Castro Lopo [Sun, 13 Sep 2015 09:48:22 +0000 (19:48 +1000)] 
compiler/nativeGen/PPC/Ppr.hs: Whitespace

3 years agoDelete ShPackageKey for now.
Edward Z. Yang [Sat, 10 Oct 2015 19:00:55 +0000 (12:00 -0700)] 
Delete ShPackageKey for now.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoTestsuite: T3333 still fails on non-linux statically linked ghci (#3333)
Thomas Miedema [Sat, 10 Oct 2015 16:28:20 +0000 (18:28 +0200)] 
Testsuite: T3333 still fails on non-linux statically linked ghci (#3333)

3 years agosphinx: Don't share doctrees between targets
Ben Gamari [Sat, 10 Oct 2015 13:12:59 +0000 (15:12 +0200)] 
sphinx: Don't share doctrees between targets

Sphinx may trip over itself when multiple instances are run in parallel.

Fixes #10950.

3 years agoRename SpecInfo to RuleInfo (upon SPJ's advice).
Edward Z. Yang [Sat, 10 Oct 2015 12:34:21 +0000 (14:34 +0200)] 
Rename SpecInfo to RuleInfo (upon SPJ's advice).

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoKeep `shift{L,R}` on `Integer` from segfaulting
Ben Gamari [Sat, 10 Oct 2015 12:32:28 +0000 (14:32 +0200)] 
Keep `shift{L,R}` on `Integer` from segfaulting

This can happen because the underlying primitive operations in
`integer-gmp` don't support negative shift-amounts, and since
`integer-gmp` can't throw proper exceptions and just provides a
low-level API, it simply segfaults instead...

This patch simply removes the `shift{L,R}` method definitions (and
defines `unsafeShift{L,R}` instead) whose default-impls fallback on
using `shift` which properly handles negative shift arguments.

This addresses #10571

Test Plan: harbormaster can do it

Reviewers: hvr, austin, rwbarton

Subscribers: rwbarton, thomie, bgamari

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

GHC Trac Issues: #10571

3 years agoAdd short library names support to Windows linker
Tamar Christina [Sat, 10 Oct 2015 13:21:09 +0000 (15:21 +0200)] 
Add short library names support to Windows linker

Make Linker.hs try asking gcc for lib%s.dll as well, also changed tryGcc
to pass -L to all components by using -B instead. These two fix
shortnames linking on windows.

re-enabled tests: ghcilink003, ghcilink006 and T3333
Added two tests: load_short_name and enabled T1407 on windows.

Reviewed By: thomie, bgamari

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

GHC Trac Issues: #9878, #1407, #1883, #5289

3 years agoFix error msg: ghci can't be used with -prof or -static (#10936)
Thomas Miedema [Wed, 7 Oct 2015 10:03:04 +0000 (12:03 +0200)] 
Fix error msg: ghci can't be used with -prof or -static (#10936)

Reviewed by: austin

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

3 years agoRevert "Switch to LLVM version 3.7"
Erik de Castro Lopo [Fri, 9 Oct 2015 23:47:37 +0000 (10:47 +1100)] 
Revert "Switch to LLVM version 3.7"

Pushed by mistacke before it was ready.

This reverts commit 5dc3db743ec477978b9727a313951be44dbd170f.

3 years agoSwitch to LLVM version 3.7
Erik de Castro Lopo [Thu, 8 Oct 2015 21:21:55 +0000 (08:21 +1100)] 
Switch to LLVM version 3.7

3 years agoSimplify type of ms_srcimps and ms_textual_imps.
Edward Z. Yang [Thu, 8 Oct 2015 22:03:01 +0000 (15:03 -0700)] 
Simplify type of ms_srcimps and ms_textual_imps.

Summary:
Previously, we stored an entire ImportDecl, which was pretty
wasteful since all we really cared about was the package qualifier
and the module name.

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

Reviewers: bgamari, austin

Subscribers: thomie

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

3 years agoIgnore __pycache__.
Edward Z. Yang [Fri, 9 Oct 2015 17:27:31 +0000 (10:27 -0700)] 
Ignore __pycache__.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoDisable man building for most quick build styles.
Edward Z. Yang [Fri, 9 Oct 2015 17:25:20 +0000 (10:25 -0700)] 
Disable man building for most quick build styles.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoExtra files to ignore from the new Restructured documentation.
Edward Z. Yang [Fri, 9 Oct 2015 07:27:38 +0000 (00:27 -0700)] 
Extra files to ignore from the new Restructured documentation.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoMove orphan instance/rule warnings to typechecker/desugarer.
Edward Z. Yang [Thu, 1 Oct 2015 22:24:41 +0000 (15:24 -0700)] 
Move orphan instance/rule warnings to typechecker/desugarer.

Summary:
Instead of doing these warnings at MkIface time, we do them
when we create the instances/rules in the typechecker/desugarer.

Emitting warnings for auto-generated instances was a pain
(since the specialization monad doesn't have the capacity
to emit warnings) so instead I just deprecated -fwarn-auto-orphans.
Auto rule orphans are pretty harmless anyway: they don't cause
interface files to be eagerly loaded in.

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/D1297

3 years agoTests for #10945 and #10946
Jan Stolarek [Thu, 8 Oct 2015 12:10:42 +0000 (14:10 +0200)] 
Tests for #10945 and #10946

3 years agoParser: revert some error messages to what they were before 7.10
Thomas Miedema [Thu, 8 Oct 2015 01:36:54 +0000 (20:36 -0500)] 
Parser: revert some error messages to what they were before 7.10

Among doing other things, Phab:D201 (bc2289e13d9586be087bd8136943dc35a0130c88)
tried to improve the error messages thrown by the parser. For example a missing
else clause now prints "parse error in if statement: else clause empty" instead
of "parse error (possibly incorrect indentation or mismatched brackets)".

Some error messages got much worse however (see tests), and the result seems to
be a net negative. Although not entirely satisfactory, this commits therefore
reverts those parser changes.

Reviewed By: austin

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

GHC Trac Issues: #10498

3 years agoAllow non-operator infix pattern synonyms
Matthew Pickering [Thu, 8 Oct 2015 01:36:38 +0000 (20:36 -0500)] 
Allow non-operator infix pattern synonyms

For example

```
pattern head `Cons` tail = head : tail
```

Reviewed By: goldfire, austin

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

GHC Trac Issues: #10747

3 years agoImprove error messages for ambiguous type variables
David Kraeutmann [Thu, 8 Oct 2015 01:28:46 +0000 (20:28 -0500)] 
Improve error messages for ambiguous type variables

Improved error messages are only printed when the old message would be
"No instance for...", since they're not as helpful for "Could not deduce..."

No special test case as error messages are tested by other tests already.

Signed-off-by: David Kraeutmann <kane@kane.cx>
Reviewed By: austin, goldfire

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

GHC Trac Issues: #10733

3 years agoEnsure shiftL/shiftR arguments aren't negative
Ben Gamari [Tue, 6 Oct 2015 17:30:50 +0000 (19:30 +0200)] 
Ensure shiftL/shiftR arguments aren't negative

Fixes #10571.

3 years agoAsmCodeGen: Ensure LLVM .line directives are sorted
Ben Gamari [Tue, 6 Oct 2015 16:29:03 +0000 (18:29 +0200)] 
AsmCodeGen: Ensure LLVM .line directives are sorted

Apparently some Clang 3.6 expects these to be sorted.

Patch due to Peter Wortmann.

Fixes #10687.

3 years agoDocumentation for FrontendResult
Edward Z. Yang [Tue, 6 Oct 2015 17:14:39 +0000 (10:14 -0700)] 
Documentation for FrontendResult

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoComments about TcLevel assignment
Simon Peyton Jones [Tue, 6 Oct 2015 11:36:30 +0000 (12:36 +0100)] 
Comments about TcLevel assignment

Triggered by investigations around Trac 10845

3 years agoComments only
Simon Peyton Jones [Tue, 6 Oct 2015 08:53:18 +0000 (09:53 +0100)] 
Comments only

3 years agoRemove dead code: ruleLhsOrphNames
Simon Peyton Jones [Tue, 6 Oct 2015 08:53:07 +0000 (09:53 +0100)] 
Remove dead code: ruleLhsOrphNames

3 years agoFix kind-var abstraction in SimplUtils.abstractFloats
Simon Peyton Jones [Tue, 6 Oct 2015 08:52:21 +0000 (09:52 +0100)] 
Fix kind-var abstraction in SimplUtils.abstractFloats

A missing 'closeOverKinds' triggered Trac #10934.
Happily the fix is simple.

Merge to 7.10.3

3 years agoComments only
Simon Peyton Jones [Fri, 2 Oct 2015 07:39:26 +0000 (08:39 +0100)] 
Comments only

3 years agoDeduplicate one-shot/make compile paths.
Edward Z. Yang [Sat, 3 Oct 2015 05:05:24 +0000 (22:05 -0700)] 
Deduplicate one-shot/make compile paths.

Summary:
We had a duplicate copy of the code for --make and for -c
which was a pain.  The call graph looked something like this:

    compileOne -> genericHscCompileGetFrontendResult -> genericHscFrontend
                                   hscCompileOneShot ---^

with genericHscCompileGetFrontendResult and hscCompileOneShot
duplicating logic for deciding whether or not recompilation
was needed.

This patchset fixes it, so now everything goes through this call-chain:

    compileOne (--make entry point)
        Calls hscIncrementCompile, invokes the pipeline to do codegen
        and sets up linkables.
    hscIncrementalCompile (-c entry point)
        Calls hscIncrementalFrontend, and then simplifying,
        desugaring, and writing out the interface.
    hscIncrementalFrontend
        Performs recompilation avoidance, if recompilation needed,
        does parses typechecking.

I also cleaned up some of the MergeBoot nonsense by introducing
a FrontendResult type.

NB: this BREAKS #8101 again, because I can't unconditionally desugar
due to Haddock barfing on lint, see #10600

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

Reviewers: simonpj, bgamari, simonmar, austin

Subscribers: thomie

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

3 years agoTestsuite: make driver python 2.6 compatible again
Thomas Miedema [Mon, 5 Oct 2015 15:32:02 +0000 (17:32 +0200)] 
Testsuite: make driver python 2.6 compatible again

Reviewed by: kgardas

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

3 years agoA few typos in comments
Gabor Greif [Mon, 5 Oct 2015 12:05:56 +0000 (14:05 +0200)] 
A few typos in comments

3 years agoTestsuite: only add -fno-warn-missed-specialisations for ghc>=7.11
Thomas Miedema [Sun, 4 Oct 2015 16:46:12 +0000 (18:46 +0200)] 
Testsuite: only add -fno-warn-missed-specialisations for ghc>=7.11

It should be possible to run the testsuite with older versions of GHC.

Reviewed by: austin

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

3 years agoBuild system: don't create mk/are-validating.mk
Thomas Miedema [Sat, 3 Oct 2015 19:42:52 +0000 (21:42 +0200)] 
Build system: don't create mk/are-validating.mk

A `make` build after running `./validate` earlier should use the normal
mk/build.mk settings, without having to manually delete the leftover
file mk/are-validating or run `make clean` first.

Reviewed by: austin

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