ghc.git
5 years agoRemove LANGUAGE pragrams implied by Haskell2010
Herbert Valerio Riedel [Wed, 14 May 2014 07:31:57 +0000 (09:31 +0200)] 
Remove LANGUAGE pragrams implied by Haskell2010

Haskell2010 implies (at least) EmptyDataDecls, ForeignFunctionInterface,
PatternGuards, DoAndIfThenElse, and RelaxedPolyRec.

This is a follow-up to dd92e2179e3171a0630834b773c08d416101980d

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoSet cabal files to default-language:Haskell2010
Herbert Valerio Riedel [Wed, 14 May 2014 07:24:10 +0000 (09:24 +0200)] 
Set cabal files to default-language:Haskell2010

This is a first step towards eliminating `default-extensions` in favour of
per-file declared `{-# LANGUAGE ... #-}` pragmas.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoAdd strict ver. of (<$>): (<$!>) to Control.Monad
Alexander Berntsen [Tue, 13 May 2014 08:50:30 +0000 (10:50 +0200)] 
Add strict ver. of (<$>): (<$!>) to Control.Monad

A strict (<$>) has been proposed numerous times. The first time
around[1] by Johan Tibell, and the last time around[2] by David
Luposchainsky. David's thread was able to avoid The Bikeshed Monster,
and his (<$!>) proposal received unanimous +1s all around.

This addresses #9099.

 [1]: http://www.haskell.org/pipermail/libraries/2013-November/021728.html
 [2]: http://www.haskell.org/pipermail/libraries/2014-April/022864.html

Authored-by: Alexander Berntsen <alexander@plaimi.net>
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
5 years agoUpdate Haddock submodule.
Mateusz Kowalczyk [Wed, 14 May 2014 00:32:42 +0000 (02:32 +0200)] 
Update Haddock submodule.

This splits up Haddock up a bit to allow use of its parser (and in the
future perhaps more) without GHC dependency. It should build fine with
the regular work-flow but if you get problems with building Haddock then
please revert this and let me know.

5 years agoWibble to 4cfc1fae
Simon Peyton Jones [Tue, 13 May 2014 23:15:48 +0000 (00:15 +0100)] 
Wibble to 4cfc1fae

isSynTyCon is true of type *family* TyCons, which *are* allowed
in TyConAppCo

5 years agoFix globalRegMaybe for unregisterised build.
Peter Trommler [Wed, 30 Apr 2014 09:41:51 +0000 (11:41 +0200)] 
Fix globalRegMaybe for unregisterised build.

In commit 83a003f globalRegMaybe will be called but panics
for unregisterised compilers.

In an unregisterised compiler there are no global registers
so always return `Nothing`.

Fixes #9055.

5 years agoFix invariant in mkAppCoFlexible
Simon Peyton Jones [Tue, 13 May 2014 12:17:19 +0000 (13:17 +0100)] 
Fix invariant in mkAppCoFlexible

mkAppCoFlexible was breaking the invariant that the head of a TyConAppCo cannot
be a type synonym.  This small patch fixes it.

5 years agoLint should check that TyConAppCo doesn't have a synonym in the tycon position
Simon Peyton Jones [Tue, 13 May 2014 12:15:45 +0000 (13:15 +0100)] 
Lint should check that TyConAppCo doesn't have a synonym in the tycon position

That is why Lint didn't nail Trac #9102

5 years agoTypo in note
Gabor Greif [Mon, 12 May 2014 22:49:30 +0000 (00:49 +0200)] 
Typo in note

5 years agoTypo in comment
Gabor Greif [Mon, 12 May 2014 22:38:19 +0000 (00:38 +0200)] 
Typo in comment

5 years agoImprove desugaring of lazy pattern match
Simon Peyton Jones [Mon, 12 May 2014 15:03:48 +0000 (16:03 +0100)] 
Improve desugaring of lazy pattern match

This patch implements a simpler, and nicer, desugaring for
lazy pattern matching, fixing Trac #9098

5 years agoIn splitHsFunType, take account of prefix (->)
Simon Peyton Jones [Mon, 12 May 2014 15:02:36 +0000 (16:02 +0100)] 
In splitHsFunType, take account of prefix (->)

This fixes Trac #9096

5 years agoComments only, on inert_fsks and inert_no_eqs
Simon Peyton Jones [Fri, 9 May 2014 09:40:50 +0000 (10:40 +0100)] 
Comments only, on inert_fsks and inert_no_eqs

I wrote these when studying Trac #9090

5 years agoRevert output of T5979
Joachim Breitner [Sat, 10 May 2014 16:28:44 +0000 (18:28 +0200)] 
Revert output of T5979

this reverts 12332f1. The error message changes when there are two
versions of transformers in the database, one of them hidden. That might
be a bug of its own, but for now lets make the test case succeed after a
fresh build. Affected developers should probably
$ ./inplace/bin/ghc-pkg unregister transformers-0.3.0.0

5 years agoRequire transformers for T5979
Joachim Breitner [Sat, 10 May 2014 09:38:49 +0000 (11:38 +0200)] 
Require transformers for T5979

in order to get a reliable error message
(although the error message could be improved anyways to mention the
explicit package the module is imported with.)

5 years agotestsuite: fix cc004
Austin Seipp [Sat, 10 May 2014 02:50:52 +0000 (21:50 -0500)] 
testsuite: fix cc004

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agotestsuite: fix cgrun051 exit code
Austin Seipp [Sat, 10 May 2014 01:58:06 +0000 (20:58 -0500)] 
testsuite: fix cgrun051 exit code

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoUpdate .gitignore
Austin Seipp [Sat, 3 May 2014 22:35:04 +0000 (17:35 -0500)] 
Update .gitignore

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoError message wibble, presumably due to recent changes in transformers
Simon Peyton Jones [Thu, 8 May 2014 12:06:05 +0000 (13:06 +0100)] 
Error message wibble, presumably due to recent changes in transformers

5 years agoBetter error message in vectoriser
Simon Peyton Jones [Thu, 8 May 2014 09:39:21 +0000 (10:39 +0100)] 
Better error message in vectoriser

5 years agoPreserve evaluated-ness in CoreTidy
Simon Peyton Jones [Thu, 8 May 2014 09:38:52 +0000 (10:38 +0100)] 
Preserve evaluated-ness in CoreTidy

The main effect of this patch is to preserve the evaluated-ness of
case binders and suchlike, to avoid spurious Lint complaints after
tidying.  See Note [Preserve evaluatedness] in CoreTidy.

Plus a bit of associated refactoring of tidyIdBndr, tidyLetBndr.

5 years agoMark evaluated arguments in dataConInstPat
Simon Peyton Jones [Thu, 8 May 2014 09:33:17 +0000 (10:33 +0100)] 
Mark evaluated arguments in dataConInstPat

See Note [Mark evaluated arguments] in CoreUtils.

This is not a significant change, but avoids a spurious Lint complaint.

5 years agoRefactor buildClass and mkDictSelId a bit, to avoid the no_unf argument
Simon Peyton Jones [Thu, 8 May 2014 09:31:53 +0000 (10:31 +0100)] 
Refactor buildClass and mkDictSelId a bit, to avoid the no_unf argument

No change in functionality, just a cleaner story, with the RHS for
dictionary selectors being treated less specially than before.

5 years agoImprove tracing in Simplifier
Simon Peyton Jones [Mon, 7 Apr 2014 14:41:45 +0000 (15:41 +0100)] 
Improve tracing in Simplifier

5 years agoUpdate transformers submodule to new v0.4 rel
Herbert Valerio Riedel [Tue, 6 May 2014 20:46:27 +0000 (22:46 +0200)] 
Update transformers submodule to new v0.4 rel

This also updates the haskeline to upstream master to
accomodate the new transformers version

5 years agoAdding missing test files for #9071
Simon Peyton Jones [Tue, 6 May 2014 08:46:14 +0000 (09:46 +0100)] 
Adding missing test files for #9071

5 years agoAdd a bit more typechecker tracing
Simon Peyton Jones [Tue, 6 May 2014 07:23:26 +0000 (08:23 +0100)] 
Add a bit more typechecker tracing

This is in pursuit of Trac #9063

5 years agoFix Trac #9071, an egregious bug in TcDeriv.inferConstraints
Simon Peyton Jones [Tue, 6 May 2014 07:22:37 +0000 (08:22 +0100)] 
Fix Trac #9071, an egregious bug in TcDeriv.inferConstraints

The constraints for Functor don't line up 1-1 with the arguments
(they are fetched out from sub-terms of the type), but the surrounding
code was mistakenly assuming they were in 1-1 association.

5 years agoSecond go at fixing #9061
Simon Peyton Jones [Tue, 6 May 2014 07:20:28 +0000 (08:20 +0100)] 
Second go at fixing #9061

My first attempt introduce a bug in -fprint-minimal-imports, but
fortunately a regression test caught it.

5 years agoModularise pretty-printing for foralls
Simon Peyton Jones [Tue, 6 May 2014 07:19:01 +0000 (08:19 +0100)] 
Modularise pretty-printing for foralls

See TypeRep.pprUserForAll.  This just makes forall-printing a bit more
consistent.  In particular, I wasn't seeing the kind foralls when
displaying a CoAxiom or CoAxBranch

The output on T7939 is just possible a bit too verbose now, but even if so
that's an error in the right direction.

5 years agoImprove comments and tracing in SpecConstr
Simon Peyton Jones [Mon, 5 May 2014 07:50:51 +0000 (08:50 +0100)] 
Improve comments and tracing in SpecConstr

5 years agoChanged profiling output is fine (according to Simon Marlow)
Simon Peyton Jones [Fri, 2 May 2014 11:10:42 +0000 (12:10 +0100)] 
Changed profiling output is fine (according to Simon Marlow)

5 years agoAdd -fno-full-laziness to get consistent profiling output
Simon Peyton Jones [Fri, 2 May 2014 11:10:26 +0000 (12:10 +0100)] 
Add -fno-full-laziness to get consistent profiling output

5 years agoFix over-zealous unused-import warning
Simon Peyton Jones [Fri, 2 May 2014 11:09:52 +0000 (12:09 +0100)] 
Fix over-zealous unused-import warning

See Note [Un-warnable import decls] in RnNames.

Fixes Trac #9061.

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>