1. 10 Dec, 2008 2 commits
  2. 09 Dec, 2008 1 commit
  3. 10 Dec, 2008 1 commit
  4. 09 Dec, 2008 12 commits
  5. 04 Dec, 2008 1 commit
  6. 08 Dec, 2008 6 commits
    • simonpj@microsoft.com's avatar
      Inject implicit bindings after CoreTidy, not before Simplify · 19fcb519
      simonpj@microsoft.com authored
      Originally I inject the "implicit bindings" (record selectors, class
      method selectors, data con wrappers...) after CoreTidy.  However, in a
      misguided attempt to fix Trac #2070, I moved the injection point to
      before the Simplifier, so that record selectors would be optimised by
      the simplifier.
      This was misguided because record selectors (indeed all implicit bindings)
      are GlobalIds, whose IdInfo is meant to be frozen.  But the Simplifier,
      and other Core-to-Core optimisations, merrily change the IdInfo.  That 
      ultimately made Trac #2844 happen, where a record selector got arity 2,
      but the GlobalId (which importing scopes re-construct from the class decl
      rather than reading from the interface file) has arity 1.
      So this patch moves the injection back to CoreTidy. Happily #2070 should
      still be OK because we now use CoreSubst.simpleOptExpr on the unfoldings
      for implict things, which gets rid of the most gratuitous infelicities.
      Still, there's a strong case for stoppping record selectors from being
      GlobalIds, and treating them much more like dict-funs.  I'm thinking
      about that.  Meanwhile, #2844 is ok now.
    • simonpj@microsoft.com's avatar
      Add assertion for arity match (checks Trac #2844) · 60881299
      simonpj@microsoft.com authored
      The exported arity of a function must match the arity for the
      STG function.  Trac #2844 was a pretty obscure manifestation of
      the failure of this invariant. This patch doesn't cure the bug;
      rather it adds an assertion to CoreToStg to check the invariant
      so we should get an earlier and less obscure warning if this
      fails in future.
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
      White space only · 85289ab5
      simonpj@microsoft.com authored
    • simonpj@microsoft.com's avatar
      Comments only · 57984dc3
      simonpj@microsoft.com authored
  7. 05 Dec, 2008 13 commits
    • simonpj@microsoft.com's avatar
      Completely new treatment of INLINE pragmas (big patch) · d95ce839
      simonpj@microsoft.com authored
      This is a major patch, which changes the way INLINE pragmas work.
      Although lots of files are touched, the net is only +21 lines of
      code -- and I bet that most of those are comments!
      HEADS UP: interface file format has changed, so you'll need to
      recompile everything.
      There is not much effect on overall performance for nofib, 
      probably because those programs don't make heavy use of INLINE pragmas.
              Program           Size    Allocs   Runtime   Elapsed
                  Min         -11.3%     -6.9%     -9.2%     -8.2%
                  Max          -0.1%     +4.6%     +7.5%     +8.9%
       Geometric Mean          -2.2%     -0.2%     -1.0%     -0.8%
      (The +4.6% for on allocs is cichelli; see other patch relating to
      The old INLINE system
      The old system worked like this. A function with an INLINE pragam
      got a right-hand side which looked like
           f = __inline_me__ (\xy. e)
      The __inline_me__ part was an InlineNote, and was treated specially
      in various ways.  Notably, the simplifier didn't inline inside an
      __inline_me__ note.  
      As a result, the code for f itself was pretty crappy. That matters
      if you say (map f xs), because then you execute the code for f,
      rather than inlining a copy at the call site.
      The new story: InlineRules
      The new system removes the InlineMe Note altogether.  Instead there
      is a new constructor InlineRule in CoreSyn.Unfolding.  This is a 
      bit like a RULE, in that it remembers the template to be inlined inside
      the InlineRule.  No simplification or inlining is done on an InlineRule,
      just like RULEs.  
      An Id can have an InlineRule *or* a CoreUnfolding (since these are two
      constructors from Unfolding). The simplifier treats them differently:
        - An InlineRule is has the substitution applied (like RULES) but 
          is otherwise left undisturbed.
        - A CoreUnfolding is updated with the new RHS of the definition,
          on each iteration of the simplifier.
      An InlineRule fires regardless of size, but *only* when the function
      is applied to enough arguments.  The "arity" of the rule is specified
      (by the programmer) as the number of args on the LHS of the "=".  So
      it makes a difference whether you say
        	{-# INLINE f #-}
      	f x = \y -> e     or     f x y = e
      This is one of the big new features that InlineRule gives us, and it
      is one that Roman really wanted.
      In contrast, a CoreUnfolding can fire when it is applied to fewer
      args than than the function has lambdas, provided the result is small
      Consequential stuff
      * A 'wrapper' no longer has a WrapperInfo in the IdInfo.  Instead,
        the InlineRule has a field identifying wrappers.
      * Of course, IfaceSyn and interface serialisation changes appropriately.
      * Making implication constraints inline nicely was a bit fiddly. In
        the end I added a var_inline field to HsBInd.VarBind, which is why
        this patch affects the type checker slightly
      * I made some changes to the way in which eta expansion happens in
        CorePrep, mainly to ensure that *arguments* that become let-bound
        are also eta-expanded.  I'm still not too happy with the clarity
        and robustness fo the result.
      * We now complain if the programmer gives an INLINE pragma for
        a recursive function (prevsiously we just ignored it).  Reason for
        change: we don't want an InlineRule on a LoopBreaker, because then
        we'd have to check for loop-breaker-hood at occurrence sites (which
        isn't currenlty done).  Some tests need changing as a result.
      This patch has been in my tree for quite a while, so there are
      probably some other minor changes.
    • simonpj@microsoft.com's avatar
      Add -fpass-case-bndr-to-join-points · ccd0e382
      simonpj@microsoft.com authored
      See Note [Passing the case binder to join points] in Simplify.lhs
      The default now is *not* to pass the case binder.  There are some
      nofib results with the above note; the effect is almost always 
      I don't expect this flag to be used by users (hence no docs). It's just
      there to let me try the performance effects of switching on and off.
    • simonpj@microsoft.com's avatar
      Add static flag -fsimple-list-literals · 6f547477
      simonpj@microsoft.com authored
      The new static flag -fsimple-list-literals makes ExplicitList literals
      be desugared in the straightforward way, rather than using 'build' as
      now.  See SLPJ comments with Note [Desugaring explicit lists].
      I don't expect this flag to be used by users (hence no docs). It's just
      there to let me try the performance effects of switching on and off.
    • simonpj@microsoft.com's avatar
      Comments only in OccurAnal · d56631cb
      simonpj@microsoft.com authored
    • simonpj@microsoft.com's avatar
      Comments only · 7aae56e3
      simonpj@microsoft.com authored
    • simonpj@microsoft.com's avatar
      Layout only · d617e38d
      simonpj@microsoft.com authored
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
    • simonpj@microsoft.com's avatar
      Trim redundant import · 960a5edb
      simonpj@microsoft.com authored
    • simonpj@microsoft.com's avatar
      Make CoreTidy retain deadness info (better -ddump-simpl) · 410fc617
      simonpj@microsoft.com authored
      GHC now retains more robust information about dead variables; but
      CoreTidy was throwing it away.  This patch makes CoreTidy retain it,
      which gives better output for -ddump-simpl.
      New opportunity: shrink interface files by using wildcards for dead variables.
    • simonpj@microsoft.com's avatar
      Remove INLINE pragmas on recursive functions · f44b3992
      simonpj@microsoft.com authored
      INLINE pragmas on recursive functions are ignored; and this
      is checked in my upcoming patch for inlinings.
    • simonpj@microsoft.com's avatar
      Comments only (on Activation) · 0764ab4c
      simonpj@microsoft.com authored
  8. 03 Dec, 2008 1 commit
  9. 02 Dec, 2008 3 commits