ghc.git
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

6 years agoReformat help message for `:show` to fit into 80 cols again.
usrbincc [Tue, 21 May 2013 17:45:40 +0000 (13:45 -0400)] 
Reformat help message for `:show` to fit into 80 cols again.

6 years agoFormatting only: fix alignment.
usrbincc [Tue, 21 May 2013 17:36:39 +0000 (13:36 -0400)] 
Formatting only: fix alignment.

6 years agoAdd the ability to customize the continuation prompt.
usrbincc [Mon, 20 May 2013 19:28:35 +0000 (15:28 -0400)] 
Add the ability to customize the continuation prompt.

- Remove unused property `def_prompt`.

6 years agoUntabify
Geoffrey Mainland [Mon, 3 Jun 2013 12:20:51 +0000 (13:20 +0100)] 
Untabify

6 years agoUntabify
Geoffrey Mainland [Mon, 3 Jun 2013 12:20:46 +0000 (13:20 +0100)] 
Untabify

6 years agoUntabify
Geoffrey Mainland [Mon, 3 Jun 2013 12:20:42 +0000 (13:20 +0100)] 
Untabify

6 years agoUntabify
Geoffrey Mainland [Mon, 3 Jun 2013 12:20:38 +0000 (13:20 +0100)] 
Untabify

6 years agoFix a comment
Ian Lynagh [Sun, 2 Jun 2013 12:25:16 +0000 (13:25 +0100)] 
Fix a comment

Make expands things even in comments

6 years agoAdd a comment
Ian Lynagh [Sat, 1 Jun 2013 18:16:56 +0000 (19:16 +0100)] 
Add a comment

6 years agoUse the symmetric version of the newtype coercion.
Iavor S. Diatchki [Fri, 31 May 2013 02:57:24 +0000 (19:57 -0700)] 
Use the symmetric version of the newtype coercion.

6 years agoBuild statically when using LLVM.
Geoffrey Mainland [Fri, 31 May 2013 15:12:17 +0000 (16:12 +0100)] 
Build statically when using LLVM.

The LLVM back end does not yet work when building dynamically.

6 years agoadd arm-unknown-linux to platforms which do not support shared libs
Karel Gardas [Thu, 4 Apr 2013 16:28:28 +0000 (18:28 +0200)] 
add arm-unknown-linux to platforms which do not support shared libs

This patch disables shared libs support on arm-unknown-linux platform. It
unbreaks ghc-stage2 on this platform after recent Ian's changes
in dynamic/shared libs domain. The reason why ghc-stage2 fails when linked
with shared libs is still unknown so this is just a workaround at the moment,
but it at least recovers previous "correct" behavior of ghc-stage2
on ARM/Linux

6 years agoset DYNAMIC_GHC_PROGRAMS to NO if platform does not support shared libs
Karel Gardas [Fri, 24 May 2013 21:04:56 +0000 (23:04 +0200)] 
set DYNAMIC_GHC_PROGRAMS to NO if platform does not support shared libs

6 years agoFix a trailing case in making FamInstTyCon,
Simon Peyton Jones [Thu, 30 May 2013 21:03:24 +0000 (22:03 +0100)] 
Fix a trailing case in making FamInstTyCon,
where the invariant didn't hold, leading to
subsequent chaos. Happily an ASSERT caught it.

6 years agoDefine chkAppend, and use it
Simon Peyton Jones [Thu, 30 May 2013 21:02:17 +0000 (22:02 +0100)] 
Define chkAppend, and use it

Somtimes we need (xs ++ ys) in situations where ys is
almost always empty.  Utils.chkAppend checks for that
case first.

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Thu, 30 May 2013 19:40:10 +0000 (20:40 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoRun ghc-pkg check during validate
Ian Lynagh [Thu, 30 May 2013 19:38:51 +0000 (20:38 +0100)] 
Run ghc-pkg check during validate

Should help to track down cache-out-of-date problems

6 years agoWhen verbose, give more information about cache status
Ian Lynagh [Thu, 30 May 2013 18:18:29 +0000 (19:18 +0100)] 
When verbose, give more information about cache status

6 years agoAdd a primitive for coercing values into dictionaries in a special case.
Iavor S. Diatchki [Thu, 30 May 2013 16:20:00 +0000 (09:20 -0700)] 
Add a primitive for coercing values into dictionaries in a special case.

The details of this are described in Note [magicSingIId magic] in basicTypes/MkId.lhs

6 years agoRemove an out-of-date comment
Ian Lynagh [Tue, 28 May 2013 16:31:53 +0000 (17:31 +0100)] 
Remove an out-of-date comment

6 years agoFix Read for empty data types (again; Trac #7931)
Simon Peyton Jones [Thu, 30 May 2013 14:12:12 +0000 (15:12 +0100)] 
Fix Read for empty data types (again; Trac #7931)

6 years agoEta-reduce data/newtype family instance axioms (Trac #4185)
Simon Peyton Jones [Thu, 30 May 2013 12:56:07 +0000 (13:56 +0100)] 
Eta-reduce data/newtype family instance axioms (Trac #4185)

This long-overdue fix arranges to eta-reduce the axiom for a
data/newtype instance in the same way that we have longq
eta-reduced the axiom for a newtype.

See Note [Eta reduction for data family axioms] in TcInstDcls
and Note [Deriving, type families, and partial applications] in TcDeriv.

6 years agoImprove validity check to give better error message
Simon Peyton Jones [Thu, 30 May 2013 11:33:56 +0000 (12:33 +0100)] 
Improve validity check to give better error message

Fixes Trac #7809

6 years agoUse new TcHsType.zonkSigType to establish Type invariants
Simon Peyton Jones [Thu, 30 May 2013 11:32:25 +0000 (12:32 +0100)] 
Use new TcHsType.zonkSigType to establish Type invariants

Finally (I hope) fixes Trac #7903.

See Note [Zonking inside the knot] in TcHsSyn

6 years agoRefine 'type_determines_value' in Specialise. Fix Trac #7785.
Simon Peyton Jones [Thu, 30 May 2013 11:22:38 +0000 (12:22 +0100)] 
Refine 'type_determines_value' in Specialise.  Fix Trac #7785.

See Note [Type determines value] in Specialise.

6 years agoMake 'SPECIALISE instance' work again
Simon Peyton Jones [Thu, 30 May 2013 11:08:39 +0000 (12:08 +0100)] 
Make 'SPECIALISE instance' work again

This is a long-standing regression (Trac #7797), which meant that in
particular the Eq [Char] instance does not get specialised.
(The *methods* do, but the dictionary itself doesn't.)  So when you
call a function
     f :: Eq a => blah
on a string type (ie a=[Char]), 7.6 passes a dictionary of un-specialised
methods.

This only matters when calling an overloaded function from a
specialised context, but that does matter in some programs.  I
remember (though I cannot find the details) that Nick Frisby discovered
this to be the source of some pretty solid performanc regresisons.

Anyway it works now. The key change is that a DFunUnfolding now takes
a form that is both simpler than before (the DFunArg type is eliminated)
and more general:

data Unfolding
  = ...
  | DFunUnfolding {     -- The Unfolding of a DFunId
     -- See Note [DFun unfoldings]
          --     df = /\a1..am. \d1..dn. MkD t1 .. tk
                        --                                 (op1 a1..am d1..dn)
             --                             (op2 a1..am d1..dn)
        df_bndrs :: [Var],      -- The bound variables [a1..m],[d1..dn]
        df_con   :: DataCon,    -- The dictionary data constructor (never a newtype datacon)
        df_args  :: [CoreExpr]  -- Args of the data con: types, superclasses and methods,
    }                           -- in positional order

That in turn allowed me to re-enable the DFunUnfolding specialisation in
DsBinds.  Lots of details here in TcInstDcls:
  Note [SPECIALISE instance pragmas]

I also did some refactoring, in particular to pass the InScopeSet to
exprIsConApp_maybe (which in turn means it has to go to a RuleFun).

NB: Interface file format has changed!

6 years agoCheck for illegal syntax in types (fixes Trac #7943)
Simon Peyton Jones [Tue, 28 May 2013 12:14:54 +0000 (13:14 +0100)] 
Check for illegal syntax in types (fixes Trac #7943)

6 years agoGive 'unboundName' a very low binding precedence
Simon Peyton Jones [Mon, 27 May 2013 16:28:30 +0000 (17:28 +0100)] 
Give 'unboundName' a very low binding precedence

This fixes Trac #7937

6 years agoPrint kinds of non-* tyvar binders in pprTyThing
Simon Peyton Jones [Mon, 27 May 2013 16:28:03 +0000 (17:28 +0100)] 
Print kinds of non-* tyvar binders in pprTyThing

This makes the output of :info more useful

6 years agoDo not do an ambiguity check on the type in a GHCi ":kind" command
Simon Peyton Jones [Mon, 27 May 2013 16:27:33 +0000 (17:27 +0100)] 
Do not do an ambiguity check on the type in a GHCi ":kind" command

Otherwise we get errors for polykinded type families;
   type family F a :: *
Then :k F
would give an ambiguity check trying to unify (F k1) with (F k2),
which is all a bit stupid.

I found this when investigating Trac #7939

6 years agoAccept derived Read on an empty data type (Trac #7931)
Simon Peyton Jones [Mon, 27 May 2013 14:36:08 +0000 (15:36 +0100)] 
Accept derived Read on an empty data type (Trac #7931)

6 years agoDon't try to use -dynamic-too on Windows
Ian Lynagh [Wed, 22 May 2013 12:59:21 +0000 (13:59 +0100)] 
Don't try to use -dynamic-too on Windows

It doesn't work

6 years agoRevert "Fix -dynamic-too on Windows"
Ian Lynagh [Wed, 22 May 2013 12:41:09 +0000 (13:41 +0100)] 
Revert "Fix -dynamic-too on Windows"

This reverts commit 5734f7afcc2b9acf857f8e0f745185bf01b91148.

It didn't fully fix -dynamic-too on Windows

6 years agoAdd an echo target to the build system
Ian Lynagh [Fri, 24 May 2013 16:31:35 +0000 (17:31 +0100)] 
Add an echo target to the build system

6 years agoFix crash with large objects (#7919)
Simon Marlow [Fri, 24 May 2013 07:30:25 +0000 (08:30 +0100)] 
Fix crash with large objects (#7919)

See comments for details.

6 years agoComment typo
Simon Peyton Jones [Wed, 22 May 2013 16:44:04 +0000 (17:44 +0100)] 
Comment typo

6 years agoWibbles to yesterday's "Simplify kind generalisation" patch
Simon Peyton Jones [Wed, 22 May 2013 16:43:56 +0000 (17:43 +0100)] 
Wibbles to yesterday's "Simplify kind generalisation" patch

In particular, in mkExport we must quantify over the kind
variables mentioned in the kinds of the free type variables

6 years agoFix #5863
Jose Pedro Magalhaes [Tue, 21 May 2013 13:55:36 +0000 (14:55 +0100)] 
Fix #5863

6 years agoMake AutoDeriveTypeable derive Typeable instances for promoted data constructors
Jose Pedro Magalhaes [Tue, 21 May 2013 09:12:01 +0000 (10:12 +0100)] 
Make AutoDeriveTypeable derive Typeable instances for promoted data constructors

6 years agoHandle -opt<blah> options more consistently (#7909)
Simon Marlow [Tue, 21 May 2013 09:34:04 +0000 (10:34 +0100)] 
Handle -opt<blah> options more consistently (#7909)

Now these are always added by the run<blah> functions in SysTools, so
we never miss any out.  Several cleanups resulted.