7 years agoMerge branch 'master' of
Ian Lynagh [Mon, 19 Dec 2011 17:42:09 +0000 (17:42 +0000)] 
Merge branch 'master' of

7 years agoMerge branch 'master' of
Simon Peyton Jones [Mon, 19 Dec 2011 16:45:53 +0000 (16:45 +0000)] 
Merge branch 'master' of

7 years agoTidy up pretty-printing for variables
Simon Peyton Jones [Mon, 19 Dec 2011 16:45:13 +0000 (16:45 +0000)] 
Tidy up pretty-printing for variables

We already have a class OutputableBndr; this patch adds
methods pprInfixOcc and pprPrefixOcc, so that we can get
rid of the hideous hack (the old) Outputable.pprHsVar.

The hack was exposed by Trac #5657, which is thereby fixed.

7 years agoMake getDynFlags* functions use HasDynFlags/getDynFlags too
Ian Lynagh [Mon, 19 Dec 2011 15:56:25 +0000 (15:56 +0000)] 
Make getDynFlags* functions use HasDynFlags/getDynFlags too

7 years agoAdd a class HasDynFlags(getDynFlags)
Ian Lynagh [Mon, 19 Dec 2011 15:50:47 +0000 (15:50 +0000)] 
Add a class HasDynFlags(getDynFlags)

We no longer have many separate, clashing getDynFlags functions

I've given each GhcMonad its own HasDynFlags instance, rather than
using UndecidableInstances to make a GhcMonad m => HasDynFlags m

7 years agoRemove an old hack for bad FilePath behaviour
Ian Lynagh [Sun, 18 Dec 2011 23:00:14 +0000 (23:00 +0000)] 
Remove an old hack for bad FilePath behaviour

We now require GHC >= 7.0, which has the behaviour we want.

7 years agoFix typo
Ian Lynagh [Sun, 18 Dec 2011 20:55:36 +0000 (20:55 +0000)] 
Fix typo

7 years agoHide STG register declarations for LLVM C compilers
David M Peixotto [Wed, 7 Dec 2011 14:20:47 +0000 (08:20 -0600)] 
Hide STG register declarations for LLVM C compilers

This commit swaps the import order of Rts.h and Stg.h in
StgCRun.c for non-SPARC architectures. Swapping the import
order prevents the declaration of the global registers thus
allowing the GHC runtime to be compiled by LLVM-based C

LLVM-base C compilers cannot use the global register
declarations (for R1, R2, etc.) because they use
GCC-specific extensions. The declarations are not needed in
StgCRun.c except for the SPARC architecture. The other
architectures use hand-written assembly that accesses the
appropriate register directly.

7 years agoFix alignment in the CostCentre struct (#5710)
Simon Marlow [Mon, 19 Dec 2011 11:53:42 +0000 (11:53 +0000)] 
Fix alignment in the CostCentre struct (#5710)

7 years agoMerge branch 'master' of
Ian Lynagh [Sun, 18 Dec 2011 14:15:29 +0000 (14:15 +0000)] 
Merge branch 'master' of

7 years agoFix scalar vectorisation of superclasses and recursive dfuns
Manuel M T Chakravarty [Sun, 18 Dec 2011 06:12:54 +0000 (17:12 +1100)] 
Fix scalar vectorisation of superclasses and recursive dfuns

7 years agoFix a bug in TcCanonical (Dimitrios spotted)
Jose Pedro Magalhaes [Fri, 16 Dec 2011 14:56:39 +0000 (14:56 +0000)] 
Fix a bug in TcCanonical (Dimitrios spotted)

7 years agoBetter failure with promoted kinds in TH
Jose Pedro Magalhaes [Fri, 16 Dec 2011 12:46:16 +0000 (12:46 +0000)] 
Better failure with promoted kinds in TH

Makes #5612 fail in a more civilized way, at least.

7 years agoRemove some dead code
Ian Lynagh [Tue, 13 Dec 2011 22:27:04 +0000 (22:27 +0000)] 
Remove some dead code

7 years agoMerge branch 'master' of
Dimitrios Vytiniotis [Thu, 15 Dec 2011 16:56:53 +0000 (16:56 +0000)] 
Merge branch 'master' of

7 years agoFix a path, and strip out C++ comments too
Simon Marlow [Wed, 14 Dec 2011 13:56:22 +0000 (13:56 +0000)] 
Fix a path, and strip out C++ comments too

7 years agoSupport for reducing the number of Capabilities with setNumCapabilities
Simon Marlow [Tue, 13 Dec 2011 13:09:46 +0000 (13:09 +0000)] 
Support for reducing the number of Capabilities with setNumCapabilities

This patch allows setNumCapabilities to /reduce/ the number of active
capabilities as well as increase it.  This is particularly tricky to
do, because a Capability is a large data structure and ties into the
rest of the system in many ways.  Trying to clean it all up would be
extremely error prone.

So instead, the solution is to mark the extra capabilities as
"disabled".  This has the following consequences:

  - threads on a disabled capability are migrated away by the
    scheduler loop

  - disabled capabilities do not participate in GC
    (see scheduleDoGC())

  - No spark threads are created on this capability
    (see scheduleActivateSpark())

  - We do not attempt to migrate threads *to* a disabled
    capability (see schedulePushWork()).

So a disabled capability should do no work, and does not participate
in GC, although it remains alive in other respects.  For example, a
blocked thread might wake up on a disabled capability, and it will get
quickly migrated to a live capability.  A disabled capability can
still initiate GC if necessary.  Indeed, it turns out to be hard to
migrate bound threads, so we wait until the next GC to do this (see
comments for details).

7 years agoExposing a useful assertion which was hidden inside a lazyness cloud.
Dimitrios Vytiniotis [Thu, 15 Dec 2011 14:18:31 +0000 (14:18 +0000)] 
Exposing a useful assertion which was hidden inside a lazyness cloud.

7 years agoFix a memory allocation bug (rts_argv wasn't big enough)
Simon Marlow [Wed, 14 Dec 2011 10:42:47 +0000 (10:42 +0000)] 
Fix a memory allocation bug (rts_argv wasn't big enough)

7 years agoExport CoreModule(..) (#5698)
Simon Marlow [Wed, 14 Dec 2011 09:34:49 +0000 (09:34 +0000)] 
Export CoreModule(..) (#5698)

7 years agoBe more careful when deciding which functions are scalar
Manuel M T Chakravarty [Wed, 14 Dec 2011 04:37:56 +0000 (15:37 +1100)] 
Be more careful when deciding which functions are scalar

Although scalar functions can use any scalar data type, their arguments and functions may only involve primitive types at the moment.

7 years agoFix -ddump-tc-trace for recursively defined type constructors
Manuel M T Chakravarty [Wed, 14 Dec 2011 02:25:37 +0000 (13:25 +1100)] 
Fix -ddump-tc-trace for recursively defined type constructors

7 years agoRevert "vectoriser: workaround bug in classiftTyCons"
Manuel M T Chakravarty [Tue, 13 Dec 2011 23:52:03 +0000 (10:52 +1100)] 
Revert "vectoriser: workaround bug in classiftTyCons"

This reverts commit acbb3dba4490d53762b5aecfb9a45049dea15c79.

7 years agoFix users_guide markup
Ian Lynagh [Tue, 13 Dec 2011 20:59:37 +0000 (20:59 +0000)] 
Fix users_guide markup

7 years agoHEAD now requires GHC >= 7.0 to bootstrap
Ian Lynagh [Tue, 13 Dec 2011 19:54:08 +0000 (19:54 +0000)] 
HEAD now requires GHC >= 7.0 to bootstrap

7 years ago$(rts_H_FILES) should contain .h files in subdirectories of rts/ too
Simon Marlow [Tue, 13 Dec 2011 13:04:09 +0000 (13:04 +0000)] 
$(rts_H_FILES) should contain .h files in subdirectories of rts/ too

7 years agoFix for a bug in setNumCapabilities
Simon Marlow [Tue, 13 Dec 2011 13:03:44 +0000 (13:03 +0000)] 
Fix for a bug in setNumCapabilities

7 years agoFix for a bug in +RTS -qi (crash in zero_static_object_list)
Simon Marlow [Tue, 13 Dec 2011 13:03:23 +0000 (13:03 +0000)] 
Fix for a bug in +RTS -qi (crash in zero_static_object_list)

7 years agoadd a missing error check
Simon Marlow [Mon, 12 Dec 2011 16:29:03 +0000 (16:29 +0000)] 
add a missing error check

7 years agoAdd a comment about oddity with yieldThread() and timing results on Linux
Simon Marlow [Mon, 12 Dec 2011 16:28:29 +0000 (16:28 +0000)] 
Add a comment about oddity with yieldThread() and timing results on Linux

7 years agoTowards fixing Trac #5664
Simon Peyton Jones [Tue, 13 Dec 2011 13:36:34 +0000 (13:36 +0000)] 
Towards fixing Trac #5664

This patch makes normaliseFFIType recurse ito the arguments of FunPtr

7 years agoSpelling correction in comment
Simon Peyton Jones [Tue, 13 Dec 2011 13:34:58 +0000 (13:34 +0000)] 
Spelling correction in comment

7 years agoDocument typechecking of pattern bindings
Simon Peyton Jones [Tue, 13 Dec 2011 13:31:46 +0000 (13:31 +0000)] 
Document typechecking of pattern bindings

7 years agoDocument the "kind invariant", and check it
Simon Peyton Jones [Tue, 13 Dec 2011 12:30:40 +0000 (12:30 +0000)] 
Document the "kind invariant", and check it

See Note [The kind invariant] in TypeRep
Checked in CoreLint
All this arises from Trac #5426

7 years agoMerge branch 'master' of
Simon Peyton Jones [Tue, 13 Dec 2011 11:33:27 +0000 (11:33 +0000)] 
Merge branch 'master' of

7 years agoAvoid integer overflow when calling allocGroup() (#5071)
Simon Marlow [Mon, 12 Dec 2011 14:18:30 +0000 (14:18 +0000)] 
Avoid integer overflow when calling allocGroup() (#5071)

7 years agoNew flag +RTS -qi<n>, avoid waking up idle Capabilities to do parallel GC
Simon Marlow [Fri, 9 Dec 2011 10:35:46 +0000 (10:35 +0000)] 
New flag +RTS -qi<n>, avoid waking up idle Capabilities to do parallel GC

This is an experimental tweak to the parallel GC that avoids waking up
a Capability to do parallel GC if we know that the capability has been
idle for a (tunable) number of GC cycles.  The idea is that if you're
only using a few Capabilities, there's no point waking up the ones
that aren't busy.

e.g. +RTS -qi3

says "A Capability will participate in parallel GC if it was running
at all since the last 3 GC cycles."

Results are a bit hit and miss, and I don't completely understand why
yet.  Hence, for now it is turned off by default, and also not
documented except in the +RTS -? output.

7 years agowaitForGcThreads: should be calling interruptCapability(), not interruptAllCapabilities()
Simon Marlow [Mon, 12 Dec 2011 13:01:27 +0000 (13:01 +0000)] 
waitForGcThreads: should be calling interruptCapability(), not interruptAllCapabilities()

7 years agosome small optimisations
Simon Marlow [Fri, 9 Dec 2011 10:20:13 +0000 (10:20 +0000)] 
some small optimisations

7 years agoadd some SCCs
Simon Marlow [Fri, 9 Dec 2011 10:19:57 +0000 (10:19 +0000)] 
add some SCCs

7 years agoDo not emit the THREAD_RUNNABLE event; it has no useful semantic content
Simon Marlow [Wed, 7 Dec 2011 11:32:35 +0000 (11:32 +0000)] 
Do not emit the THREAD_RUNNABLE event; it has no useful semantic content

7 years agoCorrect tidying of VectInfo; fixes #5613
Manuel M T Chakravarty [Tue, 13 Dec 2011 04:09:54 +0000 (15:09 +1100)] 
Correct tidying of VectInfo; fixes #5613

7 years agoBump version number to 7.5
Ian Lynagh [Tue, 13 Dec 2011 01:33:51 +0000 (01:33 +0000)] 
Bump version number to 7.5

7 years agoAdd diff command to sync-all
Ian Lynagh [Mon, 12 Dec 2011 21:03:26 +0000 (21:03 +0000)] 
Add diff command to sync-all

8 years agoAdd comments about the meaning of can_fail and has_side_effects
Simon Peyton Jones [Mon, 12 Dec 2011 11:16:49 +0000 (11:16 +0000)] 
Add comments about the meaning of can_fail and has_side_effects

Taken from Trac #5658

8 years agoAdd a mutex around stg_sig_install
Simon Marlow [Mon, 12 Dec 2011 09:29:56 +0000 (09:29 +0000)] 
Add a mutex around stg_sig_install

Protects against a race when two threads call installHandler
simultaneously.  This was causing occasional failure of the test

8 years agoremove duplicate getStablePtr (already done in hs_init())
Simon Marlow [Mon, 12 Dec 2011 09:18:29 +0000 (09:18 +0000)] 
remove duplicate getStablePtr (already done in hs_init())

8 years agochange a contextSwitchCapability() to interruptCapability()
Simon Marlow [Mon, 12 Dec 2011 09:32:54 +0000 (09:32 +0000)] 
change a contextSwitchCapability() to interruptCapability()

8 years agoMake derived functor stuff watch out for type functions (Trac #5686)
Simon Peyton Jones [Mon, 12 Dec 2011 08:12:18 +0000 (08:12 +0000)] 
Make derived functor stuff watch out for type functions (Trac #5686)

The problem was simply that the side-condition check didn't test for a
type function, and then splitAppTy fell over.

8 years agoComments about orphans
Simon Peyton Jones [Mon, 12 Dec 2011 08:10:43 +0000 (08:10 +0000)] 
Comments about orphans

8 years agovectoriser: workaround bug in classiftTyCons
Ben Lippmeier [Mon, 12 Dec 2011 05:51:45 +0000 (16:51 +1100)] 
vectoriser: workaround bug in classiftTyCons

8 years agoAllow type signatures in instance decls (Trac #5676)
Simon Peyton Jones [Mon, 12 Dec 2011 00:32:06 +0000 (00:32 +0000)] 
Allow type signatures in instance decls (Trac #5676)

This new feature-ette, enable with -XInstanceSigs, lets
you give a type signature in an instance declaration:

   instance Eq Int where
     (==) :: Int -> Int -> Bool
     (==) = ...blah...

Scoped type variables work too.

8 years agoFix comment in CgMonad
David Terei [Sun, 11 Dec 2011 20:15:39 +0000 (12:15 -0800)] 
Fix comment in CgMonad

8 years agoRemove unused Interval module.
David Terei [Sun, 11 Dec 2011 20:07:31 +0000 (12:07 -0800)] 
Remove unused Interval module.

Patch from Michal Terepeta <>

8 years agoMerge branch 'master' of
David Terei [Sun, 11 Dec 2011 20:04:19 +0000 (12:04 -0800)] 
Merge branch 'master' of

8 years agoFix a real bug, exposed by my recent change to the rts_evalIO() API. Yay!
Simon Marlow [Fri, 9 Dec 2011 10:28:31 +0000 (10:28 +0000)] 
Fix a real bug, exposed by my recent change to the rts_evalIO() API.  Yay!

8 years agoFix Windows build
Simon Marlow [Fri, 9 Dec 2011 09:53:27 +0000 (09:53 +0000)] 
Fix Windows build

8 years agoMerge remote branch 'phonohawk/patch-5408'
Simon Marlow [Fri, 9 Dec 2011 10:33:45 +0000 (10:33 +0000)] 
Merge remote branch 'phonohawk/patch-5408'

* phonohawk/patch-5408:
  Resurrect UseLibFFIForAdjustors from bitrot.
  Detect cases where as(1) doesn't recognise .ident directive (#5408)

8 years agoFix silly bug in casMutVar#: I forgot the GC write barrier
Simon Marlow [Fri, 9 Dec 2011 09:09:42 +0000 (09:09 +0000)] 
Fix silly bug in casMutVar#: I forgot the GC write barrier

8 years agoMerge branch 'master' of
David Terei [Fri, 9 Dec 2011 00:15:26 +0000 (16:15 -0800)] 
Merge branch 'master' of

8 years agoResurrect UseLibFFIForAdjustors from bitrot.
PHO [Tue, 6 Dec 2011 14:15:35 +0000 (23:15 +0900)] 
Resurrect UseLibFFIForAdjustors from bitrot.

* Pass -Irts/dist/build to the C preprocessor to expose libffi headers (ffi.h and ffitarget.h) to foreign import wrappers during the building process of GHC itself.
* Install libffi headers into $(ghcheaderdir) just like any other C headers. Otherwise an installed GHC can't find them when it wants to compile foreign import wrappers.
* Include libffi headers in the bindist for the same reason.

8 years agoDetect cases where as(1) doesn't recognise .ident directive (#5408)
PHO [Wed, 30 Nov 2011 08:46:27 +0000 (17:46 +0900)] 
Detect cases where as(1) doesn't recognise .ident directive (#5408)

.ident directives are usually ignored by as(1), and in some cases (like Darwin/PPC) they even raise an error.

8 years agoDefine getNumberOfProcessors() even when !THREADED_RTS
Simon Marlow [Wed, 7 Dec 2011 15:46:27 +0000 (15:46 +0000)] 
Define getNumberOfProcessors() even when !THREADED_RTS

8 years agoImprove optimisation in the presence of SCCs (fixes #5363)
Simon Marlow [Wed, 7 Dec 2011 15:23:28 +0000 (15:23 +0000)] 
Improve optimisation in the presence of SCCs (fixes #5363)

We had some special cases to handle things like

  case (scc c (case E of alts)) of alts'

but it only worked when there was a single scc in the way.  This
generalises the optimisation to handle multiple sccs and ticks, so
that we can catch most case-of-case optimisations that would normally
apply in the absence of profiling.

This fixes the example in #5363, and nofib results (with -prof
-fprof-auto) show that allocation universally goes down or stays the

8 years agoTake into account -fprof-auto-*
Simon Marlow [Wed, 7 Dec 2011 15:11:37 +0000 (15:11 +0000)] 
Take into account -fprof-auto-*

8 years agoAdd new primtypes 'ArrayArray#' and 'MutableArrayArray#'
Manuel M T Chakravarty [Wed, 7 Dec 2011 11:40:14 +0000 (22:40 +1100)] 
Add new primtypes 'ArrayArray#' and 'MutableArrayArray#'

The primitive array types, such as 'ByteArray#', have kind #, but are represented by pointers. They are boxed, but unpointed types (i.e., they cannot be 'undefined').

The two categories of array types —[Mutable]Array# and [Mutable]ByteArray#— are containers for unboxed (and unpointed) as well as for boxed and pointed types.  So far, we lacked support for containers for boxed, unpointed types (i.e., containers for the primitive arrays themselves).  This is what the new primtypes provide.

Containers for boxed, unpointed types are crucial for the efficient implementation of scattered nested arrays, which are central to the new DPH backend library dph-lifted-vseg.  Without such containers, we cannot eliminate all unboxing from the inner loops of traversals processing scattered nested arrays.

8 years agoImprove the space usage of checkremove
Ian Lynagh [Wed, 7 Dec 2011 00:57:04 +0000 (00:57 +0000)] 
Improve the space usage of checkremove

Some of the nightly builders have been running out of memory when
running it.

8 years agoTabs -> Spaces + Formatting
David Terei [Tue, 6 Dec 2011 19:39:45 +0000 (11:39 -0800)] 
Tabs -> Spaces + Formatting

8 years agoAllow the number of capabilities to be increased at runtime (#3729)
Simon Marlow [Tue, 6 Dec 2011 15:12:07 +0000 (15:12 +0000)] 
Allow the number of capabilities to be increased at runtime (#3729)

At present the number of capabilities can only be *increased*, not
decreased.  The latter presents a few more challenges!

8 years agoMake forkProcess work with +RTS -N
Simon Marlow [Tue, 6 Dec 2011 11:38:07 +0000 (11:38 +0000)] 
Make forkProcess work with +RTS -N

Consider this experimental for the time being.  There are a lot of
things that could go wrong, but I've verified that at least it works
on the test cases we have.

I also did some API cleanups while I was here.  Previously we had:

Capability * rts_eval (Capability *cap, HaskellObj p, /*out*/HaskellObj *ret);

but this API is particularly error-prone: if you forget to discard the
Capability * you passed in and use the return value instead, then
you're in for subtle bugs with +RTS -N later on.  So I changed all
these functions to this form:

void rts_eval (/* inout */ Capability **cap,
               /* in    */ HaskellObj p,
               /* out */   HaskellObj *ret)

It's much harder to use this version incorrectly, because you have to
pass the Capability in by reference.

8 years agoFix #5658: mark all array indexing primops as can_fail
Ben Lippmeier [Tue, 29 Nov 2011 05:38:33 +0000 (16:38 +1100)] 
Fix #5658: mark all array indexing primops as can_fail

If they're not marked as can_fail, then they are floated out of case expressions that check whether the indices are in-bounds, causing immense suffering.

8 years agoCode generation: Always ask for result of newSpark
Peter Wortmann [Mon, 5 Dec 2011 21:32:19 +0000 (13:32 -0800)] 
Code generation: Always ask for result of newSpark

Otherwise the LLVM backend gets confused over whether its type should be
"void (i8*, i8*)" or "i64 (i8*, i8*)".

Signed-off-by: David Terei <>
8 years agoFix trac # 5486
David Terei [Tue, 6 Dec 2011 06:46:14 +0000 (22:46 -0800)] 
Fix trac # 5486

LLVM has a problem when the user imports some FFI types
like memcpy and memset in a manner that conflicts with
the types that GHC uses internally.

So now we pre-initialise the environment with the most
general types for these functions.

8 years agoMerge branch 'master' of
Simon Peyton Jones [Mon, 5 Dec 2011 04:49:28 +0000 (04:49 +0000)] 
Merge branch 'master' of

8 years agoMerge branch 'master' of ../HEAD
Simon Peyton Jones [Mon, 5 Dec 2011 04:46:15 +0000 (04:46 +0000)] 
Merge branch 'master' of ../HEAD

8 years agoAllow full constraint solving under a for-all (Trac #5595)
Simon Peyton Jones [Mon, 5 Dec 2011 04:44:13 +0000 (04:44 +0000)] 
Allow full constraint solving under a for-all (Trac #5595)

The main idea is that when we unify
    forall a. t1  ~  forall a. t2
we get constraints from unifying t1~t2 that mention a.
We are producing a coercion witnessing the equivalence of
the for-alls, and inside *that* coercion we need bindings
for the solved constraints arising from t1~t2.

We didn't have way to do this before.  The big change is
that here's a new type TcEvidence.TcCoercion, which is
much like Coercion.Coercion except that there's a slot
for TcEvBinds in it.

This has a wave of follow-on changes. Not deep but broad.

* New module TcEvidence, which now contains the HsWrapper
  TcEvBinds, EvTerm etc types that used to be in HsBinds

* The typechecker works exclusively in terms of TcCoercion.

* The desugarer converts TcCoercion to Coercion

* The main payload is in TcUnify.unifySigmaTy. This is the
  function that had a gross hack before, but is now beautiful.

* LCoercion is gone!  Hooray.

Many many fiddly changes in conssequence.  But it's nice.

8 years agoComments only: EqVar vs Covar
Simon Peyton Jones [Mon, 5 Dec 2011 04:01:36 +0000 (04:01 +0000)] 
Comments only: EqVar vs Covar

8 years agoMake TypeMap an instance of Outputable
Simon Peyton Jones [Mon, 5 Dec 2011 04:00:34 +0000 (04:00 +0000)] 
Make TypeMap an instance of Outputable

8 years agoMerge branch 'master' of
Ian Lynagh [Sun, 4 Dec 2011 15:34:59 +0000 (15:34 +0000)] 
Merge branch 'master' of

8 years agoClean includes/GHCConstants.h includes/DerivedConstants.h
Ian Lynagh [Sun, 4 Dec 2011 13:23:46 +0000 (13:23 +0000)] 
Clean includes/GHCConstants.h includes/DerivedConstants.h

We no longer generate them, but they may be in existing GHC trees,
so we'll keep cleaning them for a while.

8 years agoRemove unused import
Simon Peyton Jones [Sun, 4 Dec 2011 12:56:03 +0000 (12:56 +0000)] 
Remove unused import

8 years agoRemove dead function.
David Terei [Fri, 2 Dec 2011 23:52:32 +0000 (15:52 -0800)] 
Remove dead function.

8 years agoRemove old mangler comment
David Terei [Fri, 2 Dec 2011 23:52:22 +0000 (15:52 -0800)] 
Remove old mangler comment

8 years agoAdd SCC for LLVM code output
David Terei [Fri, 2 Dec 2011 23:52:00 +0000 (15:52 -0800)] 
Add SCC for LLVM code output

8 years agoFix ugly complexity issue in LLVM backend (#5652)
David Terei [Fri, 2 Dec 2011 23:48:43 +0000 (15:48 -0800)] 
Fix ugly complexity issue in LLVM backend (#5652)

Compile time still isn't as good as I'd like but no easy changes
available. LLVM backend could do with a big rewrite to improve
performance as there are some ugly designs in it.

At least the test case isn't 10min anymore, just a few seconds now.

8 years agoFormatt wibble
David Terei [Thu, 1 Dec 2011 22:25:43 +0000 (14:25 -0800)] 
Formatt wibble

8 years agoAdd CCS for llvm
David Terei [Thu, 1 Dec 2011 22:20:43 +0000 (14:20 -0800)] 
Add CCS for llvm

8 years agoRemove some unnecessary touch's
Ian Lynagh [Sat, 3 Dec 2011 00:34:30 +0000 (00:34 +0000)] 
Remove some unnecessary touch's

They made a dependency cycle in the rules used to build the touch
program on Windows.

8 years agoMerge branch 'master' of
Ian Lynagh [Fri, 2 Dec 2011 22:30:58 +0000 (22:30 +0000)] 
Merge branch 'master' of

8 years agoRemove unused install_headers and INSTALL_HEADERS
Ian Lynagh [Fri, 2 Dec 2011 22:25:52 +0000 (22:25 +0000)] 
Remove unused install_headers and INSTALL_HEADERS

8 years agoFix header installation
Ian Lynagh [Fri, 2 Dec 2011 22:24:27 +0000 (22:24 +0000)] 
Fix header installation

8 years agoMAKE_RESTARTS should never be higher than 1
Ian Lynagh [Fri, 2 Dec 2011 21:42:59 +0000 (21:42 +0000)] 
MAKE_RESTARTS should never be higher than 1

8 years agoMove includes/DerivedConstants.h and includes/GHCConstants.h into dist dirs
Ian Lynagh [Fri, 2 Dec 2011 21:35:18 +0000 (21:35 +0000)] 
Move includes/DerivedConstants.h and includes/GHCConstants.h into dist dirs

When they existed, they were getting included in the includes_H_FILES
variable (as it uses wildcard to find all header files). But the
.depends files for the programs that generate the headers depend on
$(includes_H_FILES), so the .depends files looked out-of-date once the
headers had been created. This caused unnecessary make reinvocations.

So now we put them in dist* directories, where they ought to be anyway.

8 years agoUse touchy rather than touch when building on Windows
Ian Lynagh [Fri, 2 Dec 2011 16:55:28 +0000 (16:55 +0000)] 
Use touchy rather than touch when building on Windows

With Windows 7 in a vitrual box VM on OS X, some very odd things happen
with dates and time stamps when SSHing into cygwin. e.g. here the
"Change" time is in the past:

$ date; touch foo; stat foo
Fri Dec  2 16:58:07 GMTST 2011
  File: `foo'
  Size: 0               Blocks: 0          IO Block: 65536  regular
empty file
Device: 540aba0bh/1409989131d   Inode: 562949953592977  Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     ian)   Gid: (  513/    None)
Access: 2011-12-02 16:58:07.414457900 +0000
Modify: 2011-12-02 16:58:07.414457900 +0000
Change: 2011-12-02 16:58:03.495141800 +0000
 Birth: 2011-12-02 16:57:57.731469900 +0000

And if we copy such a file, then the copy is older (as determined by the
"Modify" time) than the original:

$ date; touch foo; stat foo; cp foo bar; stat bar
Fri Dec  2 16:59:10 GMTST 2011
  File: `foo'
  Size: 0               Blocks: 0          IO Block: 65536  regular
empty file
Device: 540aba0bh/1409989131d   Inode: 1407374883725128  Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     ian)   Gid: (  513/    None)
Access: 2011-12-02 16:59:10.118457900 +0000
Modify: 2011-12-02 16:59:10.118457900 +0000
Change: 2011-12-02 16:59:06.189477700 +0000
 Birth: 2011-12-02 16:57:57.731469900 +0000
  File: `bar'
  Size: 0               Blocks: 0          IO Block: 65536  regular
empty file
Device: 540aba0bh/1409989131d   Inode: 281474976882512  Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/     ian)   Gid: (  513/    None)
Access: 2011-12-02 16:59:06.394555800 +0000
Modify: 2011-12-02 16:59:06.394555800 +0000
Change: 2011-12-02 16:59:06.395532400 +0000
 Birth: 2011-12-02 16:58:40.921899600 +0000

This means that make thinks that things are out of date when it
shouldn't, so reinvokes itself repeatedly until the MAKE_RESTARTS
infinite-recursion test triggers.

The touchy program, like most other programs, creates files with both
Modify and Change in the past, which is still a little odd, but is
consistent, so doesn't break make.

8 years agoMore changes aimed at improving call stacks.
Simon Marlow [Fri, 2 Dec 2011 13:09:14 +0000 (13:09 +0000)] 
More changes aimed at improving call stacks.

  - Attach a SrcSpan to every CostCentre.  This had the side effect
    that CostCentres that used to be merged because they had the same
    name are now considered distinct; so I had to add a Unique to
    CostCentre to give them distinct object-code symbols.

  - New flag: -fprof-auto-calls.  This flag adds an automatic SCC to
    every call site (application, to be precise).  This is typically
    more useful for call stacks than annotating whole functions.

Various tidy-ups at the same time: removed unused NoCostCentre
constructor, and refactored a bit in Coverage.lhs.

The call stack we get from traceStack now looks like this:

Stack trace:
  Main.CAF (<entire-module>)
  Main.main.xs (callstack002.hs:18:12-24) (callstack002.hs:13:12-16) (callstack002.hs:15:21-34) (callstack002.hs:15:21-23)
  Main.f (callstack002.hs:10:7-43)

8 years agoremove unused coreExprCc
Simon Marlow [Fri, 2 Dec 2011 09:33:14 +0000 (09:33 +0000)] 
remove unused coreExprCc

8 years agoForgot an initMutex(); fixes profthreaded failures on Windows
Simon Marlow [Thu, 1 Dec 2011 11:56:39 +0000 (11:56 +0000)] 
Forgot an initMutex(); fixes profthreaded failures on Windows

8 years agoFix a scheduling bug in the threaded RTS
Simon Marlow [Thu, 1 Dec 2011 10:53:28 +0000 (10:53 +0000)] 
Fix a scheduling bug in the threaded RTS

The parallel GC was using setContextSwitches() to stop all the other
threads, which sets the context_switch flag on every Capability.  That
had the side effect of causing every Capability to also switch
threads, and since GCs can be much more frequent than context
switches, this increased the context switch frequency.  When context
switches are expensive (because the switch is between two bound
threads or a bound and unbound thread), the difference is quite

The fix is to have a separate flag to indicate that a Capability
should stop and return to the scheduler, but not switch threads.  I've
called this the "interrupt" flag.

8 years agoloadArchive: need to allocate executable memory on Win32 (#5371)
Simon Marlow [Wed, 30 Nov 2011 15:34:00 +0000 (15:34 +0000)] 
loadArchive: need to allocate executable memory on Win32 (#5371)

8 years agoFix potential crash on Windows: off-by-one in malloc()
Simon Marlow [Wed, 30 Nov 2011 15:25:57 +0000 (15:25 +0000)] 
Fix potential crash on Windows: off-by-one in malloc()

Spotted by gdb's malloc debugger while I was looking for something else.