13 years agoGHC new build system megapatch
Ian Lynagh [Sun, 26 Apr 2009 11:42:15 +0000 (11:42 +0000)]
GHC new build system megapatch

13 years agoFix SPARC build, missing #include [Sat, 25 Apr 2009 08:33:45 +0000 (08:33 +0000)]
Fix SPARC build, missing #include

13 years agoFix a lint failure when we have a ! (# ... #) pattern in a where clause
Ian Lynagh [Fri, 24 Apr 2009 17:33:13 +0000 (17:33 +0000)]
Fix a lint failure when we have a  ! (# ... #)  pattern in a where clause
This showed up when converting ds057 to follow the new bang pattern rules,
in #2806.

13 years agoDo the second part of #2806: Disallow unlifted types in ~ patterns
Ian Lynagh [Fri, 24 Apr 2009 15:05:19 +0000 (15:05 +0000)]
Do the second part of #2806: Disallow unlifted types in ~ patterns

13 years agoTiny refactor
Ian Lynagh [Fri, 24 Apr 2009 14:02:27 +0000 (14:02 +0000)]
Tiny refactor

13 years agoRequire a bang pattern when unlifted types are where/let bound; #3182
Ian Lynagh [Fri, 24 Apr 2009 12:47:54 +0000 (12:47 +0000)]
Require a bang pattern when unlifted types are where/let bound; #3182
For now we only get a warning, rather than an error, because the alex
and happy templates don't follow the new rules yet.

13 years agoDon't short out top-level indirections if there's a INLINE/NOINLINE pragma [Fri, 24 Apr 2009 12:32:38 +0000 (12:32 +0000)]
Don't short out top-level indirections if there's a INLINE/NOINLINE pragma

The top-level indirection-shorting, done in SimplCore.shortOutIndirections,
was accidentally nuking a NOINLINE pragma.  This patch adopts a slightly
more conservative approach to indirection-shorting, only doing so if
we do not thereby overwrite or lose some user-supplied pragmas.

13 years agoFix #3182: 64 bit FP value returned by C calls was getting trashed [Fri, 24 Apr 2009 06:50:53 +0000 (06:50 +0000)]
Fix #3182: 64 bit FP value returned by C calls was getting trashed
   movss instruction was being used to move the result into the
   destination register instead of movsd

13 years agoadd missing files (part of #3171 fix)
Simon Marlow [Fri, 24 Apr 2009 09:16:10 +0000 (09:16 +0000)]
add missing files (part of #3171 fix)

13 years agoTiny optimisation to mkInlineMe [Fri, 24 Apr 2009 07:47:33 +0000 (07:47 +0000)]
Tiny optimisation to mkInlineMe

Simon Marlow [Thu, 23 Apr 2009 14:19:40 +0000 (14:19 +0000)]
Also some tidyups and renaming

13 years agoadd getOrSetSignalHandlerStore, much like getOrSetTypeableStore
Simon Marlow [Thu, 23 Apr 2009 11:30:02 +0000 (11:30 +0000)]
add getOrSetSignalHandlerStore, much like getOrSetTypeableStore
Part of the fix for #3171

13 years agodon't overwrite io_manager_pipe if it is already set
Simon Marlow [Thu, 23 Apr 2009 11:29:39 +0000 (11:29 +0000)]
don't overwrite io_manager_pipe if it is already set
Part of the fix for #3171

13 years agoSimplify the placeholder binding for naughty record selectors [Thu, 23 Apr 2009 09:44:01 +0000 (09:44 +0000)]
Simplify the placeholder binding for naughty record selectors

13 years agoFix Trac #3176: intercept naughty record selectors [Thu, 23 Apr 2009 09:42:37 +0000 (09:42 +0000)]
Fix Trac #3176: intercept naughty record selectors

When making record selectors into ordinary functions (rather than
magial implicit Ids) I forgot that they could therefore show up in
the *local* TcEnv, not the global one.  This fixes that problem,
and thereby Trac #3176.

13 years agoBetter pretty-printing for IdDetails [Thu, 23 Apr 2009 09:39:45 +0000 (09:39 +0000)]
Better pretty-printing for IdDetails

13 years agoFIX #3166: include the fixity of classes and type synonyms in their fingerprints
Simon Marlow [Tue, 21 Apr 2009 13:56:24 +0000 (13:56 +0000)]
FIX #3166: include the fixity of classes and type synonyms in their fingerprints

13 years agoFIX #2682: banish silly cases of the "module Foo is not loaded" error
Simon Marlow [Tue, 21 Apr 2009 13:10:38 +0000 (13:10 +0000)]
FIX #2682: banish silly cases of the "module Foo is not loaded" error

In GHCi if you say 'import Foo' meaning to load a package module Foo,
and Foo.hs is found on the search path, then GHCi replies "module Foo
is not loaded", because it knows Foo refers to the source file rather
than the package module, and you haven't loaded that module with

This is consistent with the usual module-finding semantics.  However,
it isn't particularly useful.  And it leads to silly problems like not
being able to start GHCi when you happen to be sitting in
libraries/base, because GHCi thinks the Prelude hasn't been loaded.

So now I've made a slight change to the way that 'import M' works: if
M is loaded, then it refers to the loaded module, otherwise it looks
for a package module M.  This does what the reporter of #2682 wanted,
and since it turns an error condition into meaningful behaviour it
can't break anything.

The only undesirable consequence is that 'import M' might refer to a
different M than ':load M'.  Hopefully that won't lead to confusion.

13 years agoFIX #2500: Don't log warnings in getHeader
Simon Marlow [Tue, 21 Apr 2009 10:00:39 +0000 (10:00 +0000)]
FIX #2500: Don't log warnings in getHeader

13 years agoadd a DO NOT EDIT comment
Simon Marlow [Tue, 21 Apr 2009 09:46:06 +0000 (09:46 +0000)]
add a DO NOT EDIT comment

13 years agoFIX #3153: we lost an EOF sentinel in the event of a lexical error
Simon Marlow [Tue, 21 Apr 2009 09:45:58 +0000 (09:45 +0000)]
FIX #3153: we lost an EOF sentinel in the event of a lexical error

13 years agoFIX #2845: Allow breakpoints on expressions with unlifted type
Simon Marlow [Mon, 20 Apr 2009 14:25:25 +0000 (14:25 +0000)]
FIX #2845: Allow breakpoints on expressions with unlifted type

It turns out we can easily support breakpoints on expressions with
unlifted types, by translating

  case tick# of _ -> e


  let f = \s . case tick# of _ -> e
  in  f realWorld#

instead of just a plain let-binding.  This is the same trick that GHC
uses for abstracting join points of unlifted type.

In #2845, GHC has eta-expanded the tick expression, changing the
result type from IO a to (# State#, a #), which was the reason the
tick was suddenly being ignored.  By supporting ticks on unlifted
expressions we can make it work again, although some confusion might
arise because _result will no longer be available (it now has
unboxed-tuple type, so we can't bind it in the environment).  The
underlying problem here is that GHC does transformations like
eta-expanding the tick expressions, and there's nothing we can do to
prevent that.

13 years agoremove now-unused atomic_modify_mutvar_mutex
Simon Marlow [Fri, 3 Apr 2009 13:27:31 +0000 (13:27 +0000)]
remove now-unused atomic_modify_mutvar_mutex

13 years agoSPARC NCG: Add a comment explaining why we can't used a pinned reg for gct [Mon, 20 Apr 2009 07:43:35 +0000 (07:43 +0000)]
SPARC NCG: Add a comment explaining why we can't used a pinned reg for gct
Can't use windowed regs because the window moves during a function
call. Can't use the global regs because they're reserved for other purposes.

13 years agoSPARC NCG: validate fixes [Mon, 20 Apr 2009 03:21:20 +0000 (03:21 +0000)]
SPARC NCG: validate fixes

13 years agoSPARC NCG: Base freeRegs on includes/MachRegs.h again [Mon, 20 Apr 2009 02:07:00 +0000 (02:07 +0000)]
SPARC NCG: Base freeRegs on includes/MachRegs.h again

13 years agoReally fix Trac #2611 this time
pepe iborra [Sun, 19 Apr 2009 14:22:41 +0000 (14:22 +0000)]
Really fix Trac #2611 this time

My previous patch didn't completely solve the problem.
I believe I got it right this time.

13 years agoFix Trac #2611
pepe iborra [Sat, 18 Apr 2009 21:41:15 +0000 (21:41 +0000)]
Fix Trac #2611

Fix a bug in :print affecting data types with unboxed components

13 years agoFix #3170: Allow coalescing of the same node during register allocation. [Sat, 18 Apr 2009 08:22:53 +0000 (08:22 +0000)]
Fix #3170: Allow coalescing of the same node during register allocation.
  The x86 code generator sometimes generates nop moves like
  movl %vI_a %vI_a, but we'll just ignore them for coalescing
  purposes instead of emitting an error. It shouldn't hurt anything.

13 years agoFix my previous patch about type parsing
David Waern [Sat, 18 Apr 2009 08:29:27 +0000 (08:29 +0000)]
Fix my previous patch about type parsing

I forgot to record some additional changes.

13 years agoSimplify the type grammar
David Waern [Fri, 17 Apr 2009 14:58:55 +0000 (14:58 +0000)]
Simplify the type grammar

Simon P-J suggested the following simplifications in #3097:

* Allow nested foralls in `ctype` just like in `ctypedoc`.
* Use `gentype` rather than `type` in the LHS of type declarations.
* Inline `type` in `ctype`.
* Rename `gentype` to `type`.

This patch does this. Also, the equivalent thing is done for documented types.

13 years agoRemoved unused function postEventTypeID. [Mon, 13 Apr 2009 01:17:45 +0000 (01:17 +0000)]
Removed unused function postEventTypeID.
postEventTypeID was used to post event marker IDs, but instead we just
call postWord16 directly; thus, this function is unused.

13 years agoFor consistency, changed access of thread id to be through capability instead of... [Mon, 13 Apr 2009 01:17:01 +0000 (01:17 +0000)]
For consistency, changed access of thread id to be through capability instead of directly from StgRegTable.

13 years agoAdded new EventLog event: Spark to Thread. [Mon, 13 Apr 2009 01:14:44 +0000 (01:14 +0000)]
Added new EventLog event: Spark to Thread.

13 years agoChanged postEvent last argument from "nat from" to "StgWord64 other". [Mon, 13 Apr 2009 01:11:40 +0000 (01:11 +0000)]
Changed postEvent last argument from "nat from" to "StgWord64 other".
StgWord64 other better represents this argument since it can be used as
any particular data, thus "other" and not the "from" capability as it was
previously strictly used.  Also, StgWord64 is normally larger than type
nat to allow for larger data to be passed through the "other" argument.

13 years agoFixed ThreadID to be defined as StgThreadID, not StgWord64. Changed CapabilityNum... [Mon, 13 Apr 2009 01:07:05 +0000 (01:07 +0000)]
Fixed ThreadID to be defined as StgThreadID, not StgWord64.  Changed CapabilityNum to CapNo.  Added helper functions postCapNo() and postThreadID().
ThreadID was StgWord64, but should have been StgThreadID, which is
currently StgWord32.  Changed name from CapabilityNum to CapNo to better
reflect naming in Capability struct where "no" is the capability number.
Modified EventLog.c to use the helper functions postCapNo() and
postThreadID () for CapNo and ThreadID.

13 years agoFixed error in order of EventTypeDescriptions -- seq and par GC come after start... [Fri, 3 Apr 2009 03:43:22 +0000 (03:43 +0000)]
Fixed error in order of EventTypeDescriptions -- seq and par GC come after start and finish GC.
EventTypeDescriptions order must be synchronized with the event type
definitions in includes/EventLogFormat.h for the definitions to correctly
index with the matching description.

13 years agoEventlog support for new event type: create spark. [Fri, 3 Apr 2009 03:30:25 +0000 (03:30 +0000)]
Eventlog support for new event type: create spark.

13 years agoTweak a Show instance
Ian Lynagh [Tue, 7 Apr 2009 14:30:57 +0000 (14:30 +0000)]
Tweak a Show instance

13 years agoFix Trac #3155: better error message when -XRankNTypes is omitted [Thu, 9 Apr 2009 14:40:04 +0000 (14:40 +0000)]
Fix Trac #3155: better error message when -XRankNTypes is omitted

This patch sligtly re-adjusts the way in which the syntax of types
is handled:

 * In the lexer, '.' and '*' are always accepted in types
   (previously it was conditional).  This things can't mean
   anything else in H98, which is the only reason for doing things
   conditionally in the lexer.

 * As a result '.' in types is never treated as an operator.
   Instead, lacking a 'forall' keyword, it turns into a plain parse error.

 * Test for -XKindSignatures in the renamer when processing
     a) type variable bindings
     b) types with sigs (ty :: kind-sig)

 * Make -XKindSignatures be implied by -XTypeFamilies
   Previously this was buried in the conditonal lexing of '*'

13 years agoUse return instead of returnM, and similar tidy-ups [Thu, 9 Apr 2009 14:09:59 +0000 (14:09 +0000)]
Use return instead of returnM, and similar tidy-ups

13 years agoDon't use thread local storage on x86/not-Linux
Ian Lynagh [Sat, 4 Apr 2009 00:34:45 +0000 (00:34 +0000)]
Don't use thread local storage on x86/not-Linux
With the
    On x86, use thread-local storage instead of stealing a reg for gct
patch, on Windows and OS X:
    error: thread-local storage not supported for this target

13 years agoMake some showSDoc's use OneLineMode rather than PageMode
Ian Lynagh [Tue, 31 Mar 2009 18:19:48 +0000 (18:19 +0000)]
Make some showSDoc's use OneLineMode rather than PageMode

13 years agoMake the showSDoc definition more explicit
Ian Lynagh [Tue, 31 Mar 2009 17:41:03 +0000 (17:41 +0000)]
Make the showSDoc definition more explicit

13 years agoeliminate warnings [Fri, 3 Apr 2009 20:34:29 +0000 (20:34 +0000)]
eliminate warnings

13 years agoDebugging by Sesame Street: [Fri, 3 Apr 2009 20:15:04 +0000 (20:15 +0000)]
Debugging by Sesame Street:

One of these things is not like the others:

stdPattern :: [LRep] -> Maybe StgHalfWord
stdPattern reps
  = case reps of
        []  -> Just ARG_NONE    -- just void args, probably
        [N] -> Just ARG_N
        [P] -> Just ARG_N
        [F] -> Just ARG_F
        [D] -> Just ARG_D
        [L] -> Just ARG_L

Today's debugging session was brought to you by the letter P.

13 years agoBuggy optimizations caused function-call return to share the function's entry point [Tue, 31 Mar 2009 14:46:39 +0000 (14:46 +0000)]
Buggy optimizations caused function-call return to share the function's entry point
- Block concat and branch-chain elimination were allowing a function call
  to return to the caller's entry point. But that doesn't leave anywhere
  for the infotable on the stack, since the SP on return must be the same
  as the SP on entry to the procedure.

13 years agoBetter handling of node parameter in calling conventions [Wed, 25 Mar 2009 16:38:15 +0000 (16:38 +0000)]
Better handling of node parameter in calling conventions
 - Previously, the node was taken as a parameter, then ignored,
   for static closures. Goofy. Now, the vestigial node parameters
   are gone.

13 years agoWhen calling gc, avoid saving node in static closures [Mon, 23 Mar 2009 20:47:44 +0000 (20:47 +0000)]
When calling gc, avoid saving node in static closures

13 years agoCode simplifications due to call/return separation; some improvements to how node... [Mon, 23 Mar 2009 20:11:40 +0000 (20:11 +0000)]
Code simplifications due to call/return separation; some improvements to how node argument is managed

13 years agoCode simplification due to separate call/return conventions [Mon, 23 Mar 2009 18:22:14 +0000 (18:22 +0000)]
Code simplification due to separate call/return conventions

13 years agoCalls with and without passing node arguments more clearly separated [Mon, 23 Mar 2009 17:47:00 +0000 (17:47 +0000)]
Calls with and without passing node arguments more clearly separated

13 years agoAnother small step: call and return conventions specified separately when making... [Mon, 23 Mar 2009 17:28:37 +0000 (17:28 +0000)]
Another small step: call and return conventions specified separately when making calls

13 years agoSmall step toward call-conv improvement: separate out calls and returns [Mon, 23 Mar 2009 17:07:06 +0000 (17:07 +0000)]
Small step toward call-conv improvement: separate out calls and returns

13 years agoOn x86, use thread-local storage instead of stealing a reg for gct
Simon Marlow [Fri, 3 Apr 2009 12:18:16 +0000 (12:18 +0000)]
On x86, use thread-local storage instead of stealing a reg for gct
Benchmarks show that using TLS instead of stealing a register is
better by a few percent on x86, due to the lack of registers.

This only affects -threaded; without -threaded we're (now) using
static storage for the GC data.

13 years agoin the non-threaded RTS, use a static gc_thread structure
Simon Marlow [Fri, 3 Apr 2009 12:14:43 +0000 (12:14 +0000)]
in the non-threaded RTS, use a static gc_thread structure

13 years agosmall GC optimisation
Simon Marlow [Fri, 3 Apr 2009 08:37:08 +0000 (08:37 +0000)]
small GC optimisation

13 years agoadd -funroll-loops when compiling the parallel version of Evac.c too
Simon Marlow [Thu, 2 Apr 2009 10:56:43 +0000 (10:56 +0000)]
add -funroll-loops when compiling the parallel version of Evac.c too

Simon Marlow [Thu, 2 Apr 2009 10:55:40 +0000 (10:55 +0000)]
unbreaks ghc-pkg check in an installed GHC

13 years agoAdjust inlining heursitics [Fri, 3 Apr 2009 08:46:34 +0000 (08:46 +0000)]
Adjust inlining heursitics

This patch is the result of a long series of nofib-based experiments
to improve GHC's inlining heuristics.

In the end, I'm not sure how worthwhile it all was: I only got a
   1% decrease in code size
   1% decrease in allocation
and I don't trust the runtime statistics enough to quote.

Still, in doing all this I tidied up the code quite a bit, and
I understand it much better now, so I'm going to commit it.

The main changes are in CoreUnfold, which has lots of new comments.
Other changes:

  - litSize moves from Literal to CoreUnfold
  - interestingArg moves from SimplUtils to CoreUnfold
  - the default unfolding threshold (in StaticFlags)
      reduces from 8 to 6 (since the size calculation
      has changed a bit)

13 years agoWorker/wrapper should make INLINE if it doesn't w/w [Fri, 3 Apr 2009 08:43:33 +0000 (08:43 +0000)]
Worker/wrapper should make INLINE if it doesn't w/w

If worker/wrapper decides not to w/w something on the grounds that
it's too small, it should add an INLINE pragma.  Otherwise, later
in the day that small thing might now be big, and we'd wish we'd
done the w/w after all.  This only made a difference in one nofib
program (bspt), but it's an easy change.

See Note [Don't w/w inline things (a) and (b)]

13 years agoRewrite a good chunk of CoreArity [Fri, 3 Apr 2009 08:36:55 +0000 (08:36 +0000)]
Rewrite a good chunk of CoreArity

I found a couple of shortcomings in arity computation, and did
quite a bit of refactoring as a result.  Regrettably, I have
forgotten the details, but I do remember that one part was to
do with the infamous "state hack".  If we're going to use the
state-hack at all, we'd better do it right.

Anyway I think this is an improvement. The comments are more
up to date too, and more voluminous.

13 years agoComments only; record remarks about removing 'type' nonterminal [Thu, 2 Apr 2009 16:52:26 +0000 (16:52 +0000)]
Comments only; record remarks about removing 'type' nonterminal

13 years agoDon't float case expressions in full laziness [Thu, 2 Apr 2009 16:51:01 +0000 (16:51 +0000)]
Don't float case expressions in full laziness

See Note [Case MFEs]; don't float case expressions from
a strict context.

13 years agoFix Trac #3118: missing alternative [Thu, 2 Apr 2009 15:28:34 +0000 (15:28 +0000)]
Fix Trac #3118: missing alternative

This patch fixes a rather obscure bug, whereby it's possible
for (case C a b of <alts>) to have altenatives that do not inclue
(C a b)!  See Note [Unreachable code] in CoreUtils.

13 years agoUse a local interestingDict function instead of importing SimplUtils.interestingArg [Thu, 2 Apr 2009 15:22:46 +0000 (15:22 +0000)]
Use a local interestingDict function instead of importing SimplUtils.interestingArg

I'm changing the details of SimplUtils.interstingArg, and don't want to
mess  up the way Specialise works, so this patch makes a specilialised
(ha) function, Specialise.interestingDict, that is used locally.

13 years agoBetter panic reporting [Thu, 2 Apr 2009 15:18:46 +0000 (15:18 +0000)]
Better panic reporting

Make idDetails and idInfo into proper functions, rather than record
fields, so that we can report more informatively if you use thenm on
a non-Id.

13 years agoFix pragmas in binder-swapping [Thu, 2 Apr 2009 15:16:16 +0000 (15:16 +0000)]
Fix pragmas in binder-swapping

In the case binder-swap operation (which is done in OccurAnal),
we deliberately use shadowing. But the new shadowing binder should
not inherit any fancy INLINE or NOINLINE pragmas from its parent.

13 years agoFloat constants to top-level even in first full laziness pass [Thu, 2 Apr 2009 15:14:06 +0000 (15:14 +0000)]
Float constants to top-level even in first full laziness pass

This patch changes the compilation pipeline flags so that constants
are floated to the top level even in the first full laziness pass.
For some reason this was not done before.  Fixing this makes a big
improvement in 'spectral/rewrite', and has zero effect on any other
nofib benchmark.

13 years agoupdate the intro section
Simon Marlow [Wed, 1 Apr 2009 10:52:56 +0000 (10:52 +0000)]
update the intro section

13 years agoRemove the "Installing GHC" section
Simon Marlow [Wed, 1 Apr 2009 10:34:18 +0000 (10:34 +0000)]
Remove the "Installing GHC" section

 1. it was out of date in various ways
 2. this is not the place people look for installation instructions
 3. we have installation instructions elsewhere (e.g. the INSTALL
    file in a binary distribution)
 4. the section "layout of installed files" is now on the wiki under

13 years agoSPARC: Fix ffi019 split load/store of HsInt64 into two parts to respect alignment... [Tue, 31 Mar 2009 04:51:45 +0000 (04:51 +0000)]
SPARC: Fix ffi019 split load/store of HsInt64 into two parts to respect alignment constraints

13 years agoSPARC NCG: Fix 64 bit addition, carry bit wasn't getting set. [Mon, 30 Mar 2009 05:17:32 +0000 (05:17 +0000)]
SPARC NCG: Fix 64 bit addition, carry bit wasn't getting set.

13 years agoSPARC NCG: When getting a 64 bit word, promote halves to 64 bit before shifting [Mon, 30 Mar 2009 05:03:46 +0000 (05:03 +0000)]
SPARC NCG: When getting a 64 bit word, promote halves to 64 bit before shifting

13 years agoSPARC NCG: HpLim is now always stored on the stack, not in a register [Tue, 31 Mar 2009 05:19:00 +0000 (05:19 +0000)]
SPARC NCG: HpLim is now always stored on the stack, not in a register
   This fixes the out of memory errors we were getting on sparc
   after the following patch:

     Fri Mar 13 03:45:16 PDT 2009  Simon Marlow <>
     * Instead of a separate context-switch flag, set HpLim to zero
     Ignore-this: 6c5bbe1ce2c5ef551efe98f288483b0
     This reduces the latency between a context-switch being triggered and
     the thread returning to the scheduler, which in turn should reduce the
     cost of the GC barrier when there are many cores.

13 years agoAllow Haddock comments in type synonyms
David Waern [Tue, 31 Mar 2009 21:23:06 +0000 (21:23 +0000)]
Allow Haddock comments in type synonyms

We now use `ctypedoc` instead of `ctype` for type synonyms. `ctypedoc` was
previously only used for top-level type signatures. This change means that type
synonyms now can contain comments, just like top-level type signatures.


* I've modified `ctypedoc` so it allows implicit parameters and equational
constraints, just like ctype.

* Since `ctypedoc` allows nested foralls, we now allow that in type synonyms.

* I have inlined some productions into gentypedoc so that there is now a
non-doc version of every production with a 'doc' suffix. (Stylistic change
only, which should make the code easier to follow).

* It would have been nice to simplify the grammar by unifying `ctype` and
ctypedoc` into one production, allowing comments on types everywhere (and
rejecting them after parsing, where necessary).  This is however not possible
since it leads to ambiguity. The reason is the support for comments on record

> data R = R { field :: Int -- ^ comment on the field }

If we allow comments on types here, it's not clear if the comment applies
to 'field' or to 'Int'. So we must use `ctype` to describe the type.

13 years agomkErrorAppDs now takes an SDoc rather than a String
Ian Lynagh [Tue, 31 Mar 2009 13:40:58 +0000 (13:40 +0000)]
mkErrorAppDs now takes an SDoc rather than a String
This avoids some showSDoc's where the String then gets converted back
into an SDoc.

13 years agoFIX #1779 and qq005: export hs_hpc_module
Simon Marlow [Mon, 30 Mar 2009 08:44:14 +0000 (08:44 +0000)]
FIX #1779 and qq005: export hs_hpc_module

13 years agogo back to using $CPUS + 1 for the number of threads to use
Simon Marlow [Mon, 30 Mar 2009 08:30:32 +0000 (08:30 +0000)]
go back to using $CPUS + 1 for the number of threads to use

13 years agouse a UniqSet for is MathFun, this list is getting quite large
Simon Marlow [Mon, 30 Mar 2009 08:29:57 +0000 (08:29 +0000)]
use a UniqSet for is MathFun, this list is getting quite large

13 years agoFix an nasty black hole, concerning computation of isRecursiveTyCon [Mon, 30 Mar 2009 08:49:12 +0000 (08:49 +0000)]
Fix an nasty black hole, concerning computation of isRecursiveTyCon

Fixing #246 (pattern-match order in record patterns) made GHC go into
a black hole, by changing the order of patterm matching in
TyCon.isProductTyCon!  It turned out that GHC had been avoiding the
black hole only by the narrowest of margins up to now!

The black hole concerned the computation of which type constructors
are recursive, in TcTyDecls.calcRecFlags.  We now refrain from using
isProductTyCon there, since it triggers the black hole (very
indirectly).  See the "YUK YUK" comment in the body of calcRecFlags.

As it turns out, the fact that TyCon.isProductTyCon matched on the
algTcRec field was quite redundant, so I removed that too.  However,
without the fix to calcRecFlags, this wouldn't fix the black hole
because of the use of isRecursiveTyCon in BuildTyCl.mkNewTyConRhs.

Anyway, it's fine now.

13 years agoAdd an extra print to -ddump-tc-trace [Mon, 30 Mar 2009 08:48:35 +0000 (08:48 +0000)]
Add an extra print to -ddump-tc-trace

13 years agoRemove dead code (dataConsStupidTheta) [Mon, 30 Mar 2009 08:47:39 +0000 (08:47 +0000)]
Remove dead code (dataConsStupidTheta)

13 years agoFix Trac #246: order of matching in record patterns [Mon, 30 Mar 2009 08:37:36 +0000 (08:37 +0000)]
Fix Trac #246: order of matching in record patterns

While I was looking at the desugaring of pattern matching (fixing
Trac #3126) I finally got around to fixing another long-standing bug:
when matching in a record pattern, GHC should match left-to-right in
the programmer-specfied order, *not* left-to-right positionally in
the original record declaration.

Needless to say, that requires a little more code.
See Note [Record patterns] in MatchCon.lhs

13 years agoFix Trac #3126: matching overloaded literals [Mon, 30 Mar 2009 08:34:35 +0000 (08:34 +0000)]
Fix Trac #3126: matching overloaded literals

Claus Reinke uncovered a long-standing bug in GHC, whereby we were
combining the pattern-match on overloaded literals, missing the fact
that an intervening pattern (for a different literal) might also
match.  (If someone had a very odd implementation of fromInteger!)

See Note [Grouping overloaded literal patterns] in Match.lhs

If this merges smoothly to 6.10, go for it, but it's very much
a corner case.

Thank you Claus!

13 years agoWhite space cosmetics only [Mon, 30 Mar 2009 08:31:03 +0000 (08:31 +0000)]
White space cosmetics only

13 years agoImprove mkDupableCont; and fix Trac #3116 [Wed, 25 Mar 2009 09:52:05 +0000 (09:52 +0000)]
Improve mkDupableCont; and fix Trac #3116

It turns out that, as a result of a change I made a few months ago to
the representation of SimplCont, it's easy to solve the optimisation
challenge posed by Trac #3116.  Hurrah.

Extensive comments in Note [Duplicating StrictArg].

13 years agoAvoid quadratic complexity in occurrence analysis (fix Trac #1969) [Mon, 23 Mar 2009 10:38:26 +0000 (10:38 +0000)]
Avoid quadratic complexity in occurrence analysis (fix Trac #1969)

  The occurrence analyser could go out to lunch in bad cases, because
  of its clever loop-breaking algorithm. This patch makes it bale out
  in bad cases.  Somewhat ad-hoc: a nicer solution would be welcome.

  See Note [Complexity of loop breaking] for the details.

13 years agoImprove arity propagation in the specialiser [Mon, 23 Mar 2009 10:16:14 +0000 (10:16 +0000)]
Improve arity propagation in the specialiser

This patch makes the specialiser propagate arities a bit more
eagerly, which avoids a spurious warning in the simplifier.

See Note [Arity decrease] in Simplify.lhs

13 years agocheck for ThreadRelocated in checkBlackHoles()
Simon Marlow [Thu, 26 Mar 2009 14:03:43 +0000 (14:03 +0000)]
check for ThreadRelocated in checkBlackHoles()

13 years agosyb no longer needs to be wired in
Ian Lynagh [Thu, 26 Mar 2009 13:05:17 +0000 (13:05 +0000)]
syb no longer needs to be wired in

13 years agoTemplate Haskell: added bang patterns
Manuel M T Chakravarty [Thu, 26 Mar 2009 10:02:08 +0000 (10:02 +0000)]
Template Haskell: added bang patterns

13 years agoTemplate Haskell: support for kind annotations
Manuel M T Chakravarty [Thu, 26 Mar 2009 08:55:20 +0000 (08:55 +0000)]
Template Haskell: support for kind annotations

13 years agoupdate list of C math functions
Bertram Felgenhauer [Mon, 23 Mar 2009 18:36:30 +0000 (18:36 +0000)]
update list of C math functions
Fix via C compilation of modules that import, say, log1p from math.h (#3117)

The list is based on preprocessing Stg.h with glibc 2.6.1 headers, and
cross-checked with the ISO C 99 standard (draft).

13 years agoTemplate Haskell: make reify aware of type families
Manuel M T Chakravarty [Wed, 25 Mar 2009 03:34:47 +0000 (03:34 +0000)]
Template Haskell: make reify aware of type families
- Reifying a type family returns a TH family declaration
- Reifying a data constructor from a data instance attributes that
  constructor to the family (not the representation tycon)
- Ideally, we should have facilities to reify all type/data instances of a
  given family (and the same for instances of a class).  I haven't added that
  here as it involves some API design.

13 years agoTemplate Haskell: support for INLINE and SPECIALISE pragmas
Manuel M T Chakravarty [Tue, 24 Mar 2009 23:29:40 +0000 (23:29 +0000)]
Template Haskell: support for INLINE and SPECIALISE pragmas

13 years agofix an fprintf that should be fputs (quiets gcc)
Simon Marlow [Sun, 22 Mar 2009 19:54:41 +0000 (19:54 +0000)]
fix an fprintf that should be fputs (quiets gcc)

13 years agocheck return value of write (quiets gcc)
Simon Marlow [Sun, 22 Mar 2009 19:53:19 +0000 (19:53 +0000)]
check return value of write (quiets gcc)

13 years agoFix locking in evacuate_large() (FIX openfile008(threaded2))
Simon Marlow [Mon, 23 Mar 2009 09:29:53 +0000 (09:29 +0000)]
Fix locking in evacuate_large() (FIX openfile008(threaded2))

13 years agoPlease the -Wall police by moving a variable declaration; really FIX getNumberOfProce...
Austin Seipp [Fri, 20 Mar 2009 12:48:46 +0000 (12:48 +0000)]
Please the -Wall police by moving a variable declaration; really FIX getNumberOfProcessors() for MacOS X