1. 22 Jan, 2018 1 commit
    • Oleg Grenrus's avatar
      Update Cabal submodule · 2671cccd
      Oleg Grenrus authored
      - Cabal-2.2 uses SPDX license identifiers, so I had to update
        `cabal-version: 2.1` packages `license: BSD3` to `license: BSD-3-Clause`
      - `ghc-cabal` used old ReadP parsec, now it uses `parsec` too
      - InstalledPackageInfo pretty-printing have changed a little,
        fields with default values aren't printed. This can be changed in
        `Cabal` still, but I haven't found problems with omitting them.
      
      Note: `BSD-3-Clause` is parsed as "name = BSD, version = 3" by old
      parser (because 3-Clause looks like version 3 with tag Clause).
      If you see *"BSD-3" is not a valid license*, then something is using
      old parser still.
      
      Fixes #9885.
      2671cccd
  2. 21 Jan, 2018 8 commits
    • Ben Gamari's avatar
      SysTools: Add detection support for LLD linker · 6c0db98b
      Ben Gamari authored
      I noticed while trying to test against LLVM 5.0 that GHC would throw "Couldn't
      figure out linker information" warnings due to LLD being chosen by configure.
      Adding detection support to silence these is simple enough, let's just do it.
      6c0db98b
    • niteria's avatar
      Use IntSet in Dataflow · 88297438
      niteria authored
      Before this change, a list was used as a substitute for a heap.
      This led to quadratic behavior on a simple program (see new
      test case).
      
      This change replaces it with IntSet in effect reverting
      5a1a2633. @simonmar said it's fine to revert as long as nofib
      results are good.
      
      Test Plan:
      new test case:
      
      20% improvement
      3x improvement when N=10000
      
      nofib:
      
      I run it twice for before and after because the compile time
      results are noisy.
      
      - Compile Allocations:
      
      ```
                before    before re-run    after     after re-run
      -1 s.d.   -----     -0.0%            -0.1%     -0.1%
      +1 s.d.   -----     +0.0%            +0.1%     +0.1%
      Average   -----     +0.0%            -0.0%     -0.0%
      ```
      - Compile Time:
      
      ```
                before    before re-run    after     after re-run
      -1 s.d.   -----     -0.1%            -2.3%     -2.6%
      +1 s.d.   -----     +5.2%            +3.7%     +4.4%
      Average   -----     +2.5%            +0.7%     +0.8%
      
      ```
      I checked each case and couldn't find consistent slow-down/speed-up on
      compile time. Full results here: P173
      
      Reviewers: simonpj, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter, simonmar
      
      GHC Trac Issues: #14667
      
      Differential Revision: https://phabricator.haskell.org/D4329
      88297438
    • Takenobu Tani's avatar
      Implement underscores in numeric literals (NumericUnderscores extension) · 4a13c5b1
      Takenobu Tani authored
      Implement the proposal of underscores in numeric literals.
      Underscores in numeric literals are simply ignored.
      
      The specification of the feature is available here:
      https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/000
      9-numeric-underscores.rst
      
      For a discussion of the various choices:
      https://github.com/ghc-proposals/ghc-proposals/pull/76
      
      Implementation detail:
      
      * Added dynamic flag
        * `NumericUnderscores` extension flag is added for this feature.
      
      * Alex "Regular expression macros" in Lexer.x
        * Add `@numspc` (numeric spacer) macro to represent multiple
          underscores.
        * Modify `@decimal`, `@decimal`, `@binary`, `@octal`, `@hexadecimal`,
          `@exponent`, and `@bin_exponent` macros to include `@numspc`.
      
      * Alex "Rules" in Lexer.x
        * To be simpler, we have only the definitions with underscores.
          And then we have a separate function (`tok_integral` and `tok_frac`)
          that validates the literals.
      
      * Validation functions in Lexer.x
        * `tok_integral` and `tok_frac` functions validate
          whether contain underscores or not.
          If `NumericUnderscores` extensions are not enabled,
          check that there are no underscores.
        * `tok_frac` function is created by merging `strtoken` and
          `init_strtoken`.
        * `init_strtoken` is deleted. Because it is no longer used.
      
      * Remove underscores from target literal string
        * `parseUnsignedInteger`, `readRational__`, and `readHexRational} use
          the customized `span'` function to remove underscores.
      
      * Added Testcase
        * testcase for NumericUnderscores enabled.
            NumericUnderscores0.hs and NumericUnderscores1.hs
        * testcase for NumericUnderscores disabled.
            NoNumericUnderscores0.hs and NoNumericUnderscores1.hs
        * testcase to invalid pattern for NumericUnderscores enabled.
            NumericUnderscoresFail0.hs and NumericUnderscoresFail1.hs
      
      Test Plan: `validate` including the above testcase
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: carter, rwbarton, thomie
      
      GHC Trac Issues: #14473
      
      Differential Revision: https://phabricator.haskell.org/D4235
      4a13c5b1
    • Douglas Wilson's avatar
      [rts] Adjust whitehole_spin · 180ca65f
      Douglas Wilson authored
      Rename to whitehole_gc_spin, in preparation for adding stats for the
      whitehole busy-loop in SMPClosureOps.
      
      Make whitehole_gc_spin volatile, and move it to be defined and
      statically initialised in GC.c. This saves some #ifs, and I'm pretty
      sure it should be volatile.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4300
      180ca65f
    • Alp Mestanogullari's avatar
      tentative improvement to callstack docs · 5edb18a9
      Alp Mestanogullari authored
      This is an attempt at clarifying the docs for HasCallStack in both the
      user guide and libraries/base/GHC/Stack/Types.hs. The example used right
      now is built around an hypothetical 'error' function that doesn't itself
      print call stacks, and the fact that this doesn't hold makes it all
      confusing, see #14635.
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14635
      
      Differential Revision: https://phabricator.haskell.org/D4317
      5edb18a9
    • Ryan Scott's avatar
      Fix #14692 by correcting an off-by-one error in TcGenDeriv · 0074a08e
      Ryan Scott authored
      A silly mistake in `gen_Show_binds` was causing derived
      `Show` instances for empty data types to case on the precedence
      argument instead of the actual value being showed.
      
      Test Plan: make test TEST=drv-empty-data
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14692
      
      Differential Revision: https://phabricator.haskell.org/D4328
      0074a08e
    • Ben Gamari's avatar
      testsuite: Add testcase for #14670 · 765ba657
      Ben Gamari authored
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14670
      
      Differential Revision: https://phabricator.haskell.org/D4314
      765ba657
    • John Ky's avatar
      Add new mbmi and mbmi2 compiler flags · f8557696
      John Ky authored
      This adds support for the bit deposit and extraction operations provided
      by the BMI and BMI2 instruction set extensions on modern amd64 machines.
      
      Implement x86 code generator for pdep and pext.  Properly initialise
      bmiVersion field.
      
      pdep and pext test cases
      
      Fix pattern match for pdep and pext instructions
      
      Fix build of pdep and pext code for 32-bit architectures
      
      Test Plan: Validate
      
      Reviewers: austin, simonmar, bgamari, angerman
      
      Reviewed By: bgamari
      
      Subscribers: trommler, carter, angerman, thomie, rwbarton, newhoggy
      
      GHC Trac Issues: #14206
      
      Differential Revision: https://phabricator.haskell.org/D4236
      f8557696
  3. 18 Jan, 2018 8 commits
  4. 17 Jan, 2018 1 commit
  5. 15 Jan, 2018 14 commits
  6. 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
  7. 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
  8. 09 Jan, 2018 3 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