1. 14 Apr, 2006 2 commits
  2. 12 Apr, 2006 3 commits
    • simonpj@microsoft.com's avatar
      Cosmetics in SpecConstr · 48967672
      simonpj@microsoft.com authored
      SpecConstr currently uses substExpr for tiresome reasons to do with
      GADTs.  Unfortunately the substExpr generates some WARNINGS (when DEBUG)
      is on, because we aren't adding all the in-scope Ids to the in-scope
      set of the substitution.
      
      When we move to FC these substExprs will go away, so I'm not going to
      worry about this now.
      48967672
    • simonpj@microsoft.com's avatar
      Improve pruning of case alternatives to account for GADTs · 2763f56d
      simonpj@microsoft.com authored
      Consider
      
        data T a where
          T1 :: T Int
          T2 :: T Bool
          T3 :: T Char
      
        f :: T Bool -> Int
        f x = case x of
      	  DEFAULT -> ...
      	  T2 -> 3
      
      Here the DEFAULT case covers multiple constructors (T1,T3), but none 
      of them can match a scrutinee of type (T Bool).  So we can prune away
      the default case altogether.
      
      In implementing this, I re-factored this bit of the simplifier, elminiating
      prepareAlts from SimplUtils, and putting all the work into simplAlts in
      Simplify
      
      The proximate cause was a program written by Manuel using PArrays
      2763f56d
    • Simon Marlow's avatar
      Fix a bug in optimising division to shift right · 91a9aeeb
      Simon Marlow authored
      Division by an integral log2 can't be directly optimised to a shift
      right, because shift right behaves like a division that rounds to
      negative infinity, whereas we want one that rounds to zero.  Fix this
      by adding (divisor-1) to the dividend when it is negative before
      shifting.  We do this without jumps, generating very slightly worse
      code than gcc, which uses conditional moves on CPUs that support it.
      91a9aeeb
  3. 11 Apr, 2006 3 commits
  4. 02 Apr, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Improve newtype deriving · aa2c486e
      simonpj@microsoft.com authored
      Ross Paterson pointed out a useful generalisation of GHC's 
      newtype-deriving mechanism.  This implements it.  The idea
      is to allow
      	newtype Wrap m a = Wrap (m a) deriving (Monad, Eq)
      where the representation type doesn't start with a type
      constructor.
      
      Actually GHC already *did* implement this, but the eta-ok
      check in TcDeriv missed a case, so there was a lurking bug.
      
      This patches fixes the documentation too.  drvrun019 tests.
      
      aa2c486e
  5. 11 Apr, 2006 2 commits
  6. 10 Apr, 2006 2 commits
  7. 07 Apr, 2006 8 commits
  8. 21 Jan, 2006 2 commits
  9. 06 Apr, 2006 5 commits
  10. 05 Apr, 2006 3 commits
  11. 30 Mar, 2006 3 commits
  12. 29 Mar, 2006 3 commits
  13. 23 Mar, 2006 1 commit
  14. 28 Mar, 2006 1 commit
  15. 27 Mar, 2006 1 commit
    • Simon Marlow's avatar
      Add a new primitive forkOn#, for forking a thread on a specific Capability · c520a3a2
      Simon Marlow authored
      This gives some control over affinity, while we figure out the best
      way to automatically schedule threads to make best use of the
      available parallelism.
      
      In addition to the primitive, there is also:
       
        GHC.Conc.forkOnIO :: Int -> IO () -> IO ThreadId
      
      where 'forkOnIO i m' creates a thread on Capability (i `rem` N), where
      N is the number of available Capabilities set by +RTS -N.
      
      Threads forked by forkOnIO do not automatically migrate when there are
      free Capabilities, like normal threads do.  Still, if you're using
      forkOnIO exclusively, it's a good idea to do +RTS -qm to disable work
      pushing anyway (work pushing takes too much time when the run queues
      are large, this is something we need to fix).
      c520a3a2