Skip to content
  • Simon Peyton Jones's avatar
    Join-point refactoring · 71037b61
    Simon Peyton Jones authored
    This commit has a raft of refactorings that improve the treatment
    of join points.  I wasn't aiming so much as to gain performance as
    to make the code simpler.
    
    The two big things are these:
    
    * Make mkDupableCont work for SimplBind as well.  This is simpler than
      I thought and quite neat.  (Luke had aready done StrictArg.)  That's
      a win in its own right. But also now /all/ continuations can be made
      dup-able
    
    * Now that all continuations can be made dup-able, I could simplify
      mkDupableCont to return just one SimplCont, instead of two.
      That really is a worthwhile simlification!  Much easier to think
      about.
    
    Plus a bunch of smaller things:
    
    * Remove the join-arity that had been added to seIdSubst.
      It can be done more simply by putting it in DoneEx, which
      is the only constructor that actually needs it, and now we
      don't need the unsavoury isJoinIdInEnv_maybe.
    
    * Re-order the handling of join points in Simplify, so that we don't need
      the horrible resultTypeOfDupableCont
    
    * Add field names for StrictBind, StrictArg; and use them
    
    * Define simplMonad.newJoinId, and use it
    
    * Rename the seFloats field of SimplEnv to seLetFloats
    
    Binary sizes seem to go up slightly, but allocations generally
    improve, sometimes significantly.  I don't believe the runtime numbers
    are reliable enough to draw any conclusions about
    
    --------------------------------------------------------------------------------
            Program           Size    Allocs   Runtime   Elapsed  TotalMem
    --------------------------------------------------------------------------------
              event          +1.1%    -12.0%     -0.2%     -0.2%     -8.7%
             fulsom          +1.9%    -11.8%    -10.0%    -10.0%     +5.3%
         last-piece          +2.3%     -1.2%     -1.2%     -1.2%     +0.0%
               mate          +0.9%     -1.4%     -0.6%     -0.7%     +0.0%
         multiplier          +1.5%     -8.3%      0.17      0.17     +0.0%
             parser          +2.0%     +1.0%      0.04      0.04     +0.0%
            parstof          +1.5%     +0.7%      0.01      0.01     +0.0%
              sched          +1.3%     -6.1%      0.03      0.03     +0.0%
             simple          +1.8%     +1.0%     +9.7%     +9.6%     +0.0%
    --------------------------------------------------------------------------------
                Min          +0.5%    -12.0%    -10.0%    -10.0%     -8.7%
                Max          +3.0%     +1.0%    +14.2%    +14.2%    +50.0%
     Geometric Mean          +1.4%     -0.4%     +0.3%     +0.4%     +0.5%
    
    There's also a tests/perf/compiler improvement of 20% allocation in
    T6048.  I think it's because we now generate smaller code.
    71037b61