ghc-hetmet.git
12 years agoFix building with GHC 6.8
Ian Lynagh [Fri, 6 Feb 2009 14:34:32 +0000 (14:34 +0000)]
Fix building with GHC 6.8

12 years agoFix the build on amd64/Linux
Ian Lynagh [Fri, 6 Feb 2009 14:34:20 +0000 (14:34 +0000)]
Fix the build on amd64/Linux

12 years agoWhen generating C, don't pretend functions are data
Ian Lynagh [Fri, 6 Feb 2009 14:02:49 +0000 (14:02 +0000)]
When generating C, don't pretend functions are data
We used to generated things like:
    extern StgWordArray (newCAF) __attribute__((aligned (8)));
    ((void (*)(void *))(W_)&newCAF)((void *)R1.w);
(which is to say, pretend that newCAF is some data, then cast it to a
function and call it).
This goes wrong on at least IA64, where:
    A function pointer on the ia64 does not point to the first byte of
    code. Intsead, it points to a structure that describes the function.
    The first quadword in the structure is the address of the first byte
    of code
so we end up dereferencing function pointers one time too many, and
segfaulting.

12 years agoNCG: Validate fixes
Ben.Lippmeier@anu.edu.au [Thu, 5 Feb 2009 08:06:24 +0000 (08:06 +0000)]
NCG: Validate fixes

12 years agoNCG: Split RegAllocInfo into arch specific modules
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 05:51:26 +0000 (05:51 +0000)]
NCG: Split RegAllocInfo into arch specific modules

12 years agoNCG: Move RegLiveness -> RegAlloc.Liveness
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 03:52:50 +0000 (03:52 +0000)]
NCG: Move RegLiveness -> RegAlloc.Liveness

12 years agoNCG: Rename MachRegs, MachInstrs -> Regs, Instrs to reflect arch specific naming
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 03:41:07 +0000 (03:41 +0000)]
NCG: Rename MachRegs, MachInstrs -> Regs, Instrs to reflect arch specific naming

12 years agoNCG: Split MachRegs.hs into arch specific modules
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 03:07:29 +0000 (03:07 +0000)]
NCG: Split MachRegs.hs into arch specific modules

12 years agoNCG: Fix validate
Ben.Lippmeier@anu.edu.au [Thu, 5 Feb 2009 03:06:42 +0000 (03:06 +0000)]
NCG: Fix validate

12 years agoSPARC NCG: Fix some haddock problems.
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 04:38:02 +0000 (04:38 +0000)]
SPARC NCG: Fix some haddock problems.

12 years agoSPARC NCG: Add Pwr callish mach op
Ben.Lippmeier@anu.edu.au [Wed, 4 Feb 2009 00:09:05 +0000 (00:09 +0000)]
SPARC NCG: Add Pwr callish mach op

12 years agoNCG: Split MachInstrs into arch specific modules
Ben.Lippmeier@anu.edu.au [Tue, 3 Feb 2009 08:13:27 +0000 (08:13 +0000)]
NCG: Split MachInstrs into arch specific modules

12 years agoNCG: Move the graph allocator into its own dir
Ben.Lippmeier@anu.edu.au [Tue, 3 Feb 2009 07:14:11 +0000 (07:14 +0000)]
NCG: Move the graph allocator into its own dir

12 years agoSPARC NCG: Update cabal file
Ben.Lippmeier@anu.edu.au [Tue, 3 Feb 2009 06:27:46 +0000 (06:27 +0000)]
SPARC NCG: Update cabal file

12 years agoSPARC NCG: Give regs o0-o5 back to the allocator
Ben.Lippmeier@anu.edu.au [Tue, 3 Feb 2009 06:24:33 +0000 (06:24 +0000)]
SPARC NCG: Give regs o0-o5 back to the allocator

12 years agoNCG: Split out joinToTargets from linear alloctor into its own module.
Ben.Lippmeier@anu.edu.au [Tue, 3 Feb 2009 04:05:40 +0000 (04:05 +0000)]
NCG: Split out joinToTargets from linear alloctor into its own module.

 * Also fix a nasty bug when creating fixup code that has a cyclic
   register movement graph.

12 years agoNCG: Split linear allocator into separate modules.
Ben.Lippmeier@anu.edu.au [Mon, 2 Feb 2009 05:53:01 +0000 (05:53 +0000)]
NCG: Split linear allocator into separate modules.

13 years agoSPARC NCG: Keep track of destinations when doing a tabled jump
Ben.Lippmeier@anu.edu.au [Fri, 23 Jan 2009 05:22:47 +0000 (05:22 +0000)]
SPARC NCG: Keep track of destinations when doing a tabled jump

13 years agoSPARC NCG: Do general 64 bit addition and conversion
Ben.Lippmeier@anu.edu.au [Fri, 23 Jan 2009 03:51:52 +0000 (03:51 +0000)]
SPARC NCG: Do general 64 bit addition and conversion

13 years agoSPARC NCG: Don't need a write barrier for store synchronisation on SPARC under TSO.
Ben.Lippmeier@anu.edu.au [Fri, 23 Jan 2009 00:50:51 +0000 (00:50 +0000)]
SPARC NCG: Don't need a write barrier for store synchronisation on SPARC under TSO.

13 years agoSPARC NCG: Use .skip instead of .space in assembler
Ben.Lippmeier@anu.edu.au [Thu, 22 Jan 2009 22:51:50 +0000 (22:51 +0000)]
SPARC NCG: Use .skip instead of .space in assembler

 - In the GNU assembler they mean the same thing
 - The Solaris assembler only has .skip

12 years agoCheck -XGADTs in (a) type family decls (b) pattern matches
simonpj@microsoft.com [Wed, 4 Feb 2009 15:09:19 +0000 (15:09 +0000)]
Check -XGADTs in (a) type family decls (b) pattern matches

Following Trac #2905, we now require -XGADTs for *pattern matches* on
GADTs, not just on *definitions*.

Also I found that -XGADTs wasn't being checked when declaring type families,
so I fixed that too.

12 years agoImprove error reports for kind checking (Trac #2994)
simonpj@microsoft.com [Wed, 4 Feb 2009 15:07:36 +0000 (15:07 +0000)]
Improve error reports for kind checking (Trac #2994)

I followed the suggestion in Trac #2994, which took longer than I
expected.  As usual I did a bit of tidying up at the same time,
and improved a few other error reports.

12 years agoFurther wibbles to 'deriving' for functor-like things
simonpj@microsoft.com [Wed, 4 Feb 2009 15:06:25 +0000 (15:06 +0000)]
Further wibbles to 'deriving' for functor-like things

12 years agoleave out rts/ from include-dirs in the inplace rts package
Simon Marlow [Wed, 4 Feb 2009 10:47:48 +0000 (10:47 +0000)]
leave out rts/ from include-dirs in the inplace rts package
it shouldn't be there, and might hide bugs

12 years agoFix Trac #2999: change an ASSERT to a WARN
simonpj@microsoft.com [Wed, 4 Feb 2009 08:38:00 +0000 (08:38 +0000)]
Fix Trac #2999: change an ASSERT to a WARN

A bug in the constraint simplifier means that an equality can be solved
twice.  It's harmless, and will go away with the new constraint simplifier.
Hence warning, to avoid unnecessary outright failure on eg Trac #2999.

12 years agoImprove transferPolyIdInfo for value-arg abstraction
simonpj@microsoft.com [Wed, 4 Feb 2009 08:25:34 +0000 (08:25 +0000)]
Improve transferPolyIdInfo for value-arg abstraction

If we float a binding out of a *value* lambda, the fixing-up of IdInfo
is a bit more complicated than before.  Since in principle FloatOut
can do this (and thus can do full lambda lifting), it's imporrtant
that transferPolyIdInfo does the Right Thing.

This doensn't matter unless you use FloatOut's abilty to lambda-lift,
which GHC mostly doesn't, yet.  But Max used it and tripped over this bug.

12 years agoTwo small improvements to LiberateCase
simonpj@microsoft.com [Wed, 4 Feb 2009 08:19:19 +0000 (08:19 +0000)]
Two small improvements to LiberateCase

Max Bolingbroke suggested these two small improvements to LiberateCase
(most of the size increase is comments :-)):

a) Do LiberateCase on small functions even if they are mutually recursive
   See Note [Small enough]

b) Don't do LiberateCase on functions for which it'd be fruitless,
   namely when a free varible is scrutinised *outside* the function
   See Note [Avoiding fruitless liberate-case]

There is virtually no effect on nofib, but Max tripped over cases
where it mattered slightly.

13 years agoRobustify lookupFamInstEnv, plus some refactoring
simonpj@microsoft.com [Thu, 15 Jan 2009 13:48:18 +0000 (13:48 +0000)]
Robustify lookupFamInstEnv, plus some refactoring

This patch deals with the following remark

     Suppose we have
            type family T a :: * -> *
            type instance T Int = []

     and now we encounter the type (T Int Bool).  If we call
     lookupFamInstEnv on (T Int Bool) we'll fail, because T has arity 1.
     Indeed, I *think* it's a precondition of lookupFamInstEnv that the
     supplied types exactly match the arity of the type function.  But
     that precondition is neither stated, nor is there an assertion to
     check it.

With this patch, lookupFamInstEnv can take "extra" type arguments in
the over-saturated case, and does the Right Thing.

There was a nearly-identical function lookupFamInstEnvUnify, which
required the precisely analogous change, so I took the opportunity
to combine the two into one function, so that bugs can be fixed in one
place.  This was a bit harder than I expected, but I think the result
is ok.  The conflict-decision function moves from FamInst to FamInstEnv.
Net lines code decreases, although there are more comments.

13 years agoRobustify lookupFamInstEnv
simonpj@microsoft.com [Wed, 14 Jan 2009 14:01:17 +0000 (14:01 +0000)]
Robustify lookupFamInstEnv

Suppose we have
        type family T a :: * -> *
        type instance T Int = []

and now we encounter the type (T Int Bool).  That is perfectly
fine, even though T is over-saturated here.

This patch makes lookupFamInstEnv robust to such over-saturation.
Previously one caller (TcTyFuns.tcUnfoldSynFamInst) dealt with
the over-saturation case, but the others did not. It's better
to desl with the issue at the root, in lookupFamInstEnv itself.

13 years agoImprove trace message
simonpj@microsoft.com [Tue, 13 Jan 2009 17:58:06 +0000 (17:58 +0000)]
Improve trace message

12 years agoBuild dph with the stage2 compiler
Ian Lynagh [Tue, 3 Feb 2009 21:36:13 +0000 (21:36 +0000)]
Build dph with the stage2 compiler
It will use TH, so needs to be built with stage2.

12 years agoOptimise writing out the .s file
Simon Marlow [Mon, 2 Feb 2009 14:50:13 +0000 (14:50 +0000)]
Optimise writing out the .s file
I noticed while working on the new IO library that GHC was writing out
the .s file in lots of little chunks.  It turns out that this is a
result of using multiple printDocs to avoid space leaks in the NCG,
where each printDoc is finishing up with an hFlush.

What's worse, is that this makes poor use of the optimisation inside
printDoc that uses its own buffering to avoid hitting the Handle all
the time.

So I hacked around this by making the buffering optimisation inside
Pretty visible from the outside, for use in the NCG.  The changes are
quite small.

13 years agobetter error message for missing package-qualified modules in ghc -M
Simon Marlow [Fri, 23 Jan 2009 14:20:01 +0000 (14:20 +0000)]
better error message for missing package-qualified modules in ghc -M

13 years agoadd wiki commentary links
Simon Marlow [Fri, 30 Jan 2009 11:08:44 +0000 (11:08 +0000)]
add wiki commentary links

13 years agoForce the result of user-defined commands
Simon Marlow [Fri, 30 Jan 2009 09:19:19 +0000 (09:19 +0000)]
Force the result of user-defined commands
so that exceptions are reported with "*** Exception" instead of as a panic.

12 years agoImprove error reporting for precedence errors
simonpj@microsoft.com [Mon, 2 Feb 2009 16:44:50 +0000 (16:44 +0000)]
Improve error reporting for precedence errors

Adopt the suggestion of Trac #2993, and tidy up the reporting of
precedence parsing errors somewhat.

12 years agoAdd the ability to derive instances of Functor, Foldable, Traversable
simonpj@microsoft.com [Mon, 2 Feb 2009 13:48:29 +0000 (13:48 +0000)]
Add the ability to derive instances of Functor, Foldable, Traversable

This patch is a straightforward extension of the 'deriving' mechanism.
The ability to derive classes Functor, Foldable, Traverable is controlled
by a single flag  -XDeriveFunctor.  (Maybe that's a poor name.)

Still to come: documentation

Thanks to twanvl for developing the patch

13 years agoComments about injecting implicit bindings
simonpj@microsoft.com [Fri, 30 Jan 2009 17:54:03 +0000 (17:54 +0000)]
Comments about injecting implicit bindings

12 years agoWarn in configure if it looks like make 3.80 is about to be used
Ian Lynagh [Sun, 1 Feb 2009 20:35:05 +0000 (20:35 +0000)]
Warn in configure if it looks like make 3.80 is about to be used
We get caught by
    http://savannah.gnu.org/bugs/index.php?1516
    $(eval ...) inside conditionals causes errors
with make 3.80, so warn the user if it looks like they're about to
try to use it.

13 years agoFix Trac #2985: generating superclasses and recursive dictionaries
simonpj@microsoft.com [Fri, 30 Jan 2009 15:27:38 +0000 (15:27 +0000)]
Fix Trac #2985: generating superclasses and recursive dictionaries

The Note [Recursive instances and superclases] explains the subtle
issues to do with generating the bindings for superclasses when
we compile an instance declaration, at least if we want to do the
clever "recursive superclass" idea from the SYB3 paper.

The old implementation of tcSimplifySuperClasses stumbled when
type equalities entered the picture (details in the Note); this
patch fixes the problem using a slightly hacky trick.  When we
re-engineer the constraint solver we'll want to keep an eye on
this.

Probably worth merging to the 6.10 branch.

13 years agoWhite space only
simonpj@microsoft.com [Fri, 30 Jan 2009 15:27:05 +0000 (15:27 +0000)]
White space only

13 years agoTwo more wibbles to CorePrep (fixes HTTP package and DPH)
simonpj@microsoft.com [Thu, 29 Jan 2009 13:19:54 +0000 (13:19 +0000)]
Two more wibbles to CorePrep (fixes HTTP package and DPH)

Ensuring that
  a) lambdas show up only on the RHSs of binding after CorePrep
  b) the arity of a binding exactly matches the maifest lambdas
is surprisingly tricky.

I got it wrong (again) in my recent CorePrep shuffling, which broke
packages HTTP and DPH.  This patch fixes both.

13 years agoRemove the doc/ contents from the GMP tarball
Ian Lynagh [Wed, 28 Jan 2009 20:07:49 +0000 (20:07 +0000)]
Remove the doc/ contents from the GMP tarball
They are GFDLed, which causes problems for Debian

13 years ago#2973: we should virtualise the CWD inside the GHC API, not in the client
Simon Marlow [Tue, 27 Jan 2009 12:16:48 +0000 (12:16 +0000)]
#2973: we should virtualise the CWD inside the GHC API, not in the client
The problem is that we install the client's CWD before calling
runStmt, but runStmt has to load modules before running the code.  We
need to install the CWD just before running the code instead, which
means it has to be done inside runStmt (and resume).

13 years agoFix detection of i386 vs. x86_64 for -pc-solaris
Simon Marlow [Tue, 27 Jan 2009 09:53:43 +0000 (09:53 +0000)]
Fix detection of i386 vs. x86_64 for -pc-solaris
From #2951

13 years agoImplement #2191 (traceCcs# -- prints CCS of a value when available -- take 3)
Samuel Bronson [Tue, 27 Jan 2009 08:48:25 +0000 (08:48 +0000)]
Implement #2191 (traceCcs# -- prints CCS of a value when available -- take 3)
In this version, I untag R1 before using it, and even enter R2 at the
end rather than simply returning it (which didn't work right when R2
was a thunk).

13 years agoadd comment for ASSERT_LOCK_HELD()
Simon Marlow [Mon, 26 Jan 2009 14:00:30 +0000 (14:00 +0000)]
add comment for ASSERT_LOCK_HELD()

13 years agoFix #2961: we lost some of the generated code for stack args in genCCall
Simon Marlow [Mon, 26 Jan 2009 15:02:09 +0000 (15:02 +0000)]
Fix #2961: we lost some of the generated code for stack args in genCCall
A real bug in the x86_64 native code gen: nice!

This bug would have been caught by -Wall, and I would have gone though
and Walled this file but I know Ben is hacking on this file quite
heavily and I don't want to create undue conflicts.  Ben: it would be
nice to enable -Wall here when you have time.

13 years agoMake the libffi patch files portable
Ian Lynagh [Fri, 23 Jan 2009 18:00:15 +0000 (18:00 +0000)]
Make the libffi patch files portable
Solaris's patch can't apply them if the lines beginning "---" aren't
preceeded by a "diff -ur foo bar" line.

13 years agoSPARC NCG: Also do misaligned reads (this time for sure!)
Ben.Lippmeier@anu.edu.au [Thu, 22 Jan 2009 09:21:56 +0000 (09:21 +0000)]
SPARC NCG: Also do misaligned reads (this time for sure!)

13 years agoSPARC NCG: Also do misaligned reads
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 23:24:23 +0000 (23:24 +0000)]
SPARC NCG: Also do misaligned reads

13 years agoWhen converting TH syntax to GHC syntax, need to put sections in parentheses
Ian Lynagh [Wed, 21 Jan 2009 14:17:06 +0000 (14:17 +0000)]
When converting TH syntax to GHC syntax, need to put sections in parentheses
Fixes trac #2956

13 years agoSPARC NCG: Add a SPARC version of rts_mkInt64 that handles misaligned closure payloads.
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 05:23:34 +0000 (05:23 +0000)]
SPARC NCG: Add a SPARC version of rts_mkInt64 that handles misaligned closure payloads.

13 years agoSPARC NCG: Reenable out of line 32 bit float ops
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 03:47:16 +0000 (03:47 +0000)]
SPARC NCG: Reenable out of line 32 bit float ops

13 years agoSPARC NCG: Clean up formatting and add comments in genCCall
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 02:55:49 +0000 (02:55 +0000)]
SPARC NCG: Clean up formatting and add comments in genCCall

13 years agoSPARC NCG: Fix format problem when converting float to int
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 01:26:24 +0000 (01:26 +0000)]
SPARC NCG: Fix format problem when converting float to int

13 years agoSPARC NCG: fill branch delay slot after tabled jump (doh!)
Ben.Lippmeier@anu.edu.au [Wed, 21 Jan 2009 00:37:29 +0000 (00:37 +0000)]
SPARC NCG: fill branch delay slot after tabled jump (doh!)

13 years agoSPARC NCG: Add tabled switch
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 21:49:14 +0000 (21:49 +0000)]
SPARC NCG: Add tabled switch

13 years agoSPARC NCG: Fix 64bit integers returned from ccalls
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 09:06:17 +0000 (09:06 +0000)]
SPARC NCG: Fix 64bit integers returned from ccalls

13 years ago#2875: Correct SYB's representation of Char
'Jose Pedro Magalhaes [Mon, 19 Jan 2009 11:23:21 +0000 (11:23 +0000)]
#2875: Correct SYB's representation of Char

13 years agoFix #2759: add ability to serialize Rational
'Jose Pedro Magalhaes [Tue, 9 Dec 2008 12:55:51 +0000 (12:55 +0000)]
Fix #2759: add ability to serialize Rational

13 years agoSPARC NCG: Fix warnings
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 07:51:00 +0000 (07:51 +0000)]
SPARC NCG: Fix warnings

13 years agoSPARC NCG: Remove a comment that was confusing haddock
Ben.Lippmeier@anu.edu.au [Fri, 16 Jan 2009 01:18:53 +0000 (01:18 +0000)]
SPARC NCG: Remove a comment that was confusing haddock

13 years agoSPARC NCG: ppr 64 bit store sizes
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 07:40:00 +0000 (07:40 +0000)]
SPARC NCG: ppr 64 bit store sizes

13 years agoSPARC NCG: Fix generation of 64 bit ops on 32 bit sparc
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 07:15:36 +0000 (07:15 +0000)]
SPARC NCG: Fix generation of 64 bit ops on 32 bit sparc

13 years agoSPARC NCG: Add support for hardware divide
Ben.Lippmeier@anu.edu.au [Tue, 20 Jan 2009 05:21:13 +0000 (05:21 +0000)]
SPARC NCG: Add support for hardware divide

13 years agoSPARC NCG: Redo code for integer sign extension
Ben.Lippmeier@anu.edu.au [Thu, 15 Jan 2009 08:41:05 +0000 (08:41 +0000)]
SPARC NCG: Redo code for integer sign extension

13 years agoSPARC NCG: Fix signed/unsigned operand format bug
Ben.Lippmeier@anu.edu.au [Thu, 15 Jan 2009 08:00:04 +0000 (08:00 +0000)]
SPARC NCG: Fix signed/unsigned operand format bug

13 years agoMore fixes to the SPARC native code generator
Ben.Lippmeier@anu.edu.au [Thu, 15 Jan 2009 05:57:27 +0000 (05:57 +0000)]
More fixes to the SPARC native code generator

 * Fix loading of 64bit floats
 * Put SRT and other read only static data in the .text segment

13 years agoStart fixing the SPARC native code generator
Ben.Lippmeier@anu.edu.au [Wed, 14 Jan 2009 05:44:16 +0000 (05:44 +0000)]
Start fixing the SPARC native code generator

  * Use BlockIds in branch instructions instead of Imms.
  * Assign FP values returned from C calls to the right regs
  * Fix loading of F32s
  * Add a SPARC version of the FreeRegs map to the linear allcator.

13 years agoFix some holes in the SPARC native code generator.
Ben.Lippmeier@anu.edu.au [Mon, 12 Jan 2009 06:33:10 +0000 (06:33 +0000)]
Fix some holes in the SPARC native code generator.

This makes about half the tests in codeGen/should_run work.

13 years agoUntag closure pointers before trying to print them.
Ben.Lippmeier@anu.edu.au [Mon, 12 Jan 2009 05:34:21 +0000 (05:34 +0000)]
Untag closure pointers before trying to print them.

In RTS tracing code, need to untag the pointer before trying
to load the info table in printClosure()

13 years agoAdd missing documention of -Da DEBUG: apply flag to RTS help.
Ben.Lippmeier@anu.edu.au [Mon, 12 Jan 2009 00:56:25 +0000 (00:56 +0000)]
Add missing documention of -Da DEBUG: apply flag to RTS help.

13 years agoBetter panic message in RegAllocLinear
Ben.Lippmeier@anu.edu.au [Sat, 10 Jan 2009 02:58:02 +0000 (02:58 +0000)]
Better panic message in RegAllocLinear

13 years agoMake the SPARC NCG compile again - it's still broken though.
Ben.Lippmeier@anu.edu.au [Sat, 10 Jan 2009 01:44:18 +0000 (01:44 +0000)]
Make the SPARC NCG compile again - it's still broken though.

13 years agoEnable the native code generator for SPARC
Ben.Lippmeier@anu.edu.au [Mon, 5 Jan 2009 07:04:29 +0000 (07:04 +0000)]
Enable the native code generator for SPARC

13 years agoAlways use PTHREAD_MUTEX_ERRORCHECK to create mutexes when -DDEBUG
Ian Lynagh [Sun, 18 Jan 2009 19:33:28 +0000 (19:33 +0000)]
Always use PTHREAD_MUTEX_ERRORCHECK to create mutexes when -DDEBUG
Linux defines PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP
anyway, so there's no need to special-case it.

13 years agoUse error-checking mutexes on all platforms when DEBUG is on
Ian Lynagh [Sat, 17 Jan 2009 21:59:31 +0000 (21:59 +0000)]
Use error-checking mutexes on all platforms when DEBUG is on
Otherwise ASSERT_LOCK_HELD will cause deadlocks

13 years agoReinstate: Always check the result of pthread_mutex_lock() and pthread_mutex_unlock().
Ian Lynagh [Sat, 17 Jan 2009 20:09:55 +0000 (20:09 +0000)]
Reinstate: Always check the result of pthread_mutex_lock() and pthread_mutex_unlock().
Sun Jan  4 19:24:43 GMT 2009  Matthias Kilian <kili@outback.escape.de>
    Don't check pthread_mutex_*lock() only on Linux and/or only if DEBUG
    is defined. The return values of those functions are well defined
    and should be supported on all operation systems with pthreads. The
    checks are cheap enough to do them even in the default build (without
    -DDEBUG).

    While here, recycle an unused macro ASSERT_LOCK_NOTHELD, and let
    the debugBelch part enabled with -DLOCK_DEBUG work independently
    of -DDEBUG.

13 years agoInitialise and deinitialise the file_lock_mutex
Ian Lynagh [Sat, 17 Jan 2009 02:39:47 +0000 (02:39 +0000)]
Initialise and deinitialise the file_lock_mutex

13 years agoCreate package.conf when installing a bindist
Ian Lynagh [Sun, 18 Jan 2009 11:06:54 +0000 (11:06 +0000)]
Create package.conf when installing a bindist

13 years agovalidate fix on 32-bit
Simon Marlow [Wed, 14 Jan 2009 16:28:34 +0000 (16:28 +0000)]
validate fix on 32-bit

13 years agofix validate on Windows
Simon Marlow [Wed, 14 Jan 2009 15:58:42 +0000 (15:58 +0000)]
fix validate on Windows

13 years agoUNDO: Always check the result of pthread_mutex_lock() and pthread_mutex_unlock().
Simon Marlow [Fri, 16 Jan 2009 11:43:39 +0000 (11:43 +0000)]
UNDO: Always check the result of pthread_mutex_lock() and pthread_mutex_unlock().
This patch caused problems on Mac OS X, undoing until we can do it better.

rolling back:

Sun Jan  4 19:24:43 GMT 2009  Matthias Kilian <kili@outback.escape.de>
  * Always check the result of pthread_mutex_lock() and pthread_mutex_unlock().

  Don't check pthread_mutex_*lock() only on Linux and/or only if DEBUG
  is defined. The return values of those functions are well defined
  and should be supported on all operation systems with pthreads. The
  checks are cheap enough to do them even in the default build (without
  -DDEBUG).

  While here, recycle an unused macro ASSERT_LOCK_NOTHELD, and let
  the debugBelch part enabled with -DLOCK_DEBUG work independently
  of -DDEBUG.

    M ./includes/OSThreads.h -30 +10

13 years agoUpdate config.guess, config.sub and install.sh from automake-1.10.2
Simon Marlow [Fri, 16 Jan 2009 09:53:11 +0000 (09:53 +0000)]
Update config.guess, config.sub and install.sh from automake-1.10.2
In particular, config.guess should now know about x86_64-pc-solaris2

13 years agoMore useful error message when a package .hi file cannot be found:
Simon Marlow [Thu, 15 Jan 2009 12:25:24 +0000 (12:25 +0000)]
More useful error message when a package .hi file cannot be found:

> import System.Process
Could not find module `System.Process':
  There are files missing in the process-1.0.1.1 package,
  try running 'ghc-pkg check'.
  Use -v to see a list of the files searched for.

13 years agosoup-up "ghc-pkg check"
Simon Marlow [Thu, 15 Jan 2009 12:21:43 +0000 (12:21 +0000)]
soup-up "ghc-pkg check"

We now look for missing files (including .hi files), and report all
the packages that are transitively broken.

$ ghc-pkg check
There are problems in package syb-0.1.0.0:
  dependency foo-4.0.0.0 doesn't exist
There are problems in package process-1.0.1.1:
  file System/Process.hi is missing

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
syb-0.1.0.0
process-1.0.1.1
base-3.0.3.0
Cabal-1.7.0
haskell98-1.0.1.0
haddock-2.4.2
ghc-6.11

13 years agodocument -feager-blackholing
Simon Marlow [Thu, 15 Jan 2009 09:39:22 +0000 (09:39 +0000)]
document -feager-blackholing

13 years agoExternal Core: re-add code I removed mistakenly in last commit
Tim Chevalier [Thu, 15 Jan 2009 00:26:12 +0000 (00:26 +0000)]
External Core: re-add code I removed mistakenly in last commit

13 years agoExternal Core lib: lots of cleanup
Tim Chevalier [Wed, 14 Jan 2009 22:44:28 +0000 (22:44 +0000)]
External Core lib: lots of cleanup

- Factor out code for applying newtypes from Check into CoreUtils
- Use this code in Prep, which allowed for some simplification
- Change Merge and ElimDeadCode to not flatten top-level binds
- Add a flag for elimDeadCode to tell it whether to keep
exported bindings or not.
- Other things.

13 years agoExternal Core: print out more precise dependency info
Tim Chevalier [Wed, 14 Jan 2009 22:17:34 +0000 (22:17 +0000)]
External Core: print out more precise dependency info

Print out the same recursive/non-recursive binding groups
that existed in internal Core in an External Core file,
rather than dumping everything into one big recursive group.

13 years agoFix "make install": Put "[]" in the install package.conf
Ian Lynagh [Wed, 14 Jan 2009 20:59:45 +0000 (20:59 +0000)]
Fix "make install": Put "[]" in the install package.conf

13 years agoRemove redundant import; spotted by Thorkil Naur
Ian Lynagh [Wed, 14 Jan 2009 18:19:37 +0000 (18:19 +0000)]
Remove redundant import; spotted by Thorkil Naur

13 years agoRemove a redundant import
Ian Lynagh [Wed, 14 Jan 2009 18:12:12 +0000 (18:12 +0000)]
Remove a redundant import

13 years agoDetect when a C finalizer calls back to Haskell
Simon Marlow [Wed, 14 Jan 2009 12:15:26 +0000 (12:15 +0000)]
Detect when a C finalizer calls back to Haskell
This is illegal now, after the fix for #1364, but it turns out that
the existing check for dodgy callbacks doesn't catch finalizers
calling back, so we need another test.  This will be particularly
important for 6.10.2, because the behaviour has changed.

13 years agoFix Trac #2931
simonpj@microsoft.com [Tue, 13 Jan 2009 17:09:48 +0000 (17:09 +0000)]
Fix Trac #2931

Fix the lexical analyser when it encounters 'x<EOF> and Template
Haskell is on.

13 years agoRewrite CorePrep and improve eta expansion
simonpj@microsoft.com [Tue, 13 Jan 2009 16:49:53 +0000 (16:49 +0000)]
Rewrite CorePrep and improve eta expansion

This patch does two main things

a) Rewrite most of CorePrep to be much easier to understand (I hope!).
   The invariants established by CorePrep are now written out, and
   the code is more perspicuous.  It is surpringly hard to get right,
   and the old code had become quite incomprehensible.

b) Rewrite the eta-expander so that it does a bit of simplifying
   on-the-fly, and thereby guarantees to maintain the CorePrep
   invariants.  This make it much easier to use from CorePrep, and
   is a generally good thing anyway.

A couple of pieces of re-structuring:

*  I moved the eta-expander and arity analysis stuff into a new
   module coreSyn/CoreArity.

   Max will find that the type CoreArity.EtaInfo looks strangely
   familiar.

*  I moved a bunch of comments from Simplify to OccurAnal; that's
   why it looks as though there's a lot of lines changed in those
   modules.

On the way I fixed various things

  - Function arguments are eta expanded
       f (map g)  ===>  let s = \x. map g x in f s

  - Trac #2368

The result is a modest performance gain, I think mainly due
to the first of these changes:

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
            Min          -1.0%    -17.4%    -19.1%    -46.4%
            Max          +0.3%     +0.5%     +5.4%    +53.8%
 Geometric Mean          -0.1%     -0.3%     -7.0%    -10.2%

13 years agoRename isIdentityCoercion to isIdentityCoI; add Coercion.isIdentityCoercion
simonpj@microsoft.com [Tue, 13 Jan 2009 16:48:04 +0000 (16:48 +0000)]
Rename isIdentityCoercion to isIdentityCoI; add Coercion.isIdentityCoercion

13 years agoSpelling in comment only
simonpj@microsoft.com [Tue, 13 Jan 2009 16:46:24 +0000 (16:46 +0000)]
Spelling in comment only