1. 29 Mar, 2016 2 commits
  2. 11 Feb, 2016 1 commit
  3. 27 Jan, 2016 1 commit
  4. 18 Jan, 2016 1 commit
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  5. 07 Jan, 2016 1 commit
    • Simon Peyton Jones's avatar
      Make demand analysis understand catch · 9915b656
      Simon Peyton Jones authored
      As Trac #11222, and #10712 note, the strictness analyser
      needs to be rather careful about exceptions.  Previously
      it treated them as identical to divergence, but that
      won't quite do.
      
      See Note [Exceptions and strictness] in Demand, which
      explains the deal.
      
      Getting more strictness in 'catch' and friends is a
      very good thing.  Here is the nofib summary, keeping
      only the big ones.
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                fasta          -0.1%     -6.9%     -3.0%     -3.0%     +0.0%
                  hpg          -0.1%     -2.0%     -6.2%     -6.2%     +0.0%
             maillist          -0.1%     -0.3%      0.08      0.09     +1.2%
      reverse-complem          -0.1%    -10.9%     -6.0%     -5.9%     +0.0%
               sphere          -0.1%     -4.3%      0.08      0.08     +0.0%
                 x2n1          -0.1%     -0.0%      0.00      0.00     +0.0%
      --------------------------------------------------------------------------------
                  Min          -0.2%    -10.9%    -17.4%    -17.3%     +0.0%
                  Max          -0.0%     +0.0%     +4.3%     +4.4%     +1.2%
       Geometric Mean          -0.1%     -0.3%     -2.9%     -3.0%     +0.0%
      
      On the way I did quite a bit of refactoring in Demand.hs
      9915b656
  6. 05 Aug, 2015 1 commit
  7. 03 Aug, 2015 1 commit
  8. 29 Jul, 2015 1 commit
  9. 21 Jul, 2015 1 commit
    • Simon Peyton Jones's avatar
      Improve strictness analysis for exceptions · 7c0fff41
      Simon Peyton Jones authored
      Two things here:
      
      * For exceptions-catching primops like catch#, we know
        that the main argument function will be called, so
        we can use strictApply1Dmd, rather than lazy
      
        Changes in primops.txt.pp
      
      * When a 'case' scrutinises a I/O-performing primop,
        the Note [IO hack in the demand analyser] was
        throwing away all strictness from the code that
        followed.
      
        I found that this was causing quite a bit of unnecessary
        reboxing in the (heavily used) function
        GHC.IO.Handle.Internals.wantReadableHandle
      
        So this patch prevents the hack applying when the
        case scrutinises a primop.  See the revised
        Note [IO hack in the demand analyser]
      
      Thse two things buy us quite a lot in programs that do a lot of IO.
      
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                  hpg          -0.4%     -2.9%     -0.9%     -1.0%     +0.0%
      reverse-complem          -0.4%    -10.9%    +10.7%    +10.9%     +0.0%
               simple          -0.3%     -0.0%    +26.2%    +26.2%     +3.7%
               sphere          -0.3%     -6.3%      0.09      0.09     +0.0%
      --------------------------------------------------------------------------------
                  Min          -0.7%    -10.9%     -4.6%     -4.7%     -1.7%
                  Max          -0.2%     +0.0%    +26.2%    +26.2%     +6.5%
       Geometric Mean          -0.4%     -0.3%     +2.1%     +2.1%     +0.1%
      
      I think the increase in runtime for 'simple' is measurement error.
      7c0fff41
  10. 08 Jul, 2015 1 commit
  11. 14 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Zap usage info in CSE (Trac #10218) · d261d4cb
      Simon Peyton Jones authored
      Trac #10218 reports a subtle bug that turned out to be:
      
      - CSE invalidated the usage information computed
        by earlier demand analysis, by increasing sharing
      
      - that made a single-entry thunk into a multi-entry thunk
      
      - and with -feager-blackholing, that led to <<loop>>
      
      The patch fixes it by making the CSE pass zap usage information for
      let-bound identifiers.   It can be restored by -flate-dmd-anal.
      
      (But making -flate-dmd-anal the default needs some careful work;
      see Trac #7782.)
      d261d4cb
  12. 10 Apr, 2015 1 commit
  13. 07 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Fix a long-standing bug in the demand analyser · 9f0f99fd
      Simon Peyton Jones authored
      This patch fixes Trac #10148, an outright and egregious
      bug in the demand analyser.
      
      It is explained in Note [Demand on case-alternative binders]
      in Demand.hs.
      
      I did some other minor refactoring.
      
      To my astonishment I got some big compiler perf changes
      
      * perf/compiler/T5837: bytes allocated -76%
      * perf/compiler/T5030: bytes allocated -10%
      * perf/compiler/T3294: max bytes used  -25%
      
      Happy days
      9f0f99fd
  14. 04 Mar, 2015 1 commit
  15. 03 Dec, 2014 1 commit
  16. 04 Nov, 2014 1 commit
  17. 13 Oct, 2014 1 commit
  18. 01 Jul, 2014 1 commit
    • Simon Peyton Jones's avatar
      Fix demand analyser for unboxed types · d6ee82b2
      Simon Peyton Jones authored
      This is a tricky case exposed by Trac #9254.  I'm surprised it hasn't
      shown up before, because it's happens when you use unsafePerformIO in
      the right way.
      
      Anyway, fixed now.  See Note [Analysing with absent demand]
      in Demand.lhs
      d6ee82b2
  19. 20 Jun, 2014 1 commit
  20. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  21. 06 Mar, 2014 1 commit
    • Simon Peyton Jones's avatar
      Make the demand on a binder compatible with type (fixes Trac #8569) · 4b355cd2
      Simon Peyton Jones authored
      Because of GADTs and casts we were getting binders whose
      demand annotation was more deeply nested than made sense
      for its type.
      
      See Note [Trimming a demand to a type], in Demand.lhs,
      which I reproduce here:
      
         Note [Trimming a demand to a type]
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         Consider this:
      
           f :: a -> Bool
           f x = case ... of
                   A g1 -> case (x |> g1) of (p,q) -> ...
                   B    -> error "urk"
      
         where A,B are the constructors of a GADT.  We'll get a U(U,U) demand
         on x from the A branch, but that's a stupid demand for x itself, which
         has type 'a'. Indeed we get ASSERTs going off (notably in
         splitUseProdDmd, Trac #8569).
      
         Bottom line: we really don't want to have a binder whose demand is more
         deeply-nested than its type.  There are various ways to tackle this.
         When processing (x |> g1), we could "trim" the incoming demand U(U,U)
         to match x's type.  But I'm currently doing so just at the moment when
         we pin a demand on a binder, in DmdAnal.findBndrDmd.
      4b355cd2
  22. 01 Feb, 2014 1 commit
  23. 23 Jan, 2014 1 commit
    • Joachim Breitner's avatar
      Some polishing of the demand analyser. · 8d34ae39
      Joachim Breitner authored
      I did some refactoring of the demand analyser, because I was smelling
      some minor code smell. Most of my changes I had to undo, though,
      adding notes and testcases on why the existing code was correct after
      all.
      
      Especially the semantics of the DmdResult is confusing, as it differs in
      a DmdType and a StrictSig.
      
      I got to imrpove the readability of the code for lubDmdType, though.
      
      Also, dmdAnalRhs was a bit fishy in how it removed the demand on
      further arguments of the body, but used the DmdResult. This would be
      wrong if a body would return a demand type of "<L>m" (which currently
      does not happen).  This is now treated better in removeDmdTyArgs.
      8d34ae39
  24. 16 Jan, 2014 4 commits
  25. 10 Jan, 2014 2 commits
  26. 16 Dec, 2013 7 commits
  27. 12 Dec, 2013 3 commits
    • Joachim Breitner's avatar
      Move peelFV from DmdAnal to Demand · 6b6a30d6
      Joachim Breitner authored
      6b6a30d6
    • Simon Peyton Jones's avatar
      Improve the handling of used-once stuff · 80989de9
      Simon Peyton Jones authored
      Joachim and I are committing this onto a branch so that we can share it,
      but we expect to do a bit more work before merging it onto head.
      
      Nofib staus:
        - Most programs, no change
        - A few improve
        - A couple get worse (cacheprof, tak, rfib)
      Investigating the "get worse" set is what's holding up putting this
      on head.
      
      The major issue is this.  Consider
      
          map (f g) ys
      
      where f's demand signature looks like
      
         f :: <L,C1(C1(U))> -> <L,U> -> .
      
      So 'f' is not saturated.  What demand do we place on g?
      Answer
              C(C1(U))
      That is, the inner C1 should stay, even though f is not saturated.
      
      I found that this made a significant difference in the demand signatures
      inferred in GHC.IO, which uses lots of higher-order exception handlers.
      
      I also had to add used-once demand signatures for some of the
      'catch' primops, so that we know their handlers are only called once.
      80989de9
    • Simon Peyton Jones's avatar
      Assign strictness signatures to primitive operations · 0558911f
      Simon Peyton Jones authored
      This patch was authored by SPJ, and extracted from "Improve the handling
      of used-once stuff" by Joachim.
      0558911f