7 years agoDon't use stdcall on Win64: It isn't supported; ccall is used instead
Ian Lynagh [Wed, 16 May 2012 14:14:36 +0000 (15:14 +0100)] 
Don't use stdcall on Win64: It isn't supported; ccall is used instead

7 years agoMerge branch 'master' of
Ian Lynagh [Tue, 15 May 2012 17:18:19 +0000 (18:18 +0100)] 
Merge branch 'master' of

7 years agoFollow changes in Cabal.
Paolo Capriotti [Tue, 15 May 2012 09:32:58 +0000 (10:32 +0100)] 
Follow changes in Cabal.

7 years agoAdd a fixity environment to InteractiveContext (#2947)
Paolo Capriotti [Wed, 2 May 2012 18:22:10 +0000 (19:22 +0100)] 
Add a fixity environment to InteractiveContext (#2947)

7 years agoSimplify the behavior of package db flags.
Paolo Capriotti [Thu, 10 May 2012 15:18:21 +0000 (16:18 +0100)] 
Simplify the behavior of package db flags.

Previously, the `-no-user-package` and `-no-global-package` flags
affected the "initial" stack only, while `user-package` and
`global-packages` appended to the end of the stack.

This commit changes the behavior of those flags, so that they are always
applied to the stack as a whole.

The effect of the GHC_PACKAGE_PATH environment variable has also been
changed: terminating it with a separator now adds the default package
dbs (user and global) instead of the initial stack.

7 years agoUpdate documentation of the package db flags.
Paolo Capriotti [Fri, 4 May 2012 14:56:36 +0000 (15:56 +0100)] 
Update documentation of the package db flags.

7 years agoRename package-conf flags to package-db.
Paolo Capriotti [Fri, 4 May 2012 12:04:43 +0000 (13:04 +0100)] 
Rename package-conf flags to package-db.

Rename package database flags in both GHC and ghc-pkg so that they are
consistent with Cabal nomenclature.

Add a version check to the build system so that the correct set of
package db flags are used when the bootstrapping GHC has version < 7.5.

7 years agoAdd flags to manipulate package db stack (#5977)
Paolo Capriotti [Thu, 3 May 2012 10:29:51 +0000 (11:29 +0100)] 
Add flags to manipulate package db stack (#5977)

Introduce new flags to allow any package database stack to be set up.
The `-no-user-package-conf` and `-no-global-package-conf` flags remove
the corresponding package db from the initial stack, while
`-user-package-conf` and `-global-package-conf` push it back on top of
the stack.

7 years agoTweak the lexer: In particular, improve notFollowedBy and friends
Ian Lynagh [Mon, 14 May 2012 23:16:59 +0000 (00:16 +0100)] 
Tweak the lexer: In particular, improve notFollowedBy and friends

We were hitting a problem when reading the LANGUAGE/OPTIONS pragmas
from GHC.TypeLits, where the buffer ended "{-". The rules for the
start-comment lexeme check that "{-" is not followed by "#", but the
test returned False when there was no next character. Therefore we
were lexing this as as an open-curly lexeme (only consuming the "{",
and not reaching the end of the buffer),
which meant the options parser think that it had reached the end of
the options.

Now we correctly lex as "{-".

7 years agoUse pprInfixName in pprInfo (#6091)
Paolo Capriotti [Mon, 14 May 2012 12:37:14 +0000 (13:37 +0100)] 
Use pprInfixName in pprInfo (#6091)

Surround a name in backticks when printing an infix declaration in GHCi.

7 years agoFix the the pure unifier so that it unifies kinds
Simon Peyton Jones [Mon, 14 May 2012 13:05:48 +0000 (14:05 +0100)] 
Fix the the pure unifier so that it unifies kinds

When unifying two type variables we must unify their kinds.
The pure *matcher* was doing so, but the pure *unifier* was not.
This patch fixes Trac #6015, where an instance lookup was failing
when it should have succeeded.

I removed a bunch of code aimed at support sub-kinding. It's
tricky, ad-hoc, and I don't think its necessary any more.
Anything we can do to simplify the sub-kinding story is welcome!

7 years agoMerge branch 'master' of
Simon Peyton Jones [Fri, 11 May 2012 17:03:01 +0000 (18:03 +0100)] 
Merge branch 'master' of

7 years agoDelete dead code mkIParamTyCon
Simon Peyton Jones [Fri, 11 May 2012 17:02:47 +0000 (18:02 +0100)] 
Delete dead code mkIParamTyCon

7 years agoRefactor LHsTyVarBndrs to fix Trac #6081
Simon Peyton Jones [Fri, 11 May 2012 17:02:18 +0000 (18:02 +0100)] 
Refactor LHsTyVarBndrs to fix Trac #6081

This is really a small change, but it touches a lot of files quite
significantly. The real goal is to put the implicitly-bound kind
variables of a data/class decl in the right place, namely on the
LHsTyVarBndrs type, which now looks like

  data LHsTyVarBndrs name
    = HsQTvs { hsq_kvs :: [Name]
             , hsq_tvs :: [LHsTyVarBndr name]

This little change made the type checker neater in a number of
ways, but it was fiddly to push through the changes.

7 years agoHandle cases with no alternatives in GHCi
Simon Marlow [Fri, 11 May 2012 09:26:28 +0000 (10:26 +0100)] 
Handle cases with no alternatives in GHCi

Fixes cgrun045(ghci) amongst others

7 years agoFix bug in expandTypeSynonyms that could rarely cause problems
Max Bolingbroke [Thu, 10 May 2012 08:46:04 +0000 (09:46 +0100)] 
Fix bug in expandTypeSynonyms that could rarely cause problems

7 years agoComments only
Simon Peyton Jones [Thu, 10 May 2012 08:45:16 +0000 (09:45 +0100)] 
Comments only

7 years agoFix build on Win64
Ian Lynagh [Wed, 9 May 2012 23:53:28 +0000 (00:53 +0100)] 
Fix build on Win64

7 years agoMerge branch 'master' of
Simon Peyton Jones [Wed, 9 May 2012 16:52:24 +0000 (17:52 +0100)] 
Merge branch 'master' of

7 years agoFix build on Win64
Ian Lynagh [Wed, 9 May 2012 15:45:40 +0000 (16:45 +0100)] 
Fix build on Win64

7 years agoRe-do the "function application discount" (fixes Trac #6048)
Simon Peyton Jones [Wed, 9 May 2012 15:22:49 +0000 (16:22 +0100)] 
Re-do the "function application discount" (fixes Trac #6048)

* Undoes Max's very aggressive function-inlining change
  (see comments with Trac #6048)

* Resticts function application discount to functions
  that occur just once in the body. It was the multiple
  occurrences that led to the exponential behavour in
  Trac #6048.

See Note [Function application discount] in CoreUnfold.

Module binary sizes are down 2% on average, which is good.
Allocations wobble about a bit, but only on a few benchmarks
and not by much, so it seems a price worth paying to avoid
exponential behaviour!

            Min           -1.2%
            Max           +2.8%
 Geometric Mean           +0.0%

7 years agoTake care not to mix polymorphic and unlifted bindings in a group
Simon Peyton Jones [Wed, 9 May 2012 14:23:25 +0000 (15:23 +0100)] 
Take care not to mix polymorphic and unlifted bindings in a group

Fixes Trac #6078

7 years agoWibbles to 'simplify the SimplCont data type'
Simon Peyton Jones [Tue, 8 May 2012 09:25:22 +0000 (10:25 +0100)] 
Wibbles to 'simplify the SimplCont data type'

7 years agoSimplify the SimplCont data type
Simon Peyton Jones [Fri, 4 May 2012 22:02:46 +0000 (23:02 +0100)] 
Simplify the SimplCont data type

* Put the result type in the Stop continuation
* No need for the alts type in Select

The result is a modest but useful simplification

7 years agoMerge branch 'ghc-new-flavor'
Simon Peyton Jones [Wed, 9 May 2012 14:50:54 +0000 (15:50 +0100)] 
Merge branch 'ghc-new-flavor'

7 years agoDon't pointlessly cast sizeof's result to size_t
Ian Lynagh [Wed, 9 May 2012 13:49:48 +0000 (14:49 +0100)] 
Don't pointlessly cast sizeof's result to size_t

7 years agoMake fresh variables when decomposing Givens
Simon Peyton Jones [Wed, 9 May 2012 13:12:59 +0000 (14:12 +0100)] 
Make fresh variables when decomposing Givens

This turns out to be important becuase we don't have
a form for superclass selection in TcCoercion (we could
but we don't).

Se comments with xCtFlavor_cache, the Given case.

7 years agoUse fresh uniques when unboxing coercions in the desugarer
Simon Peyton Jones [Wed, 9 May 2012 13:11:54 +0000 (14:11 +0100)] 
Use fresh uniques when unboxing coercions in the desugarer

This is kosher, and turns out to be vital when we have
more complicate evidence terms.

7 years agoCosmetics
Simon Peyton Jones [Wed, 9 May 2012 13:11:09 +0000 (14:11 +0100)] 

7 years agoBe a little less aggressive about inlining (fixes Trac #5623)
Simon Peyton Jones [Wed, 9 May 2012 10:06:44 +0000 (11:06 +0100)] 
Be a little less aggressive about inlining (fixes Trac #5623)

When inlining, we are making a copy of the expression, so we have to
be careful about duplicating work.  Previously we were using
exprIsCheap for that, but it is willing to duplicate a cheap primop --
and that is terribly bad if it happens inside some inner array loop
(Trac #5623).  So now we use a new function exprIsWorkFree.  Even
then there is some wiggle room:
   see Note [exprIsWorkFree] in CoreUtils

This commit does make wheel-sieve1 allocate a lot more, but we decided
that's just tough; it's more important for inlining to be robust
about not duplicating work.

7 years agoMerge branch 'master' of
Ian Lynagh [Tue, 8 May 2012 17:31:47 +0000 (18:31 +0100)] 
Merge branch 'master' of

7 years agoEnable FileLock for win32 (#4363)
Paolo Capriotti [Tue, 8 May 2012 13:05:28 +0000 (14:05 +0100)] 
Enable FileLock for win32 (#4363)

7 years agoMove getMonotonicUSec from base to the RTS.
Paolo Capriotti [Tue, 8 May 2012 12:05:14 +0000 (13:05 +0100)] 
Move getMonotonicUSec from base to the RTS.

7 years agoFollow upstream mtl and Cabal, add transformers package (#5958)
Paolo Capriotti [Mon, 7 May 2012 22:21:20 +0000 (23:21 +0100)] 
Follow upstream mtl and Cabal, add transformers package (#5958)

7 years agoAdapt to changes in Cabal.
Paolo Capriotti [Mon, 7 May 2012 16:45:00 +0000 (17:45 +0100)] 
Adapt to changes in Cabal.

7 years agoAdd support for .text.startup sections to the Linker
Ian Lynagh [Mon, 7 May 2012 21:45:04 +0000 (22:45 +0100)] 
Add support for .text.startup sections to the Linker

We get these in a full build on Win64

7 years agoYet another major refactoring of the constraint solver
Simon Peyton Jones [Mon, 7 May 2012 16:40:34 +0000 (17:40 +0100)] 
Yet another major refactoring of the constraint solver

This is the result of Simon and Dimitrios doing a code walk through.
There is no change in behaviour, but the structure is much better.
Main changes:

* Given constraints contain an EvTerm not an EvVar

* Correspondingly, TcEvidence is a recursive types that uses
  EvTerms rather than EvVars

* Rename CtFlavor to CtEvidence

* Every CtEvidence has a ctev_pred field.  And use record fields
  consistently for CtEvidence

* The solved-constraint fields of InertSet (namely inert_solved and
  inert_solved_funeqs) contain CtEvidence, not Ct

There is a long cascade of follow-on changes.

7 years agoMerge branch 'master' of
Ian Lynagh [Mon, 7 May 2012 16:14:07 +0000 (17:14 +0100)] 
Merge branch 'master' of

7 years agoFix alignment when loading .a files on Win64
Ian Lynagh [Mon, 7 May 2012 14:27:13 +0000 (15:27 +0100)] 
Fix alignment when loading .a files on Win64

7 years agoTest for misaligned sections, and fail if we find one
Ian Lynagh [Mon, 7 May 2012 14:18:57 +0000 (15:18 +0100)] 
Test for misaligned sections, and fail if we find one

7 years agoFix #6080 & house keeping in Vectorise.Exp
Manuel M T Chakravarty [Mon, 7 May 2012 14:12:00 +0000 (00:12 +1000)] 
Fix #6080 & house keeping in Vectorise.Exp

7 years agoBuild fix
Ian Lynagh [Sun, 6 May 2012 19:49:58 +0000 (20:49 +0100)] 
Build fix

7 years agoFollow changes in haskeline
Ian Lynagh [Sun, 6 May 2012 19:01:00 +0000 (20:01 +0100)] 
Follow changes in haskeline

I'm not sure if we still need to encode the error, but validate is happy
with this fix, at least.

7 years agoFix the way we call strip on DLLs
Ian Lynagh [Sun, 6 May 2012 18:39:41 +0000 (19:39 +0100)] 
Fix the way we call strip on DLLs

On Win64, "install -s" calls a strip that doesn't understand 64bit
binaries. For some reason, this means the DLLs end up non-executable,
which means executables that use them just segfault.

7 years agoFix RTS DLL references on Win64
Ian Lynagh [Sun, 6 May 2012 14:54:13 +0000 (15:54 +0100)] 
Fix RTS DLL references on Win64

7 years agoWorking towards fixing DLLs on Win64
Ian Lynagh [Sun, 6 May 2012 01:21:17 +0000 (02:21 +0100)] 
Working towards fixing DLLs on Win64

7 years agoInstall DLLs as executable
Ian Lynagh [Sat, 5 May 2012 22:52:14 +0000 (23:52 +0100)] 
Install DLLs as executable

Otherwise the dynHelloWorld test segfaults when run from an installed
compiler on cygwin.

7 years agoUse lnats to avoid overflowing when allocating large amounts
Ian Lynagh [Sat, 5 May 2012 13:54:09 +0000 (14:54 +0100)] 
Use lnats to avoid overflowing when allocating large amounts

Stops outofmem segfaulting on Win64

7 years agoEnable and fix building dynlibs on Win64
Ian Lynagh [Fri, 4 May 2012 19:07:56 +0000 (20:07 +0100)] 
Enable and fix building dynlibs on Win64

7 years agoMerge branch 'master' of
Ian Lynagh [Fri, 4 May 2012 16:59:17 +0000 (17:59 +0100)] 
Merge branch 'master' of

7 years agoFollow libffi changes on Windows
Ian Lynagh [Fri, 4 May 2012 15:26:59 +0000 (16:26 +0100)] 
Follow libffi changes on Windows

7 years agoFix typo in error message (Trac #6076)
Simon Peyton Jones [Fri, 4 May 2012 14:29:30 +0000 (15:29 +0100)] 
Fix typo in error message (Trac #6076)

7 years agoFix overnight build breakage (fix from simonpj)
Simon Marlow [Thu, 3 May 2012 07:47:40 +0000 (08:47 +0100)] 
Fix overnight build breakage (fix from simonpj)

compiler/simplCore/SimplUtils.lhs:1668:5-25: Irrefutable pattern failed for pattern ((_, _, rhs1) : _)

7 years agoAdd _getpid to rtsSyms on Win64
Ian Lynagh [Thu, 3 May 2012 12:08:52 +0000 (13:08 +0100)] 
Add _getpid to rtsSyms on Win64

7 years agoCheck the calling convention of foreign imported labels is supported
Ian Lynagh [Thu, 3 May 2012 11:13:02 +0000 (12:13 +0100)] 
Check the calling convention of foreign imported labels is supported

Fixes 2276_ghci on Win64

7 years agoMerge branch 'master' of
Ian Lynagh [Wed, 2 May 2012 17:01:32 +0000 (18:01 +0100)] 
Merge branch 'master' of

7 years agoWin64 build fix
Ian Lynagh [Wed, 2 May 2012 16:31:59 +0000 (17:31 +0100)] 
Win64 build fix

7 years agoMore Win64 ghci fixes
Ian Lynagh [Wed, 2 May 2012 16:00:56 +0000 (17:00 +0100)] 
More Win64 ghci fixes

7 years agoMerge branch 'master' of
Simon Peyton Jones [Wed, 2 May 2012 14:44:30 +0000 (15:44 +0100)] 
Merge branch 'master' of

7 years agoAllow cases with empty alterantives
Simon Peyton Jones [Wed, 2 May 2012 14:44:14 +0000 (15:44 +0100)] 
Allow cases with empty alterantives

This patch allows, for the first time, case expressions with an empty
list of alternatives. Max suggested the idea, and Trac #6067 showed
that it is really quite important.

So I've implemented the idea, fixing #6067. Main changes

 * See Note [Empty case alternatives] in CoreSyn

 * Various foldr1's become foldrs

 * IfaceCase does not record the type of the alternatives.
   I added IfaceECase for empty-alternative cases.

 * Core Lint does not complain about empty cases

 * MkCore.castBottomExpr constructs an empty-alternative case
   expression   (case e of ty {})

 * CoreToStg converts '(case e of {})' to just 'e'

7 years agoCast memory primops in the C backend (#5976)
Paolo Capriotti [Wed, 2 May 2012 14:24:46 +0000 (15:24 +0100)] 
Cast memory primops in the C backend (#5976)

To prevent conflicts with GCC builtins, generate identical code for
calls to mem primos and FFI calls.

Based on a patch by Joachim Breitner.

7 years agoWin64 Linker improvements
Ian Lynagh [Wed, 2 May 2012 14:11:45 +0000 (15:11 +0100)] 
Win64 Linker improvements

We now detect if we are given a value that is out of range for a
32bit relocation, and fail with an error.

Added a load more symbols to rtsSyms.

7 years agoAdd 'free' to the list of rtsSyms on Win64
Ian Lynagh [Wed, 2 May 2012 12:27:43 +0000 (13:27 +0100)] 
Add 'free' to the list of rtsSyms on Win64

Without this, we ended up using
    (gdb) info symbol 0x7ff756a10ac
    msvcrt!free in section .text of C:\Windows\system32\msvcrt.dll
for free, rather than
    (gdb) info symbol 0x2584128
    free in section .text of C:\m64\ghci2\q/../inplace/bin/ghc-stage2.exe
but we were trying to put the address into a 32bit relocation.

7 years agoFix Win64 build now that hsc2hs knows what platform we're on
Ian Lynagh [Tue, 1 May 2012 19:06:44 +0000 (20:06 +0100)] 
Fix Win64 build now that hsc2hs knows what platform we're on

7 years agoDefine _HOST_OS and _HOST_ARCH when calling hsc2hs
Ian Lynagh [Tue, 1 May 2012 18:14:05 +0000 (19:14 +0100)] 
Define _HOST_OS and _HOST_ARCH when calling hsc2hs

In particular, old-time assumes that mingw32_HOST_OS is set when
we are on Windows, and was going wrong on Win64 because it wasn't

7 years agoTell checkProddableBlock how many bytes we want to write
Ian Lynagh [Tue, 1 May 2012 13:00:57 +0000 (14:00 +0100)] 
Tell checkProddableBlock how many bytes we want to write

It doesn't suffice for checkProddableBlock to just check whether the
largest possible write could be made at the address we are writing,
as if we are making a smaller write then checkProddableBlock may
conservatively think we will write off the end of the block.

Thus we now tell checkProddableBlock how many bytes we will write.

7 years agoRevert "Revert "More Win32 build fixes""
Ian Lynagh [Tue, 1 May 2012 12:14:58 +0000 (13:14 +0100)] 
Revert "Revert "More Win32 build fixes""

This reverts commit 29cd6f435f2afb332ad8faf39f5e920ff9c38d9a.

7 years agoRevert "Revert "Fix build of rts/Linker.c on Win32""
Ian Lynagh [Tue, 1 May 2012 12:14:57 +0000 (13:14 +0100)] 
Revert "Revert "Fix build of rts/Linker.c on Win32""

This reverts commit 02cf6d6f71b5772aa4ddf1b70c192a802886e2c2.

7 years agoRevert "Revert "Get GHCi working on Win64""
Ian Lynagh [Tue, 1 May 2012 12:14:53 +0000 (13:14 +0100)] 
Revert "Revert "Get GHCi working on Win64""

This reverts commit 27e585bda6ae8ab68f58abdcb9e06806414a6636.

7 years agoRevert "Get GHCi working on Win64"
Manuel M T Chakravarty [Tue, 1 May 2012 07:48:09 +0000 (17:48 +1000)] 
Revert "Get GHCi working on Win64"

This reverts commit 05b55c670c7fe3fc01827ca02aafb6926c0b69cb.

7 years agoRevert "Fix build of rts/Linker.c on Win32"
Manuel M T Chakravarty [Tue, 1 May 2012 07:47:49 +0000 (17:47 +1000)] 
Revert "Fix build of rts/Linker.c on Win32"

This reverts commit 0042c478f1169ddd9392fb39de7d0aed865a272e.

7 years agoRevert "More Win32 build fixes"
Manuel M T Chakravarty [Tue, 1 May 2012 07:43:01 +0000 (17:43 +1000)] 
Revert "More Win32 build fixes"

This reverts commit e89ef70475fa5e9cf17af01b1b5d7fced0d2e13c.

7 years agoWibble to pretty printing
Simon Peyton Jones [Tue, 1 May 2012 07:17:59 +0000 (08:17 +0100)] 
Wibble to pretty printing

7 years agoMerge branch 'master' of
Simon Peyton Jones [Tue, 1 May 2012 07:08:13 +0000 (08:08 +0100)] 
Merge branch 'master' of

7 years agoTidy up a remaining glitch in unification
Simon Peyton Jones [Tue, 1 May 2012 07:07:52 +0000 (08:07 +0100)] 
Tidy up a remaining glitch in unification

There was one place, in type checking parallel list comprehensions
where we were unifying types, but had no convenient way to use the
resulting coercion; instead we just checked that it was Refl.  This
was Wrong Wrong; it might fail unpredicably in a GADT-like situation,
and it led to extra error-generation code used only in this one place.

This patch tidies it all up, by moving the 'return' method from the
*comprehension* to the ParStmtBlock. The latter is a new data type,
now used for each sub-chunk of a parallel list comprehension.

Because of the data type change, quite a few modules are touched,
but only in a fairly trivial way. The real changes are in TcMatches
(and corresponding desugaring); plus deleting code from TcUnify.

This patch also fixes the pretty-printing bug in Trac #6060

7 years agoFix maintenance of n_blocks in the RTS
Ian Lynagh [Mon, 30 Apr 2012 23:25:55 +0000 (00:25 +0100)] 
Fix maintenance of n_blocks in the RTS

It was causing assertion failures of
    ASSERT(countBlocks(nursery->blocks) == nursery->n_blocks)
    ghc-stage2: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 878

7 years agoMore Win32 build fixes
Ian Lynagh [Mon, 30 Apr 2012 21:47:15 +0000 (22:47 +0100)] 
More Win32 build fixes

7 years agoFixes for x86/Linux
Ian Lynagh [Mon, 30 Apr 2012 19:37:29 +0000 (20:37 +0100)] 
Fixes for x86/Linux

7 years agoFix the stage1 ghc hschooks.c
Ian Lynagh [Mon, 30 Apr 2012 19:14:36 +0000 (20:14 +0100)] 
Fix the stage1 ghc hschooks.c

The stage0 compiler might have a different idea as to what type lnat
corresponds to, so cast the value to the type we want.

7 years agoFix build of rts/Linker.c on Win32
Ian Lynagh [Mon, 30 Apr 2012 17:59:24 +0000 (18:59 +0100)] 
Fix build of rts/Linker.c on Win32

7 years agoMerge branch 'master' of
Ian Lynagh [Mon, 30 Apr 2012 17:04:54 +0000 (18:04 +0100)] 
Merge branch 'master' of

7 years agoGet GHCi working on Win64
Ian Lynagh [Mon, 30 Apr 2012 15:54:23 +0000 (16:54 +0100)] 
Get GHCi working on Win64

7 years agoDocument eta expansion under GHC bugs and infelicities
Simon Peyton Jones [Mon, 30 Apr 2012 15:43:02 +0000 (16:43 +0100)] 
Document eta expansion under GHC bugs and infelicities

7 years agoEgregious typo (fixes Trac #6055)
Simon Peyton Jones [Mon, 30 Apr 2012 15:20:01 +0000 (16:20 +0100)] 
Egregious typo (fixes Trac #6055)

7 years agoMerge branch 'master' of
Simon Peyton Jones [Mon, 30 Apr 2012 12:43:33 +0000 (13:43 +0100)] 
Merge branch 'master' of

7 years agoMore explicit pretty-printing of promoted TyCons with -dppr-debug
Simon Peyton Jones [Mon, 30 Apr 2012 12:40:51 +0000 (13:40 +0100)] 
More explicit pretty-printing of promoted TyCons with -dppr-debug

7 years agoMake the interface-file deserialisation work right for promoted types (Trac #6054)
Simon Peyton Jones [Mon, 30 Apr 2012 12:40:23 +0000 (13:40 +0100)] 
Make the interface-file deserialisation work right for promoted types (Trac #6054)

GHC currently uses the slightly-dodgy plan that when we proote
a TyCon to be a Kind constructor we leave it with the same Name.

That means that to make sense of a IfaceType we need to know wheter
it is really an IfaceType or an IfaceKind, because in the latter an
occurrence of (say) Maybe will be the *promoted* Maybe.

See Note [Checking IfaceTypes vs IfaceKinds] in TcIface

7 years agoRevert "Add -faggressive-primops"
Simon Peyton Jones [Fri, 27 Apr 2012 17:07:57 +0000 (18:07 +0100)] 
Revert "Add -faggressive-primops"

This reverts commit 745ec959ff647c3a455767d20f6f37e9a0cc65aa.

Sigh. Seg fault

7 years agoRevert "Refactoring in CoreUtils/CoreArity"
Simon Peyton Jones [Fri, 27 Apr 2012 17:07:26 +0000 (18:07 +0100)] 
Revert "Refactoring in CoreUtils/CoreArity"

This reverts commit e3f8557c2aca04cf64eec6a1aacde6e01c0944ff.

Sigh. Seg fault.

7 years agoRevert "Make more primops cheaper"
Simon Peyton Jones [Fri, 27 Apr 2012 17:06:33 +0000 (18:06 +0100)] 
Revert "Make more primops cheaper"

This reverts commit a365a58eade7cb2c961af8e60c20b7d78b1b7484.

Sigh.  Seg fault.  Major sigh.

7 years agoMerge branch 'master' of
Simon Peyton Jones [Fri, 27 Apr 2012 16:46:43 +0000 (17:46 +0100)] 
Merge branch 'master' of

7 years agoMake more primops cheaper
Simon Peyton Jones [Fri, 27 Apr 2012 16:45:56 +0000 (17:45 +0100)] 
Make more primops cheaper

This puts back the earlier behaviour (pre "aggressive-primop" patch)
whereby most primpos were considered cheap.  In the aggressive-primop
patch we made them ones with bigger "code_size" seem not-cheap, but
this slows down fft2 a lot.  So I've reverted to the earlier behaviour.

   +++ b/compiler/prelude/PrimOp.lhs
   @@ -450,6 +450,8 @@ primOpIsCheap op
      -- This is vital; see Note [PrimOp can_fail and has_side_effects]
    && not (primOpOutOfLine op)
  -   -- && primOpCodeSize op <= primOpCodeSizeDefault
  +-- Omitting; it makes fft2 run a lot slower by preventing
  +--           eta expansion in an inner loop, with a primop cosDouble#

7 years agoComment out a pprTrace unless DEBUG is on (fix Trac #5929)
Simon Peyton Jones [Fri, 27 Apr 2012 16:42:22 +0000 (17:42 +0100)] 
Comment out a pprTrace unless DEBUG is on (fix Trac #5929)

7 years agoMerge branch 'master' of
Simon Peyton Jones [Fri, 27 Apr 2012 16:35:32 +0000 (17:35 +0100)] 
Merge branch 'master' of

7 years agoPretty printing and debug improvements
Simon Peyton Jones [Fri, 27 Apr 2012 15:50:09 +0000 (16:50 +0100)] 
Pretty printing and debug improvements

7 years agoMerge branch 'master' of
Simon Peyton Jones [Fri, 27 Apr 2012 15:28:31 +0000 (16:28 +0100)] 
Merge branch 'master' of

7 years agoRefactoring in CoreUtils/CoreArity
Simon Peyton Jones [Fri, 27 Apr 2012 15:28:02 +0000 (16:28 +0100)] 
Refactoring in CoreUtils/CoreArity

In the previous commit about "aggressive primops" I wanted a new
function CoreUtils.exprCertainlyTerminates.  In doing this I ended up
with a significant refactoring in CoreUtils.  The new structure has
quite a lot of nice sharing:

         exprIsCheap             = exprIsCheap' isHNFApp
         exprIsExpandable        = exprIsCheap' isConLikeApp

         exprIsHNF               = exprIsHNFlike isHNFApp
         exprIsConLike           = exprIsHNFlike isConLikeApp
         exprCertainlyTerminates = exprIsHNFlike isTerminatingApp

This patch also does some renaming

    CheapAppFun      -->   FunAppAnalyser
    isCheapApp       -->   isHNFApp
    isExpandableApp  -->   isConLikeApp

7 years agoAdd -faggressive-primops
Simon Peyton Jones [Fri, 27 Apr 2012 15:25:12 +0000 (16:25 +0100)] 
Add -faggressive-primops

I'm experimenting with making GHC a bit more aggressive about

  a) dropping case expressions if the result is unused
        Simplify.rebuildCase, CaseElim equation

  b) floating case expressions inwards
        FloatIn.fiExpr, AnnCase

In both cases the new behaviour is gotten with a static (debug)
flag -faggressive-primops.  The extra "aggression" is to allow
discarding and floating in for side-effecting operations.  See
the new, extensive Note [PrimOp can_fail and has_side_effects]
and Note [Aggressive PrimOps] in PrimoOp.

When discarding a case with unused binders, in the lifted-type
case it's definitely ok if the scrutinee terminates; previously
we were checking exprOkForSpeculation, which is significantly

There's a related change to CoreUtils/CoreArity, but I'll put that
in the next commit.

7 years agoDebug printing only
Simon Peyton Jones [Fri, 27 Apr 2012 15:20:38 +0000 (16:20 +0100)] 
Debug printing only

7 years agoSmall refactoring in kind generalisation of type declarations
Simon Peyton Jones [Fri, 27 Apr 2012 15:19:51 +0000 (16:19 +0100)] 
Small refactoring in kind generalisation of type declarations