ghc.git
5 years agoRevert "Per-thread allocation counters and limits"
Simon Marlow [Sun, 4 May 2014 19:27:42 +0000 (20:27 +0100)] 
Revert "Per-thread allocation counters and limits"

Problems were found on 32-bit platforms, I'll commit again when I have a fix.

This reverts the following commits:
   54b31f744848da872c7c6366dea840748e01b5cf
   b0534f78a73f972e279eed4447a5687bd6a8308e

5 years agoImprove docs for array indexing primops
Johan Tibell [Sun, 4 May 2014 09:32:15 +0000 (11:32 +0200)] 
Improve docs for array indexing primops

5 years agoUpdate comment now that we have per-gen weak pointer lists.
Edward Z. Yang [Sun, 4 May 2014 08:18:54 +0000 (01:18 -0700)] 
Update comment now that we have per-gen weak pointer lists.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agofix rts exported symbols base_GHCziIOziException_allocationLimitExceeded_closure
Sergei Trofimovich [Sat, 3 May 2014 19:29:14 +0000 (22:29 +0300)] 
fix rts exported symbols base_GHCziIOziException_allocationLimitExceeded_closure

Commit  b0534f78a73f972e279eed4447a5687bd6a8308e added new exported rts symbols,
but slightly misspelled them.

Observer on first compiled program:
> Linking dist/build/haskell-updater/haskell-updater ...
> /usr/lib64/ghc-7.9.20140503/rts-1.0/libHSrts.a(Schedule.o): In function `scheduleWaitThread':
> (.text+0xc4c): undefined reference to `base_GHCziIOziException_allocationLimitExceeded_closure'
> /usr/lib64/ghc-7.9.20140503/rts-1.0/libHSrts.a(RtsStartup.o): In function `hs_init_ghc':
> (.text+0x2fa): undefined reference to `base_GHCziIOziException_allocationLimitExceeded_closure'
> collect2: error: ld returned 1 exit status

CC: Simon Marlow <marlowsd@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agoRemove external core
Austin Seipp [Mon, 28 Apr 2014 02:11:23 +0000 (21:11 -0500)] 
Remove external core

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoUpdate Haddock submodule ref. Fixes `cabal test'.
Mateusz Kowalczyk [Sat, 3 May 2014 13:43:00 +0000 (15:43 +0200)] 
Update Haddock submodule ref. Fixes `cabal test'.

5 years agoPer-thread allocation counters and limits
Simon Marlow [Mon, 28 Apr 2014 15:55:47 +0000 (16:55 +0100)] 
Per-thread allocation counters and limits

This tracks the amount of memory allocation by each thread in a
counter stored in the TSO.  Optionally, when the counter drops below
zero (it counts down), the thread can be sent an asynchronous
exception: AllocationLimitExceeded.  When this happens, given a small
additional limit so that it can handle the exception.  See
documentation in GHC.Conc for more details.

Allocation limits are similar to timeouts, but

  - timeouts use real time, not CPU time.  Allocation limits do not
    count anything while the thread is blocked or in foreign code.

  - timeouts don't re-trigger if the thread catches the exception,
    allocation limits do.

  - timeouts can catch non-allocating loops, if you use
    -fno-omit-yields.  This doesn't work for allocation limits.

I couldn't measure any impact on benchmarks with these changes, even
for nofib/smp.

5 years agoReplace all #!/usr/bin/perl with #!/usr/bin/env perl
Joachim Breitner [Wed, 30 Apr 2014 09:22:32 +0000 (11:22 +0200)] 
Replace all #!/usr/bin/perl with #!/usr/bin/env perl

As suggested in #9057.

5 years agoDon't inline non-register GlobalRegs
Simon Marlow [Tue, 29 Apr 2014 19:32:50 +0000 (20:32 +0100)] 
Don't inline non-register GlobalRegs

5 years agoRts: Reuse scavenge_small_bitmap (#8742)
Arash Rouhani [Thu, 6 Feb 2014 08:10:03 +0000 (09:10 +0100)] 
Rts: Reuse scavenge_small_bitmap (#8742)

The function was inlined at two places already. And the function is
having the STATIC_INLINE annotation, so the assembly output should.
be the same.

To convince myself, I did diff the output of the object files before
and after the patch and they matched on my 64-bit Ubuntu 13.10 machine,
running gcc 4.8.1-10ubuntu9.

Also, I had to move scavenge_small_bitmap up a bit since it's not in any
.h-file.

While I was at it, I also applied the analogous patch for Compact.c.
Though I had to write `thread_small_bitmap` instead of just moving it.

5 years agoRts: Consistently use StgWord for sizes of bitmaps
Arash Rouhani [Thu, 13 Feb 2014 14:28:11 +0000 (15:28 +0100)] 
Rts: Consistently use StgWord for sizes of bitmaps

A long debate is in issue #8742, but the main motivation is that this
allows for applying a patch to reuse the function scavenge_small_bitmap
without changing the .o-file output.

Similarly, I changed the types in rts/sm/Compact.c, so I can create
a STATIC_INLINE function for the redundant code block:

        while (size > 0) {
            if ((bitmap & 1) == 0) {
                thread((StgClosure **)p);
            }
            p++;
            bitmap = bitmap >> 1;
            size--;
        }

5 years agorts: Fix memory leak when loading ELF objects
Austin Seipp [Tue, 29 Apr 2014 14:09:25 +0000 (09:09 -0500)] 
rts: Fix memory leak when loading ELF objects

Issue discovered by Coverity Scan, CID 43168.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agorts: Fix leak of file archive handle
Austin Seipp [Tue, 29 Apr 2014 14:05:38 +0000 (09:05 -0500)] 
rts: Fix leak of file archive handle

Issue discovered by Coverity Scan, CID 43171.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agorts: Add an initial Coverity model
Austin Seipp [Tue, 29 Apr 2014 15:07:50 +0000 (10:07 -0500)] 
rts: Add an initial Coverity model

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoAdd Note [Role twiddling functions] to Coercion.
Richard Eisenberg [Tue, 29 Apr 2014 15:55:56 +0000 (11:55 -0400)] 
Add Note [Role twiddling functions] to Coercion.

This commit also makes better names for several of these functions,
and removes one that went unused.

5 years agoRevert "rts: Add an initial Coverity model"
Austin Seipp [Tue, 29 Apr 2014 14:59:01 +0000 (09:59 -0500)] 
Revert "rts: Add an initial Coverity model"

This reverts commit 4539400a72ded7fa69149b28cfa9c84464f4739d.

5 years agorts: Add an initial Coverity model
Austin Seipp [Tue, 29 Apr 2014 13:48:57 +0000 (08:48 -0500)] 
rts: Add an initial Coverity model

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoTypo in comment
Gabor Greif [Tue, 29 Apr 2014 13:38:29 +0000 (15:38 +0200)] 
Typo in comment

5 years agoTypo in comments
Gabor Greif [Tue, 29 Apr 2014 13:34:29 +0000 (15:34 +0200)] 
Typo in comments

5 years agoFix scavenge_stack crash (#9045)
Simon Marlow [Mon, 28 Apr 2014 15:36:29 +0000 (16:36 +0100)] 
Fix scavenge_stack crash (#9045)

The new stg_gc_prim_p_ll stack frame was missing an info table.  This
is a regression since 7.6, because this stuff was part of a cleanup
that happened in 7.7.

5 years agoImprove implementation of unSubCo_maybe.
Richard Eisenberg [Mon, 28 Apr 2014 17:33:13 +0000 (13:33 -0400)] 
Improve implementation of unSubCo_maybe.

This is the result of an email conversation (off list) with
Conal Elliott, who needed a stronger unSubCo_maybe. This
commit adds cases to upgrade the role of a coercion when
recursion is necessary to do say (for example, for a use of
TransCo). As a side effect, more coercion optimizations are
now possible.

This was not done previously because unSubCo_maybe was used
only during coercion optimization, and the recursive cases
looked to be unlikely. However, adding them can cause no harm.

unSubCo_maybe is now also exported from Coercion, for use
cases like Conal's.

5 years agoannth_make, annth_compunits: Only run these tests if have_dynamic()
Joachim Breitner [Mon, 28 Apr 2014 14:14:10 +0000 (16:14 +0200)] 
annth_make, annth_compunits: Only run these tests if have_dynamic()

5 years agoPrint for-alls more often (Trac #9018)
Simon Peyton Jones [Mon, 28 Apr 2014 13:49:21 +0000 (14:49 +0100)] 
Print for-alls more often (Trac #9018)

We now display the foralls of a type if any of the type variables
is polykinded.  This put kind polymorphism "in your face" a bit more
often, but eliminates a lot of head scratching.

The user manual reflects the new behaviour.

5 years agotcrun045 should fail (implicit parameter as superclass)
Simon Peyton Jones [Mon, 28 Apr 2014 09:31:15 +0000 (10:31 +0100)] 
tcrun045 should fail (implicit parameter as superclass)

5 years agoAdd a comprehensive test for using Annotations from TH
Gergely Risko [Fri, 25 Apr 2014 13:39:26 +0000 (15:39 +0200)] 
Add a comprehensive test for using Annotations from TH

The provided tests test both annotation generation and reification
from Template Haskell.  Both --make and compilation via separate
units (ghc -c) are tested.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoFix annotation reification for home package modules
Gergely Risko [Fri, 25 Apr 2014 13:35:58 +0000 (15:35 +0200)] 
Fix annotation reification for home package modules

The reifyAnnotation method of the Q monad correctly gathered annotations
from TCG and EPS.  Unfortunately it didn't look into the Home Package
Table.  This resulted in annotations not being found if they are in the
same package as the splice that is reifying and ghc --make is used for
compilation management.  Fix this by using the already existing
prepareAnnotations method from HscTypes.lhs that correctly searches
in HPT and EPS both.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoStart on 7.10.1 release notes
Austin Seipp [Mon, 28 Apr 2014 09:31:14 +0000 (04:31 -0500)] 
Start on 7.10.1 release notes

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoUpdate 32-bit perf numbers
Simon Peyton Jones [Thu, 24 Apr 2014 23:07:20 +0000 (00:07 +0100)] 
Update 32-bit perf numbers

Many of these have never been initialised, I think.  They
were simply guesses from the 64-bit version.

5 years agoRemove the definition of die, which is now provided by System.Exit
Simon Peyton Jones [Thu, 24 Apr 2014 23:06:08 +0000 (00:06 +0100)] 
Remove the definition of die, which is now provided by System.Exit

5 years agoDo type-class defaulting even if there are insoluble constraints
Simon Peyton Jones [Thu, 24 Apr 2014 23:04:45 +0000 (00:04 +0100)] 
Do type-class defaulting even if there are insoluble constraints

The argument in Trac #9033 is very compelling: we should not report 20
errors, fix one, and have the other 19 disappear.  They were spurious
in the first place.

The fix was easy; do type-class defaulting uncondionally, rather than
only if there are no insoluble constraints.

See Note [When to do type-class defaulting] in TcSimplify.

Error messages generally improve, especially tc211 which actually
had an example of precisely this phenomenon.

5 years agorm -rf ./docs/comm
Austin Seipp [Mon, 28 Apr 2014 09:13:07 +0000 (04:13 -0500)] 
rm -rf ./docs/comm

The Commentary is now on the wiki and far more complete. This copy will
of course live on in the annals of history, but there's no reason to
keep it around still.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoTest Trac #9036
Simon Peyton Jones [Mon, 28 Apr 2014 07:55:32 +0000 (08:55 +0100)] 
Test Trac #9036

5 years agoDon't require mk/config.mk for all cleanup targets
Herbert Valerio Riedel [Sun, 27 Apr 2014 17:15:16 +0000 (19:15 +0200)] 
Don't require mk/config.mk for all cleanup targets

`make clean` did already ignore a missing mk/config.mk,
but `make distclean` and `make maintainer-clean` didn't.
This commit rectifies this oversight.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFix memleak in hp2ps
Nicolas Trangez [Wed, 23 Apr 2014 19:14:23 +0000 (21:14 +0200)] 
Fix memleak in hp2ps

Issue discovered by Coverity scan, CID 43167.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoCheck correct variable for NULL
Nicolas Trangez [Wed, 23 Apr 2014 18:37:51 +0000 (20:37 +0200)] 
Check correct variable for NULL

Issue discovered by Coverity scan, CID 43163. This should fix CID 43172 as a
side-effect as well.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoFix potential out-of-bound memory access
Nicolas Trangez [Wed, 23 Apr 2014 18:27:04 +0000 (20:27 +0200)] 
Fix potential out-of-bound memory access

Issue discovered by Coverity scan, CID 43165.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoCheck return value of sigaction
Nicolas Trangez [Wed, 23 Apr 2014 18:06:15 +0000 (20:06 +0200)] 
Check return value of sigaction

Issue discovered by Coverity scan, CID 43142.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agocoverity: Suppress some time-of-check-time-of-use reports
Austin Seipp [Sun, 27 Apr 2014 09:19:24 +0000 (04:19 -0500)] 
coverity: Suppress some time-of-check-time-of-use reports

CID 43178

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agorts: Fix possible int overflow in resize_nursery
Austin Seipp [Wed, 23 Apr 2014 08:41:44 +0000 (03:41 -0500)] 
rts: Fix possible int overflow in resize_nursery

n_capabilities is declared as unsigned int (32bit), and so multiplication
is 32-bit before being stored in a 64bit integer (StgWord).

Instead, cast n_capabilities to StgWord before multiplying.

Discovered by Coverity. CID 43164.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agorts: Fix potential memory leak in ProfHeap.c
Austin Seipp [Wed, 23 Apr 2014 07:14:15 +0000 (02:14 -0500)] 
rts: Fix potential memory leak in ProfHeap.c

Discovered by Coverity. CID 43166.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoDrop `template-haskell`'s build-dep on `containers`
Herbert Valerio Riedel [Thu, 24 Apr 2014 07:05:45 +0000 (09:05 +0200)] 
Drop `template-haskell`'s build-dep on `containers`

This is an attempt to address

  https://github.com/haskell/cabal/issues/1811

by replicating the less than 100 lines of code actually used from the
containers package into an internal non-exposed `template-haskell` module.

Moreover, `template-haskell` does not expose the `Map` type, so this change
should have no visible effect on the public API.

It may turn out that `Data.Map` is not necessary and that even a simple
list-based associative list (`Prelude.lookup`) may suffice. However, in
order to avoid any regressions, this commit takes the safe route and just
clones `Data.Map` for now.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoSome typos in comments
Gabor Greif [Thu, 24 Apr 2014 10:27:50 +0000 (12:27 +0200)] 
Some typos in comments

5 years agoDon't eta-expand PAPs (fixes Trac #9020)
Simon Peyton Jones [Thu, 24 Apr 2014 07:43:07 +0000 (08:43 +0100)] 
Don't eta-expand PAPs (fixes Trac #9020)

See Note [Do not eta-expand PAPs] in SimplUtils.  This has a tremendously
good effect on compile times for some simple benchmarks.

The test is now where it belongs, in perf/compiler/T9020 (instead of simpl015).

I did a nofib run and got essentially zero change except for cacheprof which
gets 4% more allocation.  I investigated.  Turns out that we have

    instance PP Reg where
       pp ppm ST_0 = "%st"
       pp ppm ST_1 = "%st(1)"
       pp ppm ST_2 = "%st(2)"
       pp ppm ST_3 = "%st(3)"
       pp ppm ST_4 = "%st(4)"
       pp ppm ST_5 = "%st(5)"
       pp ppm ST_6 = "%st(6)"
       pp ppm ST_7 = "%st(7)"
       pp ppm r    = "%" ++ map toLower (show r)

That (map toLower (show r) does a lot of map/toLowers.  But if we inline show
we get something like

       pp ppm ST_0 = "%st"
       pp ppm ST_1 = "%st(1)"
       pp ppm ST_2 = "%st(2)"
       pp ppm ST_3 = "%st(3)"
       pp ppm ST_4 = "%st(4)"
       pp ppm ST_5 = "%st(5)"
       pp ppm ST_6 = "%st(6)"
       pp ppm ST_7 = "%st(7)"
       pp ppm EAX  = map toLower (show EAX)
       pp ppm EBX  = map toLower (show EBX)
       ...etc...

and all those map/toLower calls can now be floated to top level.
This gives a 4% decrease in allocation.  But it depends on inlining
a pretty big 'show' function.

With this new patch we get slightly better eta-expansion, which makes
a function look slightly bigger, which just stops it being inlined.
The previous behaviour was luck, so I'm not going to worry about
losing it.

I've added some notes to nofib/Simon-nofib-notes

5 years agoBe less verbose when printing Names when we don't know what's in scope
Simon Peyton Jones [Tue, 22 Apr 2014 16:17:31 +0000 (17:17 +0100)] 
Be less verbose when printing Names when we don't know what's in scope

Previously we always printed qualified names, but that makes a lot of debug or
warning output very verbose. So now we only print qualified names with -dppr-debug.

Civilised output (from pukka error messages, with the environment available) is
unaffected

5 years agoMake absolutely sure that 'done' and 'safeIndex' are strict in the index
Simon Peyton Jones [Tue, 22 Apr 2014 13:40:12 +0000 (14:40 +0100)] 
Make absolutely sure that 'done' and 'safeIndex' are strict in the index

This is just to make sure that there is no redundant boxing.
For safeIndex, for example, the error path doesn't evaluate the
index, so it may be passed boxed unless safeIndex is inlined bodily,
which I don't want to rely on.

5 years agoBe sure to UNPACK the size of an array
Simon Peyton Jones [Tue, 22 Apr 2014 13:37:22 +0000 (14:37 +0100)] 
Be sure to UNPACK the size of an array

The code before did actually unpack the size, I think, but it
wasn't very clear, and it's better to do it explicitly

5 years agoAdd comments to explain the change to EF_ (Trac #8965)
Simon Peyton Jones [Thu, 24 Apr 2014 07:36:40 +0000 (08:36 +0100)] 
Add comments to explain the change to EF_ (Trac #8965)

5 years agoBe more aggressive in `make clean`
Herbert Valerio Riedel [Tue, 22 Apr 2014 20:23:56 +0000 (22:23 +0200)] 
Be more aggressive in `make clean`

This quiets down the utils/testremove/checkremove step

Basically the idea is to have 'make clean' remove everything that was
generated by `make`, while `make distclean` ought to remove everything
created by `./configure`.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoHandle base et al. specially in foreachLibrary.mk
Herbert Valerio Riedel [Tue, 22 Apr 2014 10:01:00 +0000 (12:01 +0200)] 
Handle base et al. specially in foreachLibrary.mk

This adapts the foreachLibrary rule to match the new situation of
base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and
template-haskell.git being folded into ghc.git (re #9016), and thus
not being mentioned anymore in the `packages` file.

One visible effect of this oversight was that the `clean_libraries`
make target would fail to clean those packages.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoUpdate integer-gmp's .gitignore file
Herbert Valerio Riedel [Tue, 22 Apr 2014 08:21:13 +0000 (10:21 +0200)] 
Update integer-gmp's .gitignore file

Note: the .gitignore pattern rules are not that obvious

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoAdapt .gitignore (re #8545)
Herbert Valerio Riedel [Tue, 22 Apr 2014 07:54:09 +0000 (09:54 +0200)] 
Adapt .gitignore (re #8545)

This adapts the top-level .gitignore file to match the new situation of
base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and
template-haskell.git being folded into ghc.git

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFix `make help`
Kyle J. Van Berendonck [Sat, 29 Mar 2014 09:59:58 +0000 (20:59 +1100)] 
Fix `make help`

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoSeparate thousands when printing allocated bytes
Erlend Hamberg [Thu, 6 Mar 2014 22:27:29 +0000 (23:27 +0100)] 
Separate thousands when printing allocated bytes

When printing allocated bytes (`:set +s` in ghci), separate thousands
to make it easier to read large allocations sizes, e.g. “1,200,000
bytes”.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoAdd the powerpc64le architecture
Colin Watson [Sat, 12 Apr 2014 01:13:48 +0000 (02:13 +0100)] 
Add the powerpc64le architecture

This is ArchUnknown for now, as it requires some porting work over and
above powerpc64 due to such things as the different function calling
sequence in the ELFv2 ABI.  For now, an unregisterised port is better
than nothing.

Signed-off-by: Colin Watson <cjwatson@debian.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoBe less untruthful about the prototypes of external functions
Colin Watson [Sat, 12 Apr 2014 00:55:07 +0000 (01:55 +0100)] 
Be less untruthful about the prototypes of external functions

GHC's generated C code uses dummy prototypes for foreign imports.  At the
moment these all claim to be (void), i.e. functions of zero arguments.  On
most platforms this doesn't matter very much: calls to these functions put
the parameters in the usual places anyway, and (with the exception of
varargs) things just work.

However, the ELFv2 ABI on ppc64 optimises stack allocation
(http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html): a call to a
function that has a prototype, is not varargs, and receives all parameters
in registers rather than on the stack does not require the caller to
allocate an argument save area.  The incorrect prototypes cause GCC to
believe that all functions declared this way can be called without an
argument save area, but if the callee has sufficiently many arguments then
it will expect that area to be present, and will thus corrupt the caller's
stack.  This happens in particular with calls to runInteractiveProcess in
libraries/process/cbits/runProcess.c.

The simplest fix appears to be to declare these external functions with an
unspecified argument list rather than a void argument list.  This is no
worse for platforms that don't care either way, and allows a successful
bootstrap of GHC 7.8 on little-endian Linux ppc64 (which uses the ELFv2
ABI).

Fixes #8965

Signed-off-by: Colin Watson <cjwatson@debian.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoghc: initial AArch64 patches
Colin Watson [Tue, 22 Apr 2014 03:26:56 +0000 (22:26 -0500)] 
ghc: initial AArch64 patches

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoghc & docs: kill unused flags
Austin Seipp [Tue, 22 Apr 2014 03:10:05 +0000 (22:10 -0500)] 
ghc & docs: kill unused flags

This removes the following, now defunct flags, which will not be
recognized by GHC 7.10:

  -fwarn-lazy-unlifted-bindings
  -pgmm and -optm (used for the Mangler, long dead)
  -keep-raw-s-file & -keep-raw-s-files
  -monly[432]-reg-only

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoGeneralise type of recently added System.Exit.die
Herbert Valerio Riedel [Mon, 21 Apr 2014 18:29:15 +0000 (20:29 +0200)] 
Generalise type of recently added System.Exit.die

This is a follow-up to 77ea2eb0ab36d1a (re #9016) which added `die` with a
return type of `IO ()` even though all other functions in System.Exit have
the more general return type `IO a`. It is assumed this was an oversight in
the original proposal.

Acked-by: Edward Kmett <ekmett@gmail.com>
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoKill whitespace after cpp's `-I` flag
Herbert Valerio Riedel [Mon, 21 Apr 2014 14:55:11 +0000 (16:55 +0200)] 
Kill whitespace after cpp's `-I` flag

This clean-up is in a similiar spirit as 574ef4293b8676.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoAdd System.Exit.die (re #9016)
Simon Hengel [Mon, 21 Apr 2014 03:34:38 +0000 (11:34 +0800)] 
Add System.Exit.die (re #9016)

The original proposal discussion can be found at

  http://thread.gmane.org/gmane.comp.lang.haskell.libraries/20872

Note this also updates the Haddock submodule to remove Hadock's local
`die` implementation.

5 years agoUse import list to hide new System.Exit.die
Herbert Valerio Riedel [Mon, 21 Apr 2014 14:37:30 +0000 (16:37 +0200)] 
Use import list to hide new System.Exit.die

Soon, System.Exit will export the new `die` (see #9016) which would clash with
Cabal's own `die` implementation. This commit provides forward-compatiblity.

This also updates the Cabal submodule which requires a similiar fix.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoghc: Do not add a space in '-U __PIC__'
Austin Seipp [Mon, 21 Apr 2014 12:22:50 +0000 (07:22 -0500)] 
ghc: Do not add a space in '-U __PIC__'

GHC previously introduced a space here. However, this can in some cases
be interpreted as "-U __PIC__" - note that in shell, the -U would still
be recognized with an argument, but the argument would be " __PIC__",
with a space in front, as opposed to the single string '__PIC__'.

In practice most tools seem to handle this OK. But the Coverity Scan
analysis tool does not: it errors on the fact that ' __PIC__' is an
invalid CPP name to undefine.

With this, it seems the Coverity analysis tool can easily analyze the
entire GHC build.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agotestsuite/spec001: untabify, kill trailing whitespace
Austin Seipp [Sun, 20 Apr 2014 21:55:14 +0000 (16:55 -0500)] 
testsuite/spec001: untabify, kill trailing whitespace

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoDeprecate the AMP warnings.
Austin Seipp [Sun, 20 Apr 2014 06:10:15 +0000 (01:10 -0500)] 
Deprecate the AMP warnings.

Now that we're in development mode, Applicative will soon be a
superclass of Monad in HEAD. So let's go ahead and deprecate the
-fno-warn-amp flag, remove the checks, and tweak a few tests

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoUpdate submodule to final Cabal-1.20.0.0 release
Herbert Valerio Riedel [Sun, 20 Apr 2014 15:31:34 +0000 (17:31 +0200)] 
Update submodule to final Cabal-1.20.0.0 release

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoRemove -fno-warn-amp sledgehammers for validate
Austin Seipp [Sun, 20 Apr 2014 06:00:44 +0000 (01:00 -0500)] 
Remove -fno-warn-amp sledgehammers for validate

GHC should now fully compliant with respect to the Applicative Monad
proposal (including all upstream libraries), and does not need to
suppress this warning anymore.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoUpdate Cabal source-repository entries (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 18:20:26 +0000 (20:20 +0200)] 
Update Cabal source-repository entries (re #8545)

This adapts the source-repository entries to match the new situation of
base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and
template-haskell.git being folded into ghc.git

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoDo not use basename()
Joachim Breitner [Sat, 19 Apr 2014 14:14:38 +0000 (16:14 +0200)] 
Do not use basename()

5 years agoMore github url variants
Joachim Breitner [Sat, 19 Apr 2014 14:06:54 +0000 (16:06 +0200)] 
More github url variants

5 years agoRemove some redundancy in sync-all
Joachim Breitner [Sat, 19 Apr 2014 13:57:20 +0000 (15:57 +0200)] 
Remove some redundancy in sync-all

5 years agosync-all: Apply submodule url rewriting also to stuff in util/
Joachim Breitner [Sat, 19 Apr 2014 13:46:32 +0000 (15:46 +0200)] 
sync-all: Apply submodule url rewriting also to stuff in util/

5 years agoNormalize GHC Trac URLs
Herbert Valerio Riedel [Sat, 19 Apr 2014 12:41:00 +0000 (14:41 +0200)] 
Normalize GHC Trac URLs

Update several old

  http://hackage.haskell.org/trac/ghc

URLs references to the current

  http://ghc.haskell.org/trac/ghc

URLs.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoKill trailing whitespace in recently touched files
Herbert Valerio Riedel [Sat, 19 Apr 2014 12:39:29 +0000 (14:39 +0200)] 
Kill trailing whitespace in recently touched files

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoWeaken constraints on Data.Complex functions
Herbert Valerio Riedel [Sat, 19 Apr 2014 11:56:36 +0000 (13:56 +0200)] 
Weaken constraints on Data.Complex functions

The RealFloat data type context was dropped from Data.Complex some time
ago (see ea280135dd888ac41d8804a9e37e358180cf13ac). However, the rest of
the API in that module was left as-is even though many of the accessors
in that module would work with much more general types now.

This change simplifies the signatures of the functions above, which in
the current API all unnecessarily take a RealFloat constraint that they
don't use (and which may cause to pass around superflous type-class
dictionaries):

    realPart  :: Complex a -> a
    imagPart  :: Complex a -> a
    conjugate :: Num a => Complex a -> Complex a
    mkPolar   :: Floating a => a -> a -> Complex a
    cis       :: Floating a => a -> Complex a

This was originally proposed by Edward Kmett in

  http://www.haskell.org/pipermail/libraries/2014-March/022358.html

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFix sync-all error message introduced in 41f5b7e3e
Herbert Valerio Riedel [Sat, 19 Apr 2014 11:12:40 +0000 (13:12 +0200)] 
Fix sync-all error message introduced in 41f5b7e3e

Curiously, 'aforesaid' has the same length as the word 'testsuite'...

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoAdd Data.List.sortOn function (re #9004 and #2659)
Alexander Berntsen [Fri, 18 Apr 2014 19:41:11 +0000 (21:41 +0200)] 
Add Data.List.sortOn function (re #9004 and #2659)

`sortOn` sorts a list by comparing the results of a key function applied to each
element.  `sortOn f` is equivalent to `sortBy . comparing f`, but has the
performance advantage of only evaluating `f` once for each element in the
input list.

Historical note: This was already proposed in 2008 as part of

  http://www.haskell.org/pipermail/libraries/2008-October/010797.html

It was, however, the recent re-attempt

  http://www.haskell.org/pipermail/libraries/2014-April/022489.html

that let `sortOn` make it into base at last. Maybe the other functions
mentioned in #2659 might be worth reconsidering as well.

5 years agoAdd reverse application operator Data.Function.(&)
Alexander Berntsen [Thu, 17 Apr 2014 19:43:35 +0000 (21:43 +0200)] 
Add reverse application operator Data.Function.(&)

Add `&` as the reverse application operator with `infixl 1`, which allows
it to be nested in `$` (re #9008).

Approved by the core libraries committee on 2013-10-14.

This also bumps the `base` version number to 4.7.1.0

5 years agoValidate inferred theta. Fixes #8883
Jan Stolarek [Sat, 19 Apr 2014 04:58:07 +0000 (06:58 +0200)] 
Validate inferred theta. Fixes #8883

This checks that all the required extensions are enabled for the
inferred type signature.

Updates binary and vector submodules.

5 years agoUpdate `sync-all` and `packages` wrt to fold-in
Herbert Valerio Riedel [Sat, 19 Apr 2014 08:11:59 +0000 (10:11 +0200)] 
Update `sync-all` and `packages` wrt to fold-in

This adapts `sync-all` and `packages` to the recently folded-in Git
repositories

 - `base.git`
 - `ghc-prim.git`
 - `integer-gmp.git`
 - `integer-simple.git`
 - `template-haskell.git`

See #8545 as well as 5f54d67818ee7a74325eed130438beba96510e43 for more
details.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFold template-haskell.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:58:37 +0000 (09:58 +0200)] 
Fold template-haskell.git into ghc.git (re #8545)

At the time of merge, template-haskell.git was at
[9bcc122819a6f4a2ae7ad569717324b8368e801c/template-haskell]

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFold integer-gmp.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:55:00 +0000 (09:55 +0200)] 
Fold integer-gmp.git into ghc.git (re #8545)

At the time of merge, integer-gmp.git was at
[d7bff4dddfa10389156ca11f75a5a23e78cf3ab0/integer-gmp]

Note: All but the last/current GMP tarball were removed from the
      history to keep the Git history size at a minimum.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFold integer-simple.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:52:36 +0000 (09:52 +0200)] 
Fold integer-simple.git into ghc.git (re #8545)

At the time of merge, integer-simple.git was at
[9e8b924f68c4cdb6c7ae88f274baa3560aaa305e/integer-simple]

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFold base.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:50:15 +0000 (09:50 +0200)] 
Fold base.git into ghc.git (re #8545)

At the time of merge, base.git was at
[52c0b09036c36f1ed928663abb2f295fd36a88bb/base]

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoFold ghc-prim.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:44:33 +0000 (09:44 +0200)] 
Fold ghc-prim.git into ghc.git (re #8545)

At the time of merge, ghc-prim.git was at
[ad9bf96815cb5a9bb4acc51c99eff20be3e50da3/ghc-prim]

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoTake account of the AvailTC invariant when importing
Simon Peyton Jones [Fri, 18 Apr 2014 22:30:18 +0000 (23:30 +0100)] 
Take account of the AvailTC invariant when importing

In the rather gnarly filterImports code, someone had forgotten
the AvailTC invariant:  in AvailTC n [n,s1,s2], the 'n' is itself
included in the list of names.

5 years agoUpdate Cabal submodule to fix Solaris build
Herbert Valerio Riedel [Fri, 18 Apr 2014 10:31:51 +0000 (12:31 +0200)] 
Update Cabal submodule to fix Solaris build

see also https://github.com/haskell/cabal/issues/1789

5 years agoUpdate Cabal submodule to latest tip of 1.20 branch
Herbert Valerio Riedel [Thu, 17 Apr 2014 14:12:23 +0000 (16:12 +0200)] 
Update Cabal submodule to latest tip of 1.20 branch

The testsuite reference output for ghcpkg01 needs to be adapted
since a "More diff friendly pretty printing of cabal files"
is now performed.

5 years agoMake qReport force its error message before printing it
Simon Peyton Jones [Thu, 17 Apr 2014 10:15:16 +0000 (11:15 +0100)] 
Make qReport force its error message before printing it

Fixes Trac #8987.  See Note [Exceptions in TH]

Thanks to Yuras Shumovich for doing this.

5 years agoUpdate Cabal submodule to tip of v1.20 branch
Herbert Valerio Riedel [Tue, 15 Apr 2014 09:09:45 +0000 (11:09 +0200)] 
Update Cabal submodule to tip of v1.20 branch

This corresponds to the RC of the soon-to-be Cabal 1.20 release

One noteworthy change is the removal of the `--with-ranlib` flag
requiring a small adaptation in the GHC build system.

Moreover two new licences were added, MPL and BSD2.

Due to https://github.com/haskell/cabal/issues/1622 Cabal-1.20 now
allows to strip libraries as well, this doesn't work well with
`ghc-cabal copy` being fed a `":"` strip-command argument which was
simply ignored in the past. The current code tries to retain this
semantics as backward compat. However, this needs more investigation as
I'm not sure if/why the `test_bindist` step doesn't want the libraries
to be stripped on installation.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agos/FromList/isList in docs
Joachim Breitner [Tue, 15 Apr 2014 13:33:39 +0000 (15:33 +0200)] 
s/FromList/isList in docs

This was reported by David Virebayre on haskell-cafe.

5 years agoTest Trac #8985
Simon Peyton Jones [Mon, 14 Apr 2014 12:06:22 +0000 (13:06 +0100)] 
Test Trac #8985

5 years agoHonour the untouchability of kind variables
Simon Peyton Jones [Mon, 14 Apr 2014 12:03:40 +0000 (13:03 +0100)] 
Honour the untouchability of kind variables

Trac #8985 showed up a major shortcoming in the kind unifier: it was
ignoring untoucability.  This has unpredictably-bad consequences;
notably, the skolem-escape check can fail.

There were two things wrong
 * TcRnMonad.isTouchableTcM was returning a constant value for kind variables
   (wrong), and even worse the constant was back-to-front (it was always False).

 * We weren't even calling isTouchableTcM in TcType.unifyKindX.

I'm not sure how this ever worked.

Merge to 7.8.3 in due course.

5 years agoA bit more trace information in an ASSERT failure
Simon Peyton Jones [Mon, 14 Apr 2014 11:48:31 +0000 (12:48 +0100)] 
A bit more trace information in an ASSERT failure

5 years agoTidy up trace message
Simon Peyton Jones [Mon, 14 Apr 2014 09:01:12 +0000 (10:01 +0100)] 
Tidy up trace message

5 years agoBetter layout for coercion error message
Simon Peyton Jones [Mon, 14 Apr 2014 08:59:08 +0000 (09:59 +0100)] 
Better layout for coercion error message

5 years agoUpdate Haddock submodule to follow LHsBindsLR changes
Herbert Valerio Riedel [Mon, 14 Apr 2014 07:04:31 +0000 (09:04 +0200)] 
Update Haddock submodule to follow LHsBindsLR changes

This submodule update was forgotten to be included in
eeaea2df3fa585db503034f419c6e4331a4d8a84

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoTypos in comments
Gabor Greif [Sun, 13 Apr 2014 11:57:15 +0000 (13:57 +0200)] 
Typos in comments

5 years agoInstead of tracking Origin in LHsBindsLR, track it in MatchGroup
Dr. ERDI Gergo [Sat, 12 Apr 2014 11:36:31 +0000 (19:36 +0800)] 
Instead of tracking Origin in LHsBindsLR, track it in MatchGroup

5 years agoMake BlockAlloc.c comment slightly more accurate (fixes #8491)
Edward Z. Yang [Sun, 13 Apr 2014 08:09:40 +0000 (01:09 -0700)] 
Make BlockAlloc.c comment slightly more accurate (fixes #8491)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoFix linked list manipulation code (buggy on consecutive deletion)
Edward Z. Yang [Sun, 13 Apr 2014 06:02:13 +0000 (23:02 -0700)] 
Fix linked list manipulation code (buggy on consecutive deletion)

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