1. 15 Jan, 2018 9 commits
  2. 12 Jan, 2018 3 commits
    • Alec Theriault's avatar
      Support constructor Haddocks in more places · e20046a0
      Alec Theriault authored
      This adds support for adding Haddocks on individual non-record fields
      of regular (and GADT) constructors. The following now parses just fine
      with `-haddock` enabled:
      
      data Foo
        = Baz             -- ^ doc on the `Baz` constructor
            Int           -- ^ doc on the `Int` field of `Baz`
            String        -- ^ doc on the `String` field of `Baz`
      
        | Int             -- ^ doc on the `Int` field of the `:*` constructor
            :*            -- ^ doc on the `:*` constructor
          String          -- ^ doc on the `String` field of the `:*`
      constructor
      
        | Boa             -- ^ doc on the `Boa` record constructor
            { y :: () }
      
      The change is backwards compatible: if there is only one doc and it
      occurs
      on the last field, it is lifted to apply to the whole constructor (as
      before).
      
      Reviewers: bgamari, alanz
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      Differential Revision: https://phabricator.haskell.org/D4292
      e20046a0
    • Ben Gamari's avatar
      Fix mistaken merge · b2f10d89
      Ben Gamari authored
      When merging D4259 I had to resort to manual merge due to some conflicts that
      arc couldn't sort out. Unfortunately in the process I merged the wrong version
      of the patch. Fix this. Thanks to @ntc2 for the great documentation and noticing
      my mistake.
      b2f10d89
    • Matthias Treydte's avatar
      KQueue: Fix write notification requests being ignored... · 6c3eafb3
      Matthias Treydte authored
      when read notifications are requested, too (#13903)
      Signed-off-by: default avatarMatthias Treydte <mt@waldheinz.de>
      
      KQueue: Drop Bits/FiniteBits instances for Filter as they are really
      constants whose bits should not be fiddled with
      Signed-off-by: default avatarMatthias Treydte <mt@waldheinz.de>
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: gridaphobe, kazu_yamamoto, rwbarton, thomie
      
      GHC Trac Issues: #13903
      
      Differential Revision: https://phabricator.haskell.org/D3692
      6c3eafb3
  3. 10 Jan, 2018 2 commits
    • Simon Peyton Jones's avatar
      Fix previous patch · f3f90a07
      Simon Peyton Jones authored
      This recent patch
          commit 1577908f
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Tue Jan 9 16:20:46 2018 +0000
      
              Fix two more bugs in partial signatures
      
              These were shown up by Trac #14643
      
      failed validation for typecheck/should_run/T10846
      (Reported in Trac #14658.)
      
      The fix is simple.
      f3f90a07
    • niteria's avatar
      Lift constructor tag allocation out of a loop · dbdf77d9
      niteria authored
      Before this change, for each constructor that we want
      to allocate a tag for we would traverse a list of all
      the constructors in a datatype to determine which tag
      a constructor should get.
      
      This is obviously quadratic and for datatypes with 10k
      constructors it actually makes a big difference.
      
      This change implements the plan outlined by @simonpj in
      https://mail.haskell.org/pipermail/ghc-devs/2017-October/014974.html
      which is basically about using a map and constructing it outside the
      loop.
      
      One place where things got a bit awkward was TysWiredIn.hs,
      it would have been possible to just assign the tags by hand, but
      that seemed error-prone to me, so I decided to go through a map
      there as well.
      
      Test Plan:
      ./validate
      On a file with 10k constructors
      Before:
         8,130,522,344 bytes allocated in the heap
        Total   time    3.682s  (  3.920s elapsed)
      After:
         4,133,478,744 bytes allocated in the heap
        Total   time    2.509s  (  2.750s elapsed)
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: goldfire, rwbarton, thomie, simonmar, carter, simonpj
      
      GHC Trac Issues: #14657
      
      Differential Revision: https://phabricator.haskell.org/D4289
      dbdf77d9
  4. 09 Jan, 2018 5 commits
    • Simon Peyton Jones's avatar
      Fix two more bugs in partial signatures · 1577908f
      Simon Peyton Jones authored
      These were shown up by Trac #14643
      
      Bug 1: if we had a single partial signature for
      two functions
         f, g :: forall a. _ -> a
      then we made two different SigTvs but with the sane Name.
      This was jolly confusing and ultimately led to deeply bogus
      results with Any's appearing in the resulting program. Yikes.
      Fix: clone the quantified variables in TcSigs.tcInstSig (as
      indeed its name suggests).
      
      Bug 2: we were not eliminating duplicate/superclass constraints
      in the partial signatures of a mutually recursive group.
      
      Easy to fix: we are already doing dup/superclass elim in
      TcSimplify.decideQuantification.  So we move the partial-sig
      constraints there too.
      1577908f
    • Simon Peyton Jones's avatar
      Small local refactoring · 448685c3
      Simon Peyton Jones authored
      448685c3
    • Simon Peyton Jones's avatar
      preInlineUnconditionally is ok for INLINEABLE · 1c1e46c1
      Simon Peyton Jones authored
      When debugging Trac #14650, I found a place where we had
      
          let {-# INLINEABLE f #-}
              f = BIG
          in f 7
      
      but 'f' wasn't getting inlined at its unique call site.
      There's a good reason for that with INLINE things, which
      should only inline when saturated, but not  for INILNEABLE
      things.
      
      This patch narrows the case where preInlineUnconditionally
      gives up.  It significantly shortens (and improves) the code
      for #14650.
      1c1e46c1
    • Simon Peyton Jones's avatar
      Fix join-point decision · 66ff794f
      Simon Peyton Jones authored
      This patch moves the "ok_unfolding" test
         from  CoreOpt.joinPointBinding_maybe
         to    OccurAnal.decideJoinPointHood
      
      Previously the occurrence analyser was deciding to make
      something a join point, but the simplifier was reversing
      that decision, which made the decision about /other/ bindings
      invalid.
      
      Fixes Trac #14650.
      66ff794f
    • Simon Peyton Jones's avatar
      Remove a bogus warning · 30b1fe2f
      Simon Peyton Jones authored
      The new comment explains why this warning can
      legitimately fire, so I've removed it entirely.
      Lint will cath any bad cases.
      30b1fe2f
  5. 08 Jan, 2018 2 commits
    • Christiaan Baaij's avatar
      Export typeNat{Div;Mod;Log}TyCon from TcTypeNats · fb78b0d2
      Christiaan Baaij authored
      Summary: To be in line with the other typeNatTyCons
      
      Reviewers: bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, thomie, carter
      
      GHC Trac Issues: #14632
      
      Differential Revision: https://phabricator.haskell.org/D4284
      fb78b0d2
    • Simon Marlow's avatar
      Improve accuracy of get/setAllocationCounter · a1a689dd
      Simon Marlow authored
      Summary:
      get/setAllocationCounter didn't take into account allocations in the
      current block. This was known at the time, but it turns out to be
      important to have more accuracy when using these in a fine-grained
      way.
      
      Test Plan:
      New unit test to test incrementally larger allocaitons.  Before I got
      results like this:
      
      ```
      +0
      +0
      +0
      +0
      +0
      +4096
      +0
      +0
      +0
      +0
      +0
      +4064
      +0
      +0
      +4088
      +4056
      +0
      +0
      +0
      +4088
      +4096
      +4056
      +4096
      ```
      
      Notice how the results aren't always monotonically increasing.  After
      this patch:
      
      ```
      +344
      +416
      +488
      +560
      +632
      +704
      +776
      +848
      +920
      +992
      +1064
      +1136
      +1208
      +1280
      +1352
      +1424
      +1496
      +1568
      +1640
      +1712
      +1784
      +1856
      +1928
      +2000
      +2072
      +2144
      ```
      
      Reviewers: niteria, bgamari, hvr, erikd
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4288
      a1a689dd
  6. 07 Jan, 2018 1 commit
    • Ryan Scott's avatar
      Make the Div and Mod type families `infixl 7` · 303106d5
      Ryan Scott authored
      Commit fa8035e3 added `Div`
      and `Mod` type families to `GHC.TypeNats`. However, they did not add
      the corresponding fixities! Currently, we have that both `div` and
      `mod` (at the value level) are `infixl 7`, so we should adopt the
      same fixities for the type-level `Div` and `Mod` as well.
      
      Test Plan: It compiles
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14640
      
      Differential Revision: https://phabricator.haskell.org/D4291
      303106d5
  7. 05 Jan, 2018 2 commits
  8. 04 Jan, 2018 6 commits
    • Simon Peyton Jones's avatar
      Fix deep, dark corner of pattern synonyms · 307d1dfe
      Simon Peyton Jones authored
      Trac #14552 showed a very obscure case where we can't infer a
      good pattern-synonym type.
      
      The error message is horrible, but at least we no longer crash
      and burn.
      307d1dfe
    • Simon Peyton Jones's avatar
      comments only · 86ea3b1e
      Simon Peyton Jones authored
      86ea3b1e
    • Simon Peyton Jones's avatar
      Stop double-stacktrace in ASSERT failures · e2998d72
      Simon Peyton Jones authored
      We were getting the stack trace printed twice in assertion
      failures (e.g. see the Description of Trac #14552).
      
      This fixes it, by deleting code.
      
      (c.f. Trac #14635 which reports the same bug in documentation).
      e2998d72
    • Simon Peyton Jones's avatar
      Drop dead Given bindings in setImplicationStatus · 954cbc7c
      Simon Peyton Jones authored
      Trac #13032 pointed out that we sometimes generate unused
      bindings for Givens, and (worse still) we can't always discard
      them later (we don't drop a case binding unless we can prove
      that the scrutinee is non-bottom.
      
      It looks as if this may be a major reason for the performace
      problems in #14338 (see comment:29).
      
      This patch fixes the problem at source, by pruning away all the
      dead Givens.  See Note [Delete dead Given evidence bindings]
      
      Remarkably, compiler allocation falls by 23% in
      perf/compiler/T12227!
      
      I have not confirmed whether this change actualy helps with
      954cbc7c
    • niteria's avatar
      Cache the number of data cons in DataTyCon and SumTyCon · 6c348244
      niteria authored
      This is a follow-up after faf60e85 - Make tagForCon non-linear.
      On the mailing list @simonpj suggested to solve the
      linear behavior by caching the sizes.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, simonmar, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: carter, goldfire, rwbarton, thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D4131
      6c348244
    • Ryan Scott's avatar
      Make typeToLHsType produce kind signatures for tycon applications · 649e7772
      Ryan Scott authored
      Summary:
      `GeneralizedNewtypeDeriving` generates calls to `coerce`
      which take visible type arguments. These types must be produced by
      way of `typeToLHsType`, which converts a `Type` to an `LHsType`.
      However, `typeToLHsType` was leaving off important kind information
      when a `Type` contained a poly-kinded tycon application, leading to
      incorrectly generated code in #14579.
      
      This fixes the issue by tweaking `typeToLHsType` to generate
      explicit kind signatures for tycon applications. This makes the
      generated code noisier, but at least the program from #14579 now
      works correctly.
      
      Test Plan: make test TEST=T14579
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14579
      
      Differential Revision: https://phabricator.haskell.org/D4264
      649e7772
  9. 03 Jan, 2018 10 commits