1. 22 Dec, 2010 3 commits
    • simonpj@microsoft.com's avatar
      Tidy up rebindable syntax for MDo · ba05282d
      simonpj@microsoft.com authored
      For a long time an 'mdo' expression has had a SyntaxTable
      attached to it.  However, we're busy deprecating SyntaxTables
      in favour of rebindable syntax attached to individual Stmts,
      and MDoExpr was totally inconsistent with DoExpr in this
      regard.
      
      This patch tidies it all up.  Now there's no SyntaxTable on
      MDoExpr, and 'modo' is generally handled much more like 'do'.
      
      There is resulting small change in behaviour: now MonadFix is
      required only if you actually *use* recursion in mdo. This
      seems consistent with the implicit dependency analysis that
      is done for mdo.
      
      Still to do:
        * Deal with #4148 (this patch is on the way)
        * Get rid of the last remaining SyntaxTable on HsCmdTop
      ba05282d
    • simonpj@microsoft.com's avatar
      Make the occurrence analyser track preInlineUnconditionally · 16dd51fb
      simonpj@microsoft.com authored
      This fixes a somewhat obscure situation in which an
      over-optimistic use of "occurs once" led to an infinite
      sequence of simplifier iterations.  Se Note [Cascading inlines]
      for the details.
      
      This showed up when compiling rather large DPH programs, which
      run lots of iterations of the simplifier, which in turn made
      compilation take much longer than necessary.
      16dd51fb
    • simonpj@microsoft.com's avatar
      Make mkDFunUnfolding more robust · 3e0a7b9f
      simonpj@microsoft.com authored
      It now uses tcSplitDFunTy, which is designed for the purpose and
      allows arbitrary argument types to the dfun, rather than
      tcSplitSigmaTy.  This generality is used in DPH, which has
      internally-generated dfuns with impliciation-typed arguments.
      
      To do this I had to make tcSplitDFunTy return the number of
      arguments, so there are some minor knock-on effects in other
      modules.
      3e0a7b9f
  2. 21 Dec, 2010 5 commits
    • Simon Marlow's avatar
      Count allocations more accurately · db0c13a4
      Simon Marlow authored
      The allocation stats (+RTS -s etc.) used to count the slop at the end
      of each nursery block (except the last) as allocated space, now we
      count the allocated words accurately.  This should make allocation
      figures more predictable, too.
      
      This has the side effect of reducing the apparent allocations by a
      small amount (~1%), so remember to take this into account when looking
      at nofib results.
      db0c13a4
    • simonpj@microsoft.com's avatar
      Add a simple arity analyser · 1d7a3cf3
      simonpj@microsoft.com authored
      I've wanted to do this for ages, but never gotten around to
      it.  The main notes are in Note [Arity analysis] in SimplUtils.
      
      The motivating example for arity analysis is this:
      
        f = \x. let g = f (x+1)
                in \y. ...g...
      
      What arity does f have?  Really it should have arity 2, but a naive
      look at the RHS won't see that.  You need a fixpoint analysis which
      says it has arity "infinity" the first time round.
      
      This makes things more robust to the way in which you write code.  For
      example, see Trac #4474 which is fixed by this change.
      
      Not a huge difference, but worth while:
      
              Program           Size    Allocs   Runtime   Elapsed
      --------------------------------------------------------------------------------
                  Min          -0.4%     -2.2%    -10.0%    -10.0%
                  Max          +2.7%     +0.3%     +7.1%     +6.9%
       Geometric Mean          -0.3%     -0.2%     -2.1%     -2.2%
      
      I don't really believe the runtime numbers, because the machine was
      busy, but the bottom line is that not much changes, and what does
      change reliably (allocation and size) is in the right direction.
      1d7a3cf3
    • simonpj@microsoft.com's avatar
      62af0377
    • simonpj@microsoft.com's avatar
      Comments only · 05fecd15
      simonpj@microsoft.com authored
      05fecd15
    • simonpj@microsoft.com's avatar
      Single-method classes are implemented with a newtype · 3d16d9d8
      simonpj@microsoft.com authored
      This patch changes things so that such classes rely on the coercion
      mechanism for inlining (since the constructor is really just a cast)
      rather than on the dfun mechanism, therby removing some needless
      runtime indirections.
      3d16d9d8
  3. 01 Nov, 2010 1 commit
  4. 21 Dec, 2010 5 commits
  5. 16 Dec, 2010 1 commit
  6. 20 Dec, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Small improvement to CorePrep · c391db23
      simonpj@microsoft.com authored
      This change avoids unnecessary bindings. Example
      
           foo (let fn = \x.blah in
                in fn)
      
      We were generating something stupid like
      
          let fn = \x.blah in
          let fn' = \eta. fn eta
          in foo fn
      
      Now we don't.  The change is quite small.
      
      Thanks to Ben for showing me an example of this happening.
      c391db23
  7. 19 Dec, 2010 4 commits
  8. 18 Dec, 2010 8 commits
  9. 17 Dec, 2010 6 commits
  10. 16 Dec, 2010 4 commits
  11. 15 Dec, 2010 2 commits