ghc.git
6 years agoFix dynlib paths in the RTS too; part of #7833
Ian Lynagh [Sat, 22 Jun 2013 20:33:22 +0000 (21:33 +0100)] 
Fix dynlib paths in the RTS too; part of #7833

6 years agoFix the dynmaic library paths in the libs, as well as in the programs
Ian Lynagh [Sat, 22 Jun 2013 19:34:12 +0000 (20:34 +0100)] 
Fix the dynmaic library paths in the libs, as well as in the programs

Part of #7833

6 years agoRun "sh ./configure" rather than "sh configure"; part of #7992
Ian Lynagh [Sat, 22 Jun 2013 15:52:46 +0000 (16:52 +0100)] 
Run "sh ./configure" rather than "sh configure"; part of #7992

This fixes a bug with how configure re-execs itself.

6 years agoOn OS X, fix the path to the libffi dynlib; fixes #7833
Ian Lynagh [Sat, 22 Jun 2013 15:16:49 +0000 (16:16 +0100)] 
On OS X, fix the path to the libffi dynlib; fixes #7833

6 years agoFix build on OS X
Ian Lynagh [Sat, 22 Jun 2013 14:06:29 +0000 (15:06 +0100)] 
Fix build on OS X

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Sat, 22 Jun 2013 12:50:59 +0000 (13:50 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoFix syntax in some code in the user guide; fixes #8007
Ian Lynagh [Sat, 22 Jun 2013 12:32:03 +0000 (13:32 +0100)] 
Fix syntax in some code in the user guide; fixes #8007

6 years agoThe help flag is --help, not -help; fixes #8005
Ian Lynagh [Sat, 22 Jun 2013 12:24:04 +0000 (13:24 +0100)] 
The help flag is --help, not -help; fixes #8005

6 years agoUse consistent dashes in the user guide
Ian Lynagh [Sat, 22 Jun 2013 12:21:40 +0000 (13:21 +0100)] 
Use consistent dashes in the user guide

We were using a mixture of "––" and "--". We now
consistently use "--", which has the advantage that copy/pasting
flags will work.

6 years agoRemove extra dashes in a flag name in the user guide
Ian Lynagh [Sat, 22 Jun 2013 12:03:59 +0000 (13:03 +0100)] 
Remove extra dashes in a flag name in the user guide

6 years agoFix #8009 : Failure to compile on powerpc64-linux.
Erik de Castro Lopo [Sat, 22 Jun 2013 12:00:01 +0000 (22:00 +1000)] 
Fix #8009 : Failure to compile on powerpc64-linux.

Add definitions for stg_C_FINALIZER_LIST and n_capabilities.

6 years agoWhitespace only in HeaderInfo
Ian Lynagh [Fri, 21 Jun 2013 23:22:38 +0000 (00:22 +0100)] 
Whitespace only in HeaderInfo

6 years agoRevise implementation of overlapping type family instances.
Richard Eisenberg [Fri, 21 Jun 2013 12:54:49 +0000 (13:54 +0100)] 
Revise implementation of overlapping type family instances.

This commit changes the syntax and story around overlapping type
family instances. Before, we had "unbranched" instances and
"branched" instances. Now, we have closed type families and
open ones.

The behavior of open families is completely unchanged. In particular,
coincident overlap of open type family instances still works, despite
emails to the contrary.

A closed type family is declared like this:
> type family F a where
>   F Int = Bool
>   F a   = Char
The equations are tried in order, from top to bottom, subject to
certain constraints, as described in the user manual. It is not
allowed to declare an instance of a closed family.

6 years agoTypo in note
Gabor Greif [Wed, 12 Jun 2013 15:48:25 +0000 (17:48 +0200)] 
Typo in note

6 years agoEnsure gc_type is StgWord8.
Austin Seipp [Fri, 21 Jun 2013 05:21:21 +0000 (00:21 -0500)] 
Ensure gc_type is StgWord8.

Again, the range of gc_type is actually 1-3, which is technically
outside the range of rtsBool.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoEnsure gc_thread->wakeup is of type StgWord8.
Austin Seipp [Fri, 21 Jun 2013 05:12:20 +0000 (00:12 -0500)] 
Ensure gc_thread->wakeup is of type StgWord8.

rtsBool is defined to only have two inhabitants, which are true (1) and
false (0)

But the wakeup flag is set to 4 possible values, outside the range of
rtsBool. This leads Clang to warn about tautological comparisons.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDon't use -finline-limit with Clang.
Austin Seipp [Fri, 21 Jun 2013 05:10:26 +0000 (00:10 -0500)] 
Don't use -finline-limit with Clang.

It's unsupported.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoInitialize ptr to NULL to silence Clang warning.
Austin Seipp [Fri, 21 Jun 2013 04:56:07 +0000 (23:56 -0500)] 
Initialize ptr to NULL to silence Clang warning.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoAdd release note blurb for Clang support.
Austin Seipp [Thu, 20 Jun 2013 23:25:22 +0000 (18:25 -0500)] 
Add release note blurb for Clang support.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDocument -fwarn-dodgy-imports changes in release notes. Trac #7167.
Austin Seipp [Thu, 20 Jun 2013 23:22:48 +0000 (18:22 -0500)] 
Document -fwarn-dodgy-imports changes in release notes. Trac #7167.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix rts/package.conf.in ld-options for Clang.
Austin Seipp [Thu, 20 Jun 2013 22:06:23 +0000 (17:06 -0500)] 
Fix rts/package.conf.in ld-options for Clang.

Now with less Mac-breakage.

With this change, I can get a working stage1/stage2 compiler using
Clang 3.4svn, which can be used to link working executables!

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoSupport QNXNTO for arm under LLVM
Stephen Paul Weber [Thu, 20 Jun 2013 01:22:45 +0000 (20:22 -0500)] 
Support QNXNTO for arm under LLVM

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix #7661 regression.
David Terei [Thu, 20 Jun 2013 01:51:03 +0000 (18:51 -0700)] 
Fix #7661 regression.

Patch from singpolyma.

6 years agoRe-untabify rts/packages.conf.in
Austin Seipp [Wed, 19 Jun 2013 06:27:33 +0000 (01:27 -0500)] 
Re-untabify rts/packages.conf.in

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Fix rts/packages.conf.in ld-options for clang."
Austin Seipp [Wed, 19 Jun 2013 06:25:58 +0000 (01:25 -0500)] 
Revert "Fix rts/packages.conf.in ld-options for clang."

This reverts commit 991f285e681e8541632502d05d8a46de2d44b7bd.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Untabify rts/packages.conf.in"
Austin Seipp [Wed, 19 Jun 2013 06:25:57 +0000 (01:25 -0500)] 
Revert "Untabify rts/packages.conf.in"

This reverts commit ebf97ad146173afd9e094f4975aa33717ed3a11e.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Actually fix rts/packages.conf.in ld-options."
Austin Seipp [Wed, 19 Jun 2013 06:25:49 +0000 (01:25 -0500)] 
Revert "Actually fix rts/packages.conf.in ld-options."

This reverts commit 5dc74f385f1bbc9248ed950af255b946677c2ff9.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix typo in header guard.
Austin Seipp [Wed, 19 Jun 2013 05:16:18 +0000 (00:16 -0500)] 
Fix typo in header guard.

Spotted by Clang.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoActually fix rts/packages.conf.in ld-options.
Austin Seipp [Wed, 19 Jun 2013 04:09:34 +0000 (23:09 -0500)] 
Actually fix rts/packages.conf.in ld-options.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoUntabify rts/packages.conf.in
Austin Seipp [Wed, 19 Jun 2013 03:24:52 +0000 (22:24 -0500)] 
Untabify rts/packages.conf.in

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix rts/packages.conf.in ld-options for clang.
Austin Seipp [Wed, 19 Jun 2013 03:21:42 +0000 (22:21 -0500)] 
Fix rts/packages.conf.in ld-options for clang.

Technically, '-u' is an ld option, not a compiler option,
and clang considers this argument unused. Hence, we must
explicitly forward this to the linker.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix many ASSERT uses under Clang.
Austin Seipp [Tue, 18 Jun 2013 23:45:31 +0000 (18:45 -0500)] 
Fix many ASSERT uses under Clang.

Clang doesn't like whitespace between macro and arguments.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoSuppress some more warnings from Clang.
Austin Seipp [Tue, 18 Jun 2013 23:40:32 +0000 (18:40 -0500)] 
Suppress some more warnings from Clang.

It likes to think lambdas a la:

    foo $ \u -> ...

represent a kind of unicode extended literal.

It also gets confused when you have things like:

    ... thing ... {- comment ... (???) -}

where the (???) is mistaken as a trigraph.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoUse assembler-with-cpp mode when running CPP.
Austin Seipp [Mon, 17 Jun 2013 11:12:08 +0000 (06:12 -0500)] 
Use assembler-with-cpp mode when running CPP.

This is needed because Clang is very strict about C99 macro rules, which
dictate that '#' in a body must have a token immediately following it for
string-ification. In practice we break this all the time, because we do
very weird stuff like:

    #define FOOBAR(xyz) \
    {-# SOME PRAGMA #-} \
    baz :: (xyz) \
    baz = ...

where the leading '#' in in the macro body clearly breaks this rule.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRemove redundant import, revealed by the fix to #7963
Simon Peyton Jones [Tue, 18 Jun 2013 09:55:15 +0000 (10:55 +0100)] 
Remove redundant import, revealed by the fix to #7963

6 years agoEmit addUsedRdrNames for the datacons in a standalone deriving (Trac #7969)
Simon Peyton Jones [Mon, 17 Jun 2013 21:45:28 +0000 (22:45 +0100)] 
Emit addUsedRdrNames for the datacons in a standalone deriving (Trac #7969)

6 years agoUse ideclImplicit to filter out only *implict* Prelude imports (Trac #7963)
Simon Peyton Jones [Mon, 17 Jun 2013 21:39:43 +0000 (22:39 +0100)] 
Use ideclImplicit to filter out only *implict* Prelude imports (Trac #7963)

The ideclImplicit flag didn't exist before, but it does now,
and it makes this code simpler and makes it easy to fix Trac #7963.

6 years agoWork-around clang weirdness by adding a newline.
Austin Seipp [Mon, 17 Jun 2013 10:36:29 +0000 (05:36 -0500)] 
Work-around clang weirdness by adding a newline.

I really wish this were a joke, but alas...

This gets me a working stage1 compiler on Linux with Clang with no
modifications. Unfortunately it won't get much farther than that for
various other reasons.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoAdd some missing clang bits to the build system.
Austin Seipp [Mon, 17 Jun 2013 09:57:18 +0000 (04:57 -0500)] 
Add some missing clang bits to the build system.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRelease note blurb for Linker fixes.
Austin Seipp [Mon, 17 Jun 2013 01:19:54 +0000 (20:19 -0500)] 
Release note blurb for Linker fixes.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDetect linker information at runtime. Fixes Trac #6063
Austin Seipp [Sat, 4 May 2013 21:07:22 +0000 (16:07 -0500)] 
Detect linker information at runtime. Fixes Trac #6063

Previously, we did ./configure time checks to see if 'GNU ld' supported
certain options. If it does, we bake those options into the link step.
See Trac #5240.

Unfortunately, the linker we use at runtime can change for several
reasons. One is that the user specifies -pgml 'foo'. The other is if
/usr/bin/ld or whatnot changes from when GHC was built.  Those options
mentioned earlier are specific to GNU ld, but many systems support GNU
gold too. This is Trac #6063.

So we need to check at runtime what linker we're using. This is actually
a little bit complicated because we normally use the C compiler as our
linker. Windows and OS X are also special here.

Finally, this patch also unconditionally gives '--hash-size=31' and
'--reduce-memory-overheads' to the system linker if it's GNU ld. These
options have been supported for 8+ years from what I can see, and there
are probably a lot of other reasons why GHC would not work with such an
ancient binutils, all things considered.

See Note [Run-time linker info] in SysTools for details. There are
plenty of comments as well in the surrounding code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix ghci crash when the user code closes stdin
Ian Lynagh [Sat, 15 Jun 2013 20:54:22 +0000 (21:54 +0100)] 
Fix ghci crash when the user code closes stdin

Now that we share stdin with the program, we have to check for
handle-closed as well as EOF, as the program might have closed
stdin.

6 years agoOptimise lockClosure when n_capabilities == 1; fixes #693
Ian Lynagh [Sat, 15 Jun 2013 18:07:58 +0000 (19:07 +0100)] 
Optimise lockClosure when n_capabilities == 1; fixes #693

Based on a patch from Yuras Shumovich.

6 years agoWhitespace and braces only
Ian Lynagh [Sat, 15 Jun 2013 16:08:42 +0000 (17:08 +0100)] 
Whitespace and braces only

6 years agoAdd braces for clarity
Ian Lynagh [Sat, 15 Jun 2013 15:41:21 +0000 (16:41 +0100)] 
Add braces for clarity

6 years agoMaintain per-generation lists of weak pointers (#7847)
Takano Akio [Mon, 11 Mar 2013 09:51:05 +0000 (18:51 +0900)] 
Maintain per-generation lists of weak pointers (#7847)

6 years agoCheck for a weak pointer being dead before we do any allocation for it
Ian Lynagh [Sat, 15 Jun 2013 15:36:29 +0000 (16:36 +0100)] 
Check for a weak pointer being dead before we do any allocation for it

6 years agoAllow multiple C finalizers to be attached to a Weak#
Takano Akio [Thu, 18 Apr 2013 09:30:23 +0000 (18:30 +0900)] 
Allow multiple C finalizers to be attached to a Weak#

The commit replaces mkWeakForeignEnv# with addCFinalizerToWeak#.
This new primop mutates an existing Weak# object and adds a new
C finalizer to it.

This change removes an invariant in MarkWeak.c, namely that the relative
order of Weak# objects in the list needs to be preserved across GC. This
makes it easier to split the list into per-generation structures.

The patch also removes a race condition between two threads calling
finalizeWeak# on the same WEAK object at that same time.

6 years agoOptimization for takeMVar/putMVar when MVar left empty; fixes #7923
Ian Lynagh [Sat, 15 Jun 2013 12:19:21 +0000 (13:19 +0100)] 
Optimization for takeMVar/putMVar when MVar left empty; fixes #7923

We only need to apply the write barrier to an MVar when it acquires
a reference to live data; when the MVar is left empty in the case
of a takeMVar/putMVar, we can save a memory reference.

Patch from Edward Z. Yang.

6 years agoWhitespace only in rts/storage/SMPClosureOps.h
Ian Lynagh [Fri, 14 Jun 2013 21:02:56 +0000 (22:02 +0100)] 
Whitespace only in rts/storage/SMPClosureOps.h

6 years agoCleaning fixes, and other build system tweaks; part of #7941
Ian Lynagh [Fri, 14 Jun 2013 12:56:17 +0000 (13:56 +0100)] 
Cleaning fixes, and other build system tweaks; part of #7941

6 years ago--show-options lists all flags. Add user documentation for #7843
Jan Stolarek [Fri, 7 Jun 2013 07:15:32 +0000 (09:15 +0200)] 
--show-options lists all flags. Add user documentation for #7843

6 years agoTypo in hp2ps help output
Joachim Breitner [Wed, 29 May 2013 17:39:58 +0000 (19:39 +0200)] 
Typo in hp2ps help output

As spotted by Julian Gilbey and reported at http://bugs.debian.org/710305

6 years agoAvoid generating empty llvm.used definitions.
Geoffrey Mainland [Wed, 12 Jun 2013 13:31:49 +0000 (14:31 +0100)] 
Avoid generating empty llvm.used definitions.

LLVM 3.3rc3 complains when the llvm.used global is an empty array, so don't
define llvm.used at all when it would be empty.

6 years agoRemove dead code
Simon Peyton Jones [Wed, 12 Jun 2013 08:43:58 +0000 (09:43 +0100)] 
Remove dead code

6 years agoRemove trace that sometimes causes a loop
Simon Peyton Jones [Wed, 12 Jun 2013 08:43:40 +0000 (09:43 +0100)] 
Remove trace that sometimes causes a loop

6 years agoFix the constraint simplifier (Trac #7967)
Simon Peyton Jones [Wed, 12 Jun 2013 08:38:54 +0000 (09:38 +0100)] 
Fix the constraint simplifier (Trac #7967)

Richard's bug report showed up a couple of subtleties in the constraint solver

* We can strengthen the kind invariants on CTyEqCan and CFunEqCan
    See Note [Kind orientation for CTyEqCan]
    and Note [Kind orientation for CFunEqCan] in TcRnTypes
  There are some changes to reOrient and checkKind in TcCanonical
  to support these stronger invarants.

* In TcSimplify we must make sure that we re-simplify if defaultTyVar
  does anything.  See Note [Must simplify after defaulting] in TcSimplify.

The usual round of refactoring follows!

6 years agoComment out function; consequence of reverting a553f18
Simon Peyton Jones [Tue, 11 Jun 2013 22:28:06 +0000 (23:28 +0100)] 
Comment out function; consequence of reverting a553f18

6 years agoRevert "Add support for byte endian swapping for Word 16/32/64."
Simon Peyton Jones [Tue, 11 Jun 2013 20:12:58 +0000 (21:12 +0100)] 
Revert "Add support for byte endian swapping for Word 16/32/64."

This reverts commit 1c5b0511a89488f5280523569d45ee61c0d09ffa.

6 years agoTypo in comment
Gabor Greif [Tue, 11 Jun 2013 21:39:24 +0000 (23:39 +0200)] 
Typo in comment

6 years agopunctuation in comment
Gabor Greif [Tue, 11 Jun 2013 21:27:54 +0000 (23:27 +0200)] 
punctuation in comment

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Tue, 11 Jun 2013 13:54:51 +0000 (14:54 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoActually make the change described in 'Fix egregious typo in cmpTypeX'
Simon Peyton Jones [Tue, 11 Jun 2013 08:49:20 +0000 (09:49 +0100)] 
Actually make the change described in 'Fix egregious typo in cmpTypeX'

I reverted it to try something else and forgot to put it back!
Fixes Trac #7272 (again!).

6 years agoTrace statements only
Simon Peyton Jones [Mon, 10 Jun 2013 17:28:54 +0000 (18:28 +0100)] 
Trace statements only

6 years agoMake sure we quantify over the context in data constructors
Simon Peyton Jones [Mon, 10 Jun 2013 17:28:37 +0000 (18:28 +0100)] 
Make sure we quantify over the context in data constructors

This was exposed by Trac #7974. A stupid bug!

6 years agoFix egregious typo in cmpTypeX
Simon Peyton Jones [Mon, 10 Jun 2013 10:57:06 +0000 (11:57 +0100)] 
Fix egregious typo in cmpTypeX

Reported in Trac #7272.  "tv1" should be "tv2"!

However, things weren't as simple as they sound, because
treating (x:Open) as different from (x:*) gave rise to
new failures; see Note [Comparison with OpenTypeKind] in Type.

My hacky solution is to treat OpenKind as equal to * and #,
at least in Core etc.  Hence the faff in Type.cmpTc.

I do not like this.  But it seems like another messy consequence
of including sub-kinding.  Sigh.

6 years agoFix substitution but in liftCoSubst (Trac #7973)
Simon Peyton Jones [Mon, 10 Jun 2013 10:04:09 +0000 (11:04 +0100)] 
Fix substitution but in liftCoSubst (Trac #7973)

Iavor uncovered this subtle omission in liftCoSubst.  The problem and its
solution are desribed in
    Note [Substituting kinds in liftCoSubst]

6 years agoDon't create mk/stamp-h
Ian Lynagh [Sun, 9 Jun 2013 19:49:52 +0000 (20:49 +0100)] 
Don't create mk/stamp-h

I don't think we are using it for anything any more.

6 years agoRarrange the distclean list; part of #7941
Ian Lynagh [Sun, 9 Jun 2013 19:14:40 +0000 (20:14 +0100)] 
Rarrange the distclean list; part of #7941

6 years agoChange how we check that we have a suitable 'make'
Ian Lynagh [Sun, 9 Jun 2013 18:24:45 +0000 (19:24 +0100)] 
Change how we check that we have a suitable 'make'

We now check in the same way that the testsuite does.

6 years agoRemove ghc.spec
Ian Lynagh [Sun, 9 Jun 2013 17:56:58 +0000 (18:56 +0100)] 
Remove ghc.spec

It doesn't look like it would work now, and doesn't really belong in the
GHC tree anyway.

6 years agoFix a comment
Ian Lynagh [Sun, 9 Jun 2013 14:52:29 +0000 (15:52 +0100)] 
Fix a comment

6 years agoWhitespace only
Ian Lynagh [Sun, 9 Jun 2013 13:48:32 +0000 (14:48 +0100)] 
Whitespace only

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Sun, 9 Jun 2013 12:18:23 +0000 (13:18 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoFix warnings
Ian Lynagh [Sun, 9 Jun 2013 11:41:28 +0000 (12:41 +0100)] 
Fix warnings

6 years agoAdd support for byte endian swapping for Word 16/32/64.
Ian Lynagh [Sun, 9 Jun 2013 11:10:35 +0000 (12:10 +0100)] 
Add support for byte endian swapping for Word 16/32/64.

* Exposes bSwap{,16,32,64}# primops
* Add a new machops MO_BSwap
* Use a Stg implementation (hs_bswap{16,32,64}) for other implementation
  in NCG.
* Generate bswap in X86 NCG for 32 and 64 bits, and for 16 bits, bswap+shr
  instead of using xchg.
* Generate llvm.bswap intrinsics in llvm codegen.

Patch from Vincent Hanquez.

6 years agoOutline 7.8.1 release notes.
Austin Seipp [Sat, 8 Jun 2013 23:17:13 +0000 (18:17 -0500)] 
Outline 7.8.1 release notes.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agouse libffi for iOS adjustors; fixes #7718
Ian Lynagh [Sat, 8 Jun 2013 14:22:24 +0000 (15:22 +0100)] 
use libffi for iOS adjustors; fixes #7718

Based on a patch from Stephen Blackheath.

6 years agoImprove the version numbers generated by the build system
Ian Lynagh [Fri, 7 Jun 2013 21:37:04 +0000 (22:37 +0100)] 
Improve the version numbers generated by the build system

If we can't find a better date to use, then use today's date.

6 years agoAdd --show-options to list all flags (Fixes #7843)
Jan Stolarek [Tue, 4 Jun 2013 08:28:32 +0000 (10:28 +0200)] 
Add --show-options to list all flags (Fixes #7843)

6 years agoRemove old representation of CSEnv; part of #5996
Ian Lynagh [Thu, 6 Jun 2013 16:55:35 +0000 (17:55 +0100)] 
Remove old representation of CSEnv; part of #5996

6 years agoWhitespace only in compiler/simplCore/CSE.lhs
Ian Lynagh [Thu, 6 Jun 2013 15:22:32 +0000 (16:22 +0100)] 
Whitespace only in compiler/simplCore/CSE.lhs

6 years agoTraces and comments only
Simon Peyton Jones [Wed, 5 Jun 2013 16:46:42 +0000 (17:46 +0100)] 
Traces and comments only

6 years agoBetter computeDiscount for ValAppCtxt
Simon Peyton Jones [Wed, 5 Jun 2013 16:46:10 +0000 (17:46 +0100)] 
Better computeDiscount for ValAppCtxt

6 years agoTake proper account of over-saturated functions in CoreUnfold
Simon Peyton Jones [Wed, 5 Jun 2013 16:45:47 +0000 (17:45 +0100)] 
Take proper account of over-saturated functions in CoreUnfold

6 years agoMake the simplifier propagate strictness through casts
Simon Peyton Jones [Tue, 28 May 2013 08:05:07 +0000 (09:05 +0100)] 
Make the simplifier propagate strictness through casts

E.g.  (f e1 |> g) e2
If f is strict in two aguments, we want to see that in e2

Hence ArgSpec in SimplUtils

6 years agoAdd important missing case for bothCPR
Simon Peyton Jones [Tue, 28 May 2013 08:03:12 +0000 (09:03 +0100)] 
Add important missing case for bothCPR

If either side diverges, both do!

6 years agoTransfer strictness on trivial right-hand sides
Simon Peyton Jones [Tue, 28 May 2013 08:02:16 +0000 (09:02 +0100)] 
Transfer strictness on trivial right-hand sides

See Note [Trivial right-hand sides]

6 years agoUse checkRecTc to improve demand analysis slightly
Simon Peyton Jones [Tue, 28 May 2013 08:01:25 +0000 (09:01 +0100)] 
Use checkRecTc to improve demand analysis slightly

We now look inside one layer of recursive types, thanks to
checkRecTc.  It does mean we need an additional environment
field, ae_rec_tc.

I also commented out the apparently over-conservative test
at coercions.  I'm not 100% sure I'm right here, but I can't
see why the simpler code will go wrong, so I'm going to suck
it and see.

6 years agoRemove bogus-looking check, which was causing Trac #7894
Simon Peyton Jones [Tue, 28 May 2013 07:57:18 +0000 (08:57 +0100)] 
Remove bogus-looking check, which was causing Trac #7894

6 years agoAdd TyCon.checkRecTc, and use in in typeArity
Simon Peyton Jones [Tue, 28 May 2013 07:56:43 +0000 (08:56 +0100)] 
Add TyCon.checkRecTc, and use in in typeArity

This just formalises an abstraction we've been using anyway,
namely to expand "recursive" TyCons until we see them twice.
We weren't doing this in typeArity, and that inconsistency
was leading to a subsequent ASSERT failure, when compiling
Stream.hs, which has a newtype like this

   newtype Stream m a b = Stream (m (Either b (a, Stream m a b)))

6 years agoWibbles (merg-os) to ticky-ticky
Simon Peyton Jones [Thu, 9 May 2013 17:10:39 +0000 (18:10 +0100)] 
Wibbles (merg-os) to ticky-ticky

6 years agoComments about the Name Cache
Simon Peyton Jones [Thu, 9 May 2013 17:10:08 +0000 (18:10 +0100)] 
Comments about the Name Cache

6 years agoImplement cardinality analysis
Simon Peyton Jones [Fri, 3 May 2013 13:50:58 +0000 (14:50 +0100)] 
Implement cardinality analysis

This major patch implements the cardinality analysis described
in our paper "Higher order cardinality analysis". It is joint
work with Ilya Sergey and Dimitrios Vytiniotis.

The basic is augment the absence-analysis part of the demand
analyser so that it can tell when something is used
 never
 at most once
   some other way

The "at most once" information is used
    a) to enable transformations, and
       in particular to identify one-shot lambdas
    b) to allow updates on thunks to be omitted.

There are two new flags, mainly there so you can do performance
comparisons:
    -fkill-absence   stops GHC doing absence analysis at all
    -fkill-one-shot  stops GHC spotting one-shot lambdas
                     and single-entry thunks

The big changes are:

* The Demand type is substantially refactored.  In particular
  the UseDmd is factored as follows
      data UseDmd
        = UCall Count UseDmd
        | UProd [MaybeUsed]
        | UHead
        | Used

      data MaybeUsed = Abs | Use Count UseDmd

      data Count = One | Many

  Notice that UCall recurses straight to UseDmd, whereas
  UProd goes via MaybeUsed.

  The "Count" embodies the "at most once" or "many" idea.

* The demand analyser itself was refactored a lot

* The previously ad-hoc stuff in the occurrence analyser for foldr and
  build goes away entirely.  Before if we had build (\cn -> ...x... )
  then the "\cn" was hackily made one-shot (by spotting 'build' as
  special.  That's essential to allow x to be inlined.  Now the
  occurrence analyser propagates info gotten from 'build's stricness
  signature (so build isn't special); and that strictness sig is
  in turn derived entirely automatically.  Much nicer!

* The ticky stuff is improved to count single-entry thunks separately.

One shortcoming is that there is no DEBUG way to spot if an
allegedly-single-entry thunk is acually entered more than once.  It
would not be hard to generate a bit of code to check for this, and it
would be reassuring.  But it's fiddly and I have not done it.

Despite all this fuss, the performance numbers are rather under-whelming.
See the paper for more discussion.

       nucleic2          -0.8%    -10.9%      0.10      0.10     +0.0%
         sphere          -0.7%     -1.5%      0.08      0.08     +0.0%
--------------------------------------------------------------------------------
            Min          -4.7%    -10.9%     -9.3%     -9.3%    -50.0%
            Max          -0.4%     +0.5%     +2.2%     +2.3%     +7.4%
 Geometric Mean          -0.8%     -0.2%     -1.3%     -1.3%     -1.8%

I don't quite know how much credence to place in the runtime changes,
but movement seems generally in the right direction.

6 years agoComments and white space only
Simon Peyton Jones [Fri, 3 May 2013 13:48:31 +0000 (14:48 +0100)] 
Comments and white space only

6 years agoFix panic on deriving a nullary typeclass (#7959)
Krzysztof Gogolewski [Mon, 3 Jun 2013 15:07:23 +0000 (17:07 +0200)] 
Fix panic on deriving a nullary typeclass (#7959)

6 years agoImrove Lint to check unfoldings
Simon Peyton Jones [Wed, 5 Jun 2013 16:54:19 +0000 (17:54 +0100)] 
Imrove Lint to check unfoldings

6 years agoUpdate docs for "set prompt2"
Ian Lynagh [Tue, 4 Jun 2013 20:27:44 +0000 (21:27 +0100)] 
Update docs for "set prompt2"

6 years agoFix thunk leak in CoreM's CoreWriter
Andrew Farmer [Fri, 8 Mar 2013 00:13:03 +0000 (18:13 -0600)] 
Fix thunk leak in CoreM's CoreWriter

6 years agoWhitespace only
Ian Lynagh [Tue, 4 Jun 2013 19:31:45 +0000 (20:31 +0100)] 
Whitespace only