Skip to content
Snippets Groups Projects
  1. Jan 09, 2014
    • Joachim Breitner's avatar
      Speculative evaluate thunks known to Converge · 7e6bb343
      Joachim Breitner authored
      This is an attempt to use the by-products of nested cpr analysis.
      7e6bb343
    • Joachim Breitner's avatar
    • Joachim Breitner's avatar
      Try to make "<S>t" meaningful · b794662d
      Joachim Breitner authored
      by giving it the meaning: "Assuming my first argument is terminating,
      then I am terminating".
      
      In pictures: This is the lattice, which is not a simple product lattice any more:
      
             ------ <L><L>------
           /          | \       \
          /           | <L><L>t  \
      <S><L>          |           <S><L>
       |  \ \         |           |  |  \
       |   \ <S><L>t  |          /   |   <S><L>t
       |    \         |         /    |
       \     \        |        /     |
        \     ----- <S><S>-----      |
         \           |    \          |
          \          |     <S><S>t   /
           \         |              /
            ---------⊥-------------/
      
      This means that we need to be careful when lub’ing: If one branch is lazy, but
      not absent in an argument or free variable, and the other branch is strict,
      then even if both branches claim to terminate, we need to remove the
      termination flag (as one had the termination under a stronger hypothesis as the
      hole result) (Feels inelegant.)
      
      There is no unit for lubDmdType any more. So for case, use we use botDmdType
      for no alternatives, and foldr1 if there are multiple.
      
      Unlifted variables (e.g. Int#) are tricky. Everything is strict in them, so for
      an *unlifted* argument, <L>t implies <S>t and hence <S>t ⊔ <L>t = <S>t, and we
      really want to make use of that stronger equation. But when lub’ing, we don’t
      know any more if this is the demand for an unlifted type. So instead, the
      demand type of x :: Int# itself is {x ↦ <L>} t, while x :: Int continues to
      have type {x ↦ <S>} t.
      
      It is important that functions (including primitive operations and constructors
      like I#) have a strict demand on their unlifted argument. But it turned out to
      be easier to enforce this in the demand analyser: So even if f claims to have a
      lazy demand on a argument of unlifted type, we make this demand strict before
      feeding it into the argument.
      b794662d
  2. Dec 16, 2013
  3. Dec 12, 2013
    • 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 and Joachim Breitner's avatar Joachim Breitner committed
      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
      Guarding against silly shifts · 869f69fd
      Simon Peyton Jones authored and Joachim Breitner's avatar Joachim Breitner committed
      This patch was authored by SPJ and extracted from "Improve the handling
      of used-once stuff" by Joachim.
      869f69fd
    • Simon Peyton Jones's avatar
      Assign strictness signatures to primitive operations · 0558911f
      Simon Peyton Jones authored and Joachim Breitner's avatar Joachim Breitner committed
      This patch was authored by SPJ, and extracted from "Improve the handling
      of used-once stuff" by Joachim.
      0558911f
    • Simon Peyton Jones's avatar
      Do not split void functions · ba78bf17
      Simon Peyton Jones authored and Joachim Breitner's avatar Joachim Breitner committed
      This is authored by SPJ, and split out out "Improve the handling of
      used-once stuff" by Joachim.
      ba78bf17
    • Simon Peyton Jones's avatar
      Some refactoring of Demand and DmdAnal · 838da6fc
      Simon Peyton Jones authored and Joachim Breitner's avatar Joachim Breitner committed
      This was authored by SPJ and extracted from the "Improve the handling of
      used-once stuff" patch by Joachim.
      838da6fc
  4. Dec 10, 2013
  5. Dec 09, 2013
  6. Dec 05, 2013
Loading