ghc-hetmet.git
14 years agoComments only
simonpj@microsoft.com [Tue, 5 Jan 2010 09:53:56 +0000 (09:53 +0000)]
Comments only

14 years agoContinue refactoring the core-to-core pipeline
simonpj@microsoft.com [Thu, 24 Dec 2009 15:46:43 +0000 (15:46 +0000)]
Continue refactoring the core-to-core pipeline

This patch mainly concerns the plumbing for running
the passes and printing intermediate output

14 years agoA bunch of stuff relating to substitutions on core
simonpj@microsoft.com [Thu, 24 Dec 2009 15:39:49 +0000 (15:39 +0000)]
A bunch of stuff relating to substitutions on core

* I was debugging so I added some call-site info
  (that touches a lot of code)

* I used substExpr a bit less in Simplify, hoping to
  make the simplifier a little faster and cleaner

14 years agoRefactor CoreArity a bit
simonpj@microsoft.com [Thu, 24 Dec 2009 15:34:48 +0000 (15:34 +0000)]
Refactor CoreArity a bit

I was experimenting with making coercions opaque to
arity.  I think this is ultimately the right thing to do
but I've left the functionality unchanged for now.

14 years agoWibbles to inlining for small functions
simonpj@microsoft.com [Tue, 22 Dec 2009 16:27:31 +0000 (16:27 +0000)]
Wibbles to inlining for small functions

See Note [INLINE for small functions]

14 years agoPrint out a bit more info with the "arity decrease" waring
simonpj@microsoft.com [Tue, 22 Dec 2009 16:26:06 +0000 (16:26 +0000)]
Print out a bit more info with the "arity decrease" waring

14 years agoMove isDictTy from TcType to Type
simonpj@microsoft.com [Tue, 22 Dec 2009 16:25:50 +0000 (16:25 +0000)]
Move isDictTy from TcType to Type

14 years agoAllow instance heads to use infix syntax
simonpj@microsoft.com [Tue, 22 Dec 2009 16:23:25 +0000 (16:23 +0000)]
Allow instance heads to use infix syntax

  class C a b
  instance Int `C` Bool

This was accidentally disallowed before.

14 years agoFix pretty-printer
simonpj@microsoft.com [Tue, 22 Dec 2009 16:21:30 +0000 (16:21 +0000)]
Fix pretty-printer

14 years agoFix Trac #3792: check for qualified names in import items
simonpj@microsoft.com [Mon, 4 Jan 2010 21:59:50 +0000 (21:59 +0000)]
Fix Trac #3792: check for qualified names in import items

14 years agoFix bugs in STG Lint
simonpj@microsoft.com [Mon, 4 Jan 2010 21:46:59 +0000 (21:46 +0000)]
Fix bugs in STG Lint

The Stg Lint failure reported in Trac #3789 were bogus.
This patch fixes STG Lint, which must have been unused
for ages.

14 years agoRefactor PackageTarget back into StaticTarget
Ben.Lippmeier@anu.edu.au [Mon, 4 Jan 2010 03:15:06 +0000 (03:15 +0000)]
Refactor PackageTarget back into StaticTarget

14 years agoFollow PackageTarget changes in pprCEntity
Ben.Lippmeier@anu.edu.au [Sat, 2 Jan 2010 23:50:53 +0000 (23:50 +0000)]
Follow PackageTarget changes in pprCEntity

14 years agoAssume CmmLabels have dynamic linkage on non-Windows
Ben.Lippmeier.anu.edu.au [Sat, 2 Jan 2010 10:03:34 +0000 (10:03 +0000)]
Assume CmmLabels have dynamic linkage on non-Windows

14 years agoFollow PackageTarget change in byte code generator
Ben.Lippmeier@anu.edu.au [Sat, 2 Jan 2010 09:30:46 +0000 (09:30 +0000)]
Follow PackageTarget change in byte code generator

14 years agoWhen compiling viac, don't need to emit prototypes for symbols in the RTS
Ben.Lippmeier@anu.edu.au [Sat, 2 Jan 2010 09:29:57 +0000 (09:29 +0000)]
When compiling viac, don't need to emit prototypes for symbols in the RTS

14 years agoFollow ForeignLabel changes in PPC NCG
Ben.Lippmeier@anu.edu.au [Sat, 2 Jan 2010 06:23:15 +0000 (06:23 +0000)]
Follow ForeignLabel changes in PPC NCG

14 years agoTag ForeignCalls with the package they correspond to
Ben.Lippmeier@anu.edu.au [Sat, 2 Jan 2010 05:37:54 +0000 (05:37 +0000)]
Tag ForeignCalls with the package they correspond to

14 years agoNicer panic message
Ben.Lippmeier@anu.edu.au [Tue, 29 Dec 2009 10:35:18 +0000 (10:35 +0000)]
Nicer panic message

14 years agoTypo in comment
Ben.Lippmeier@anu.edu.au [Tue, 29 Dec 2009 05:18:58 +0000 (05:18 +0000)]
Typo in comment

14 years agoWindows DLLs: use DLL aware runSparks_closure instead of base_GHCziConc_runSparks_clo...
Ben.Lippmeier@anu.edu.au [Mon, 23 Nov 2009 05:15:10 +0000 (05:15 +0000)]
Windows DLLs: use DLL aware runSparks_closure instead of base_GHCziConc_runSparks_closure directly

14 years agolocateOneObj: don't look for dynamic libs in static mode
Simon Marlow [Sun, 3 Jan 2010 22:36:37 +0000 (22:36 +0000)]
locateOneObj: don't look for dynamic libs in static mode
also replace picIsOn with isDynamicGhcLib, as __PIC__ is not the
correct test for whether the GHC library is dynamically linked.

14 years agoSubstantial improvements to coercion optimisation
simonpj@microsoft.com [Mon, 4 Jan 2010 08:21:55 +0000 (08:21 +0000)]
Substantial improvements to coercion optimisation

The main purpose of this patch is to add a bunch of new rules
to the coercion optimiser.  They are documented in the (revised)
Appendix of the System FC paper.

Some code has moved about:

- OptCoercion is now a separate module, mainly because it
  now uses tcMatchTy, which is defined in Unify, so OptCoercion
  must live higehr up in the hierarchy

- Functions that manipulate Kinds has moved from
  Type.lhs to Coercion.lhs.  Reason: the function typeKind
  now needs to call coercionKind.  And in any case, a Kind is
  a flavour of Type, so it builds on top of Type; indeed Coercions
  and Kinds are both flavours of Type.

  This change required fiddling with a number of imports, hence
  the one-line changes to otherwise-unrelated modules

- The representation of CoTyCons in TyCon has changed.   Instead of
  an extensional representation (a kind checker) there is now an
  intensional representation (namely TyCon.CoTyConDesc).  This was
  needed for one of the new coercion optimisations.

14 years agoWhitespace only
Ian Lynagh [Sat, 2 Jan 2010 22:05:56 +0000 (22:05 +0000)]
Whitespace only

14 years agoUse a shell script, rather than perl script, to make flags.xsl
Ian Lynagh [Thu, 31 Dec 2009 15:50:04 +0000 (15:50 +0000)]
Use a shell script, rather than perl script, to make flags.xsl

14 years agoRolling back: Make FastString thread-safe.
Simon Marlow [Thu, 31 Dec 2009 16:46:51 +0000 (16:46 +0000)]
Rolling back: Make FastString thread-safe.

This patch was the cause of the compile-time performance regression in
#3796.  My guess is that it is due to the use of unsafePerformIO which
traverses the stack up to the first update frame, and perhaps we have
a deep stack when reading the dictionary from a .hi file.  In any
case, since we're not relying on thread safety for FastStrings, I
think the safest thing to do is back this out until we can investigate
further.

14 years agotake newCAF() out from sm_mutex; use the capability-local mut list instead
Simon Marlow [Thu, 31 Dec 2009 16:02:23 +0000 (16:02 +0000)]
take newCAF() out from sm_mutex; use the capability-local mut list instead

14 years agoUse local mut lists in UPD_IND(), also clean up Updates.h
Simon Marlow [Thu, 31 Dec 2009 11:34:35 +0000 (11:34 +0000)]
Use local mut lists in UPD_IND(), also clean up Updates.h

14 years agouse local mut lists rather than global mut lists in sequential GC
Simon Marlow [Thu, 31 Dec 2009 11:31:18 +0000 (11:31 +0000)]
use local mut lists rather than global mut lists in sequential GC

14 years agoAllow throwTo() to be called without a source thread
Simon Marlow [Fri, 18 Dec 2009 16:32:00 +0000 (16:32 +0000)]
Allow throwTo() to be called without a source thread
Returns false if the exception could not be thrown becuase the tartget
thread was running.  Not used yet, but might come in handy later.

14 years agoIf ACTIVITY_INACTIVE is set, wait for GC before resetting it
Simon Marlow [Sun, 13 Dec 2009 20:12:46 +0000 (20:12 +0000)]
If ACTIVITY_INACTIVE is set, wait for GC before resetting it
I don't think this fixes any real bugs, but there's a small
possibility that when the RTS is woken up for an idle-time GC, the IO
manager thread might be pre-empted which would prevent the idle GC
from happening; this change ensures that the idle GC happens anyway.

14 years agoFix rules/build-dependencies.mk on OS X
Ian Lynagh [Wed, 30 Dec 2009 18:52:39 +0000 (18:52 +0000)]
Fix rules/build-dependencies.mk on OS X
Also more comments on why we have the sed rules that we do.

14 years agoCopying Simon M's fix for 650 to the new codegen
dias@cs.tufts.edu [Tue, 22 Dec 2009 22:20:17 +0000 (22:20 +0000)]
Copying Simon M's fix for 650 to the new codegen

14 years agoBetter error checking and code cleanup
dias@cs.tufts.edu [Tue, 22 Dec 2009 22:19:46 +0000 (22:19 +0000)]
Better error checking and code cleanup

14 years agoAdd comments to darcs-all
simonpj@microsoft.com [Mon, 21 Dec 2009 16:05:11 +0000 (16:05 +0000)]
Add comments to darcs-all

The comments explain how darcs-all decides what repo to use

14 years agoFix Trac #3772: dict funs for single-field classes
simonpj@microsoft.com [Mon, 21 Dec 2009 16:04:31 +0000 (16:04 +0000)]
Fix Trac #3772: dict funs for single-field classes

This patch fixes a bug that meant that INLINE pragamas on
a method of a single-field class didn't work properly.

See Note [Single-method classes] in TcInstDcls, and Trac #3772

14 years agoComments only (about implementing SPECIALISE pragmas)
simonpj@microsoft.com [Mon, 21 Dec 2009 15:57:45 +0000 (15:57 +0000)]
Comments only (about implementing SPECIALISE pragmas)

14 years agoA bit of refactoring, plus a sanity check
simonpj@microsoft.com [Mon, 21 Dec 2009 15:56:32 +0000 (15:56 +0000)]
A bit of refactoring, plus a sanity check

Check that a bottoming rhs does indeed get exposed with bottoming strictness
Almost all the changed lines reflect some refactoring of tidyTopIdInfo.

14 years agoFix Trac #3776
simonpj@microsoft.com [Mon, 21 Dec 2009 15:55:09 +0000 (15:55 +0000)]
Fix Trac #3776

An easy fix.  See Note [Usage for sub-bndrs] in RnEnv.

14 years agoMove all the CoreToDo stuff into CoreMonad
simonpj@microsoft.com [Fri, 18 Dec 2009 16:45:21 +0000 (16:45 +0000)]
Move all the CoreToDo stuff into CoreMonad

This patch moves a lot of code around, but has zero functionality change.
The idea is that the types

    CoreToDo
    SimplifierSwitch
    SimplifierMode
    FloatOutSwitches

and

    the main core-to-core pipeline construction

belong in simplCore/, and *not* in DynFlags.

14 years agoAlways expose the unfolding of something with an InlineRule
simonpj@microsoft.com [Fri, 18 Dec 2009 16:43:16 +0000 (16:43 +0000)]
Always expose the unfolding of something with an InlineRule

Previously a bottoming function with a strictness wrapper
had a hidden inlining, and that was Very Bad, because in
    f x = if ... then bot_fun x else x+1
we really want to pass the *unboxed* x to bot_fun. This
happens quite a bit in error handling code, eg for array
indexing.

14 years agoComments only
simonpj@microsoft.com [Fri, 18 Dec 2009 16:41:19 +0000 (16:41 +0000)]
Comments only

14 years agoMove loop-breaker info from original function to worker in work/wrap
simonpj@microsoft.com [Fri, 18 Dec 2009 16:41:07 +0000 (16:41 +0000)]
Move loop-breaker info from original function to worker in work/wrap

When doing a w/w split, if the original function is a loop breaker
then the worker (not the wrapper) becomes one instead.

This isn't very important, because loop breaker information is
recalculated afresh by the occurrence analyser, but it seems more
kosher.  And Lint was bleating piteously about things with InlineRules
that were loop breakers.

14 years agoMake -ddump-inlinings and -ddump-rule-firings less noisy
simonpj@microsoft.com [Fri, 18 Dec 2009 16:37:42 +0000 (16:37 +0000)]
Make -ddump-inlinings and -ddump-rule-firings less noisy

By default, these two now print *one line* per inlining or rule-firing.

If you want the previous (voluminous) behaviour, use -dverbose-core2core.

14 years agoMake warning printing a bit less noisy
simonpj@microsoft.com [Fri, 18 Dec 2009 16:35:49 +0000 (16:35 +0000)]
Make warning printing a bit less noisy

Use -dppr-debug to make it noisy again

14 years agoSet fixity (left-assoc) for setIdOccInfo
simonpj@microsoft.com [Fri, 18 Dec 2009 16:35:13 +0000 (16:35 +0000)]
Set fixity (left-assoc) for setIdOccInfo

14 years agoComments only
simonpj@microsoft.com [Fri, 18 Dec 2009 10:54:34 +0000 (10:54 +0000)]
Comments only

14 years agoAdd an extra heading in the output for count_lines
simonpj@microsoft.com [Fri, 18 Dec 2009 10:54:03 +0000 (10:54 +0000)]
Add an extra heading in the output for count_lines

14 years agoFixes to account for the new layout of MUT_ARR_PTRS (see #650)
Simon Marlow [Mon, 21 Dec 2009 11:52:49 +0000 (11:52 +0000)]
Fixes to account for the new layout of MUT_ARR_PTRS (see #650)

14 years agoPartial support for Haiku (#3727)
Simon Marlow [Mon, 21 Dec 2009 11:02:50 +0000 (11:02 +0000)]
Partial support for Haiku (#3727)

14 years agoFix #3751, also fix some lexical error SrcLocs
Simon Marlow [Thu, 17 Dec 2009 13:26:58 +0000 (13:26 +0000)]
Fix #3751, also fix some lexical error SrcLocs

14 years agokill some old GRAN/PARALLEL_HASKELL code
Simon Marlow [Thu, 17 Dec 2009 10:38:16 +0000 (10:38 +0000)]
kill some old GRAN/PARALLEL_HASKELL code

14 years agoimprove panic messages for srcLocLine, srcLocCol
Simon Marlow [Thu, 17 Dec 2009 10:38:01 +0000 (10:38 +0000)]
improve panic messages for srcLocLine, srcLocCol

14 years agoTweak the build-dependencies rule, and add comments for it
Ian Lynagh [Sat, 19 Dec 2009 14:58:08 +0000 (14:58 +0000)]
Tweak the build-dependencies rule, and add comments for it

14 years agoWhen removing $(TOP) with sed, do so case insensitively
Ian Lynagh [Sat, 19 Dec 2009 13:53:39 +0000 (13:53 +0000)]
When removing $(TOP) with sed, do so case insensitively
This avoids problems on Windows, where drive letters may not be the
case we expect.

14 years agoFix a braino in a comment
Ian Lynagh [Fri, 18 Dec 2009 21:35:41 +0000 (21:35 +0000)]
Fix a braino in a comment

14 years agoAvoid a failing shell command when cleaning
Ian Lynagh [Fri, 18 Dec 2009 20:11:46 +0000 (20:11 +0000)]
Avoid a failing shell command when cleaning
It wasn't fatal, but better to avoid it anyway

14 years agoFix another sed problem on Solaris
Ian Lynagh [Thu, 17 Dec 2009 00:04:21 +0000 (00:04 +0000)]
Fix another sed problem on Solaris

14 years agounused named variables
dias@cs.tufts.edu [Fri, 18 Dec 2009 19:54:30 +0000 (19:54 +0000)]
unused named variables

14 years agomissed a case in a previous fix
dias@cs.tufts.edu [Thu, 17 Dec 2009 21:04:43 +0000 (21:04 +0000)]
missed a case in a previous fix

Here's the obscure problem:
-- However, we also want to allow an assignment to be generated
-- in the case when the types are compatible, because this allows
-- some slightly-dodgy but occasionally-useful casts to be used,
-- such as in RtClosureInspect where we cast an HValue to a MutVar#
-- so we can print out the contents of the MutVar#.  If we generate
-- code that enters the HValue, then we'll get a runtime panic, because
-- the HValue really is a MutVar#.  The types are compatible though,
-- so we can just generate an assignment.

14 years agoFix #650: use a card table to mark dirty sections of mutable arrays
Simon Marlow [Thu, 17 Dec 2009 22:42:28 +0000 (22:42 +0000)]
Fix #650: use a card table to mark dirty sections of mutable arrays
The card table is an array of bytes, placed directly following the
actual array data.  This means that array reading is unaffected, but
array writing needs to read the array size from the header in order to
find the card table.

We use a bytemap rather than a bitmap, because updating the card table
must be multi-thread safe.  Each byte refers to 128 entries of the
array, but this is tunable by changing the constant
MUT_ARR_PTRS_CARD_BITS in includes/Constants.h.

14 years agoFix build with Solaris sed
Ian Lynagh [Wed, 16 Dec 2009 20:43:54 +0000 (20:43 +0000)]
Fix build with Solaris sed
Rather than trying to handle tabs with sed portably, we just use tr to
remove them before we start.

14 years agoBuild and install inplace the count_lines and compareSizes utils
Ian Lynagh [Wed, 16 Dec 2009 16:56:08 +0000 (16:56 +0000)]
Build and install inplace the count_lines and compareSizes utils

14 years agoAdjust Activations for specialise and work/wrap, and better simplify in InlineRules
simonpj@microsoft.com [Wed, 16 Dec 2009 14:52:05 +0000 (14:52 +0000)]
Adjust Activations for specialise and work/wrap, and better simplify in InlineRules

This patch does two main things:

1. Adjusts the way we set the Activation for

   a) The wrappers generated by the strictness analyser
      See Note [Wrapper activation] in WorkWrap

   b) The RULEs generated by Specialise and SpecConstr
      See Note [Auto-specialisation and RULES] in Specialise
          Note [Transfer activation] in SpecConstr

2. Refines how we set the phase when simplifying the right
   hand side of an InlineRule.  See
   Note [Simplifying inside InlineRules] in SimplUtils.

Most of the extra lines are comments!

The merit of (2) is that a bit more stuff happens inside InlineRules,
and that in turn allows better dead-code elimination.

14 years agoComments only
simonpj@microsoft.com [Wed, 16 Dec 2009 14:49:08 +0000 (14:49 +0000)]
Comments only

14 years agofix up libm detection and use (#3724)
Simon Marlow [Wed, 16 Dec 2009 11:36:52 +0000 (11:36 +0000)]
fix up libm detection and use (#3724)

14 years agoconfigure.ac: fix libm checks (Trac #3730)
Sergei Trofimovich [Fri, 4 Dec 2009 21:40:12 +0000 (21:40 +0000)]
configure.ac: fix libm checks (Trac #3730)

libbfd pulled libm as dependency and broke LIBM= detection.

Patch moves libm in library tests as early as possible.
Thanks to asuffield for suggesting such a simple fix.
Thanks to Roie Kerstein and Renato Gallo for finding
and tracking down the issue.

14 years ago#include <sys/select.h> if we have it (#3760)
Simon Marlow [Wed, 16 Dec 2009 09:55:01 +0000 (09:55 +0000)]
#include <sys/select.h> if we have it (#3760)

14 years agoadd a couple of assertions
Simon Marlow [Mon, 23 Nov 2009 10:19:18 +0000 (10:19 +0000)]
add a couple of assertions

14 years agoAdd comments
simonpj@microsoft.com [Wed, 16 Dec 2009 09:03:44 +0000 (09:03 +0000)]
Add comments

14 years agoRefactor to combine two eqExpr functions
simonpj@microsoft.com [Wed, 16 Dec 2009 08:50:33 +0000 (08:50 +0000)]
Refactor to combine two eqExpr functions

I'd forgotten that Rules.lhs already has an eqExpr function.  This
patch combines Rules.eqExpr with the (recent) CoreUtils.eqExpr.

I also did a little refactoring by defining CoreSyn.expandUnfolding_maybe
(see Note [Expanding variables] in Rules.lhs), and using it in
     a) CoreUnfold.exprIsConApp_maybe
     b) Rule matching

14 years agoTwo improvements to optCoercion
simonpj@microsoft.com [Wed, 16 Dec 2009 08:47:06 +0000 (08:47 +0000)]
Two improvements to optCoercion

* Fix a bug that meant that
     (right (inst (forall tv.co) ty))
  wasn't getting optimised.  This showed up in the
  compiled code for ByteCodeItbls

* Add a substitution to optCoercion, so that it simultaneously
  substitutes and optimises.  Both call sites wanted this, and
  optCoercion itself can use it, so it seems a win all round.

14 years agoComments only
simonpj@microsoft.com [Wed, 16 Dec 2009 08:45:58 +0000 (08:45 +0000)]
Comments only

14 years agoMake setInlineActivation left-associative
simonpj@microsoft.com [Wed, 16 Dec 2009 08:45:36 +0000 (08:45 +0000)]
Make setInlineActivation left-associative

14 years agoFix a long-standing infelicity in the type pretty printer
simonpj@microsoft.com [Wed, 16 Dec 2009 08:45:13 +0000 (08:45 +0000)]
Fix a long-standing infelicity in the type pretty printer

We weren't parenthesising
   List (C Int)
correctly, when (C Int) is a PredTy

14 years agoDeal with warnings in Coercion.lhs
simonpj@microsoft.com [Wed, 16 Dec 2009 08:40:53 +0000 (08:40 +0000)]
Deal with warnings in Coercion.lhs

14 years agoFix a bug in the in-scope set that led to some lookupIdSubst errors
simonpj@microsoft.com [Tue, 15 Dec 2009 16:02:16 +0000 (16:02 +0000)]
Fix a bug in the in-scope set that led to some lookupIdSubst errors

14 years agoFix Trac #3717: exprOkForSpeculation should look through case expressions
simonpj@microsoft.com [Tue, 15 Dec 2009 16:01:24 +0000 (16:01 +0000)]
Fix Trac #3717: exprOkForSpeculation should look through case expressions

See Note [exprOkForSpeculation: case expressions] in CoreUtils

14 years agoAdd a size-comparison util
Ian Lynagh [Tue, 15 Dec 2009 20:26:36 +0000 (20:26 +0000)]
Add a size-comparison util

14 years agoJust make C dependencies once, rather than each way
Ian Lynagh [Tue, 15 Dec 2009 13:53:50 +0000 (13:53 +0000)]
Just make C dependencies once, rather than each way
This makes generating C dependencies for the RTS take 3 seconds, rather
than 30.

14 years agoMake addCFileDeps quieter
Ian Lynagh [Tue, 15 Dec 2009 13:40:33 +0000 (13:40 +0000)]
Make addCFileDeps quieter
Move a comment out of the definition, so it doesn't get printed as
a shell command every time we call the definition

14 years agoDon't make C deps for compiler/parser/cutils.c in stage1
Ian Lynagh [Tue, 15 Dec 2009 12:37:57 +0000 (12:37 +0000)]
Don't make C deps for compiler/parser/cutils.c in stage1
CPP finds the Rts.h, RtsFlags.h etc from the tree, rather than the
bootstrapping compiler, and then fails because it doesn't think
RtsFlags.h should be used any more.

14 years agoTidy up computation of result discounts in CoreUnfold
simonpj@microsoft.com [Mon, 14 Dec 2009 13:46:47 +0000 (13:46 +0000)]
Tidy up computation of result discounts in CoreUnfold

Mostly this patch is a tidy-up, but it did reveal one inconsistency
that I fixed.  When computing result discounts for case expressions,
we were *adding* result-discounts for cases on non-arguments, but
*picking the one for the max-size branch* for arguments. I think you
could argue the toss, but it seems neater (and the code is nicer)
to be consistent (ie always add).  See Note [addAltSize result discounts].

The nofib results seem fine

        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
          boyer          -0.8%     -4.8%      0.06      0.07
         sphere          -0.7%     -2.5%      0.15      0.16
--------------------------------------------------------------------------------
            Min          -0.8%     -4.8%    -19.1%    -24.8%
            Max          -0.5%     +0.0%     +3.4%   +127.1%
 Geometric Mean          -0.7%     -0.1%     -4.3%     -1.3%

The +127% elapsed is a timing error; I re-ran the same binary and it's
unchanged from the baseline.

14 years agoUse full equality for CSE
simonpj@microsoft.com [Fri, 11 Dec 2009 17:39:20 +0000 (17:39 +0000)]
Use full equality for CSE

In CSE we were getting lots of apprarently-unequal expressions with
the same hash code.  In fact they were perfectly equal -- but we were
using a cheap-and-cheerful equality tests for CoreExpr that said False
for any lambda expression!

This patch adds a proper equality test for Core, with alpha-renaming.
It's easy to do, and will avoid silly cases of CSE failing to fire.

We should get less of this:
  WARNING: file compiler/simplCore/CSE.lhs line 326
  extendCSEnv: long list, length 18
from a compiler built with -DDEBUG

14 years agoImprove strictness analysis for bottoming functions
simonpj@microsoft.com [Fri, 11 Dec 2009 16:23:24 +0000 (16:23 +0000)]
Improve strictness analysis for bottoming functions

I found the following results from strictness analyis:
  f x = error (fst x)      -- Strictness U(SA)b
  g x = error ('y':fst x)  -- Strictness Tb

Surely 'g' is no less strict on 'x' than 'f' is!  The fix turned out
be to very nice and simple.  See Note [Bottom demands] in DmdAnal.

14 years agoBottom extraction: float out bottoming expressions to top level
simonpj@microsoft.com [Fri, 11 Dec 2009 16:19:28 +0000 (16:19 +0000)]
Bottom extraction: float out bottoming expressions to top level

The idea is to float out bottoming expressions to top level,
abstracting them over any variables they mention, if necessary.  This
is good because it makes functions smaller (and more likely to
inline), by keeping error code out of line.

See Note [Bottoming floats] in SetLevels.

On the way, this fixes the HPC failures for cg059 and friends.

I've been meaning to do this for some time.  See Maessen's paper 1999
"Bottom extraction: factoring error handling out of functional
programs" (unpublished I think).

Here are the nofib results:

        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
            Min          +0.1%     -7.8%    -14.4%    -32.5%
            Max          +0.5%     +0.2%     +1.6%    +13.8%
 Geometric Mean          +0.4%     -0.2%     -4.9%     -6.7%

Module sizes
        -1 s.d.                -----           -2.6%
        +1 s.d.                -----           +2.3%
        Average                -----           -0.2%

Compile times:
        -1 s.d.                -----          -11.4%
        +1 s.d.                -----           +4.3%
        Average                -----           -3.8%

I'm think program sizes have crept up because the base library
is bigger -- module sizes in nofib decrease very slightly.  In turn
I think that may be because the floating generates a call where
there was no call before.  Anyway I think it's acceptable.

The main changes are:

* SetLevels floats out things that exprBotStrictness_maybe
  identifies as bottom.  Make sure to pin on the right
  strictness info to the newly created Ids, so that the
  info ends up in interface files.

  Since FloatOut is run twice, we have to be careful that we
  don't treat the function created by the first float-out as
  a candidate for the second; this is what worthFloating does.

  See SetLevels Note [Bottoming floats]
                Note [Bottoming floats: eta expansion]

* Be careful not to inline top-level bottoming functions; this
  would just undo what the floating transformation achieves.
  See CoreUnfold Note [Do not inline top-level bottoming functions

  Ensuring this requires a bit of extra plumbing, but nothing drastic..

* Similarly pre/postInlineUnconditionally should be
  careful not to re-inline top-level bottoming things!
  See SimplUtils Note [Top-level botomming Ids]
                 Note [Top level and postInlineUnconditionally]

14 years agoExpose all EventLog events as DTrace probes
Manuel M T Chakravarty [Sat, 12 Dec 2009 10:08:09 +0000 (10:08 +0000)]
Expose all EventLog events as DTrace probes
- Defines a DTrace provider, called 'HaskellEvent', that provides a probe
  for every event of the eventlog framework.
- In contrast to the original eventlog, the DTrace probes are available in
  all flavours of the runtime system (DTrace probes have virtually no
  overhead if not enabled); when -DTRACING is defined both the regular
  event log as well as DTrace probes can be used.
- Currently, Mac OS X only.  User-space DTrace probes are implemented
  differently on Mac OS X than in the original DTrace implementation.
  Nevertheless, it shouldn't be too hard to enable these probes on other
  platforms, too.
- Documentation is at http://hackage.haskell.org/trac/ghc/wiki/DTrace

14 years agoFix two related bugs in u_tys
simonpj@microsoft.com [Fri, 11 Dec 2009 12:01:22 +0000 (12:01 +0000)]
Fix two related bugs in u_tys

When we normalise a type family application we must recursively call
uTys, *not* 'go', because the latter loop is only there to look
through type synonyms.  This bug made the type checker generate
ill-typed coercions, which were rejected by Core Lint.

A related bug only affects the size of coercions.  If faced with
  (m a) ~ (F b c)
where F has arity 1, we want to decompose to
   m ~ F Int,  a ~ c
rather than deferring.  The application decomposition was being
tried last, so we were missing this opportunity.

Thanks to Roman for an example that showed all this up.

14 years agoFix spelling in comment
simonpj@microsoft.com [Fri, 11 Dec 2009 11:57:44 +0000 (11:57 +0000)]
Fix spelling in comment

14 years agoMake -ddump-simpl-stats a bit more informative by default
simonpj@microsoft.com [Tue, 8 Dec 2009 17:54:45 +0000 (17:54 +0000)]
Make -ddump-simpl-stats a bit more informative by default

This mades -ddump-simpl-stats print out per-rule and per-id
information by default, rather than requiring -dppr-debug.
On the whole that is what you want.  The -dppr-debug flag
now just controls printing of the log.

14 years agoImprove dumping for rules, and documentation of same
simonpj@microsoft.com [Tue, 8 Dec 2009 10:55:56 +0000 (10:55 +0000)]
Improve dumping for rules, and documentation of same

Inspired by Trac #3703

14 years agoFix #3741, simplifying things in the process
Simon Marlow [Thu, 10 Dec 2009 16:09:09 +0000 (16:09 +0000)]
Fix #3741, simplifying things in the process
The problem in #3741 was that we had confused column numbers with byte
offsets, which fails in the case of UTF-8 (amongst other things).
Fortunately we're tracking correct column offsets now, so we didn't
have to make a calculation based on a byte offset.  I got rid of two
fields from the PState (last_line_len and last_offs).and one field
from the AI (alex input) constructor.

14 years agoAllow spaces at either end of the C import spec (#3742)
Simon Marlow [Thu, 10 Dec 2009 12:45:37 +0000 (12:45 +0000)]
Allow spaces at either end of the C import spec (#3742)

14 years agoPut README and INSTALL into bindists
Ian Lynagh [Wed, 9 Dec 2009 17:43:05 +0000 (17:43 +0000)]
Put README and INSTALL into bindists
Also tidied up the way configure.ac gets into bindists

14 years agoFix typo
Ian Lynagh [Wed, 9 Dec 2009 15:22:23 +0000 (15:22 +0000)]
Fix typo

14 years agoFix the stage1 version number munging
Ian Lynagh [Wed, 9 Dec 2009 15:17:15 +0000 (15:17 +0000)]
Fix the stage1 version number munging
It was munging 6.12.1 into 62

14 years agoAdd a comment about why $(CPP) is defined the way it is in config.mk.in
Ian Lynagh [Wed, 9 Dec 2009 13:19:17 +0000 (13:19 +0000)]
Add a comment about why $(CPP) is defined the way it is in config.mk.in

14 years agoadd a missing unlockTSO()
Simon Marlow [Wed, 9 Dec 2009 12:41:13 +0000 (12:41 +0000)]
add a missing unlockTSO()

14 years agoEliminate mkdependC
Ian Lynagh [Wed, 9 Dec 2009 12:39:29 +0000 (12:39 +0000)]
Eliminate mkdependC
We now just call gcc to get the dependencies directly

14 years agoChange some HC_OPTS to CC_OPTS, so they are used when making dependencies
Ian Lynagh [Tue, 8 Dec 2009 20:03:15 +0000 (20:03 +0000)]
Change some HC_OPTS to CC_OPTS, so they are used when making dependencies