1. 27 May, 2016 1 commit
    • Ömer Sinan Ağacan's avatar
      StgCmmCon: Do not generate moves from unused fields to local variables · cd50d236
      Ömer Sinan Ağacan authored
      Say we have a record like this:
      
          data Rec = Rec
            { f1 :: Int
            , f2 :: Int
            , f3 :: Int
            , f4 :: Int
            , f5 :: Int
            }
      
      Before this patch, the code generated for `f1` looked like this:
      
          f1_entry()
              {offset
                 ...
                 cJT:
                     _sI6::P64 = R1;
                     _sI7::P64 = P64[_sI6::P64 + 7];
                     _sI8::P64 = P64[_sI6::P64 + 15];
                     _sI9::P64 = P64[_sI6::P64 + 23];
                     _sIa::P64 = P64[_sI6::P64 + 31];
                     _sIb::P64 = P64[_sI6::P64 + 39];
                     R1 = _sI7::P64 & (-8);
                     Sp = Sp + 8;
                     call (I64[R1])(R1) args: 8, res: 0, upd: 8;
              }
      
      Note how all fields of the record are moved to local variables, even though
      they're never used. These moves make it to the final assembly:
      
          f1_info:
              ...
          _cJT:
              movq 7(%rbx),%rax
              movq 15(%rbx),%rcx
              movq 23(%rbx),%rcx
              movq 31(%rbx),%rcx
              movq 39(%rbx),%rbx
              movq %rax,%rbx
              andq $-8,%rbx
              addq $8,%rbp
              jmp *(%rbx)
      
      With this patch we stop generating these move instructions. Cmm becomes this:
      
          f1_entry()
              {offset
                 ...
                 cJT:
                     _sI6::P64 = R1;
                     _sI7::P64 = P64[_sI6::P64 + 7];
                     R1 = _sI7::P64 & (-8);
                     Sp = Sp + 8;
                     call (I64[R1])(R1) args: 8, res: 0, upd: 8;
              }
      
      Assembly becomes this:
      
          f1_info:
              ...
          _cJT:
              movq 7(%rbx),%rax
              movq %rax,%rbx
              andq $-8,%rbx
              addq $8,%rbp
              jmp *(%rbx)
      
      It turns out CmmSink already optimizes this, but it's better to generate
      better code in the first place.
      
      Reviewers: simonmar, simonpj, austin, bgamari
      
      Reviewed By: simonmar, simonpj
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2269
      cd50d236
  2. 26 May, 2016 4 commits
    • Ömer Sinan Ağacan's avatar
      Coverage.hs: Fix a duplication · 5b145c98
      Ömer Sinan Ağacan authored
      5b145c98
    • Ömer Sinan Ağacan's avatar
      StgCmmExpr: Fix a duplication · 5b8bec25
      Ömer Sinan Ağacan authored
      5b8bec25
    • Simon Peyton Jones's avatar
      Reduce special-casing for nullary unboxed tuple · e9e61f18
      Simon Peyton Jones authored
      When we built the kind of a nullary unboxed tuple, we said, in
      TysWiredIn.mk_tuple:
      
          res_rep | arity == 0 = voidRepDataConTy
                        -- See Note [Nullary unboxed tuple] in Type
                  | otherwise  = unboxedTupleRepDataConTy
      
      But this is bogus.  The Note deals with what the 'unarise' transformation
      does, and up to that point it's simpler and more uniform to treat
      nullary unboxed tuples the same as all the others.
      
      Nicer now.  And it fixes the Lint error in Trac #12115
      e9e61f18
    • Simon Peyton Jones's avatar
      Fix bytecode gen to deal with rep-polymorphism · 0f1e315b
      Simon Peyton Jones authored
      When faced runtime-rep-polymorphic code from a pattern-synonym
      matcher, the bytecode generator was treating the result as lifted,
      which it isn't.  The fix is just to treat those rep-polymorphic
      continuations like unlifted types, and add a dummy arg.
      
      Trac #12007 is a case in point.
      0f1e315b
  3. 25 May, 2016 7 commits
  4. 24 May, 2016 16 commits
  5. 23 May, 2016 4 commits
  6. 22 May, 2016 5 commits
  7. 21 May, 2016 3 commits
    • Andrew Farmer's avatar
      Fix deriving Ord when RebindableSyntax is enabled · 527ed724
      Andrew Farmer authored
      Deriving clauses (Ord especially) generated if-expressions with nlHsIf
      which were subject to RebindableSyntax. This changes nlHsIf to generate
      concrete if-expressions.
      
      There was also an error about calling tagToEnum# at a polymorphic type,
      which is not allowed. Fixing nlHsIf didn't fix this for some reason, so
      I generated a type ascription around the call to tagToEnum#. Not sure
      why the typechecker could not figure this out.
      
      Test Plan: Added a test, ran validate.
      
      Reviewers: simonpj, simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2247
      
      GHC Trac Issues: #12080
      527ed724
    • Simon Marlow's avatar
      Enable checkProddableBlock on x86_64 · da3c1ebb
      Simon Marlow authored
      We've been seeing some memory corruption after using the linker, and I
      want to enable this to see if it catches anything.
      
      Test Plan:
      * validate
      * modified the linker_unload test to remove the performGC calls to use
        as a benchmark, saw no significant difference after this change.
      
      Reviewers: bgamari, erikd, austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2245
      da3c1ebb
    • Ben Gamari's avatar
      users-guide: Fix index in PDF output · cf1efc7f
      Ben Gamari authored
      The madness that is latex never ceases to amaze.
      cf1efc7f