1. 21 Aug, 2018 2 commits
  2. 16 Aug, 2018 1 commit
  3. 15 Aug, 2018 1 commit
  4. 25 Jul, 2018 1 commit
    • Simon Peyton Jones's avatar
      Fix PrelRules.caseRules to account for out-of-range tags · 9897f678
      Simon Peyton Jones authored
      As Trac #15436 points out, it is possible to get
         case dataToTag# (x :: T) of
            DEFAULT -> blah1
            -1#     -> blah2
            0       -> blah3
      
      The (-1#) alterantive is unreachable, because dataToTag# returns
      tags in the range [0..n-1] where n is the number of data constructors
      in type T.
      
      This actually made GHC crash; now we simply discard the unreachable
      alterantive.  See Note [Unreachable caseRules alternatives]
      in PrelRules
      9897f678
  5. 16 Jul, 2018 1 commit
    • Masahiro Sakai's avatar
      Fix hash in haddock of ghc-prim. · 28199a21
      Masahiro Sakai authored
      Some hash signs in documents in primops.txt.pp were not escaped
      properly. Those raw hash signs were kept in haddock and texts
      between those hash signs were interpreted as anchors by haddock.
      28199a21
  6. 15 Jul, 2018 1 commit
  7. 02 Jun, 2018 1 commit
  8. 31 May, 2018 1 commit
  9. 20 May, 2018 1 commit
    • patrickdoc's avatar
      Add HeapView functionality · ec22f7dd
      patrickdoc authored
      This pulls parts of Joachim Breitner's ghc-heap-view library inside GHC.
      The bits added are the C hooks into the RTS and a basic Haskell wrapper
      to these C hooks. The main reason for these to be added to GHC proper
      is that the code needs to be kept in sync with the closure types
      defined by the RTS. It is expected that the version of HeapView shipped
      with GHC will always work with that version of GHC and that extra
      functionality can be layered on top with a library like ghc-heap-view
      distributed via Hackage.
      
      Test Plan: validate
      
      Reviewers: simonmar, hvr, nomeata, austin, Phyx, bgamari, erikd
      
      Reviewed By: bgamari
      
      Subscribers: carter, patrickdoc, tmcgilchrist, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3055
      ec22f7dd
  10. 05 May, 2018 1 commit
    • Sebastian Graf's avatar
      Add 'addWordC#' PrimOp · 6243bba7
      Sebastian Graf authored
      This is mostly for congruence with 'subWordC#' and '{add,sub}IntC#'.
      I found 'plusWord2#' while implementing this, which both lacks
      documentation and has a slightly different specification than
      'addWordC#', which means the generic implementation is unnecessarily
      complex.
      
      While I was at it, I also added lacking meta-information on PrimOps
      and refactored 'subWordC#'s generic implementation to be branchless.
      
      Reviewers: bgamari, simonmar, jrtc27, dfeuer
      
      Reviewed By: bgamari, dfeuer
      
      Subscribers: dfeuer, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4592
      6243bba7
  11. 13 Apr, 2018 1 commit
    • Ben Gamari's avatar
      Declare `catchRetry#` lazy in its first argument · 00b8ecb7
      Ben Gamari authored
      As per the results on item 1 in T14998, declaring `catchRetry#` lazy in
      its first argument opens the possibility to remove `ExnStr` complexity
      from strictness demands at virtually no regressions in NoFib.
      
      This brings `catchRetry#` in line with other primops from the `catch*`
      family.
      
      Reviewers: bgamari, simonpj, nomeata
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #14998, #11222
      
      Differential Revision: https://phabricator.haskell.org/D4573
      00b8ecb7
  12. 26 Mar, 2018 1 commit
  13. 20 Mar, 2018 1 commit
  14. 19 Mar, 2018 1 commit
    • Ben Gamari's avatar
      Improve accuracy of get/setAllocationCounter · 20cbb016
      Ben Gamari 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: hvr, erikd, simonmar, jrtc27, trommler
      
      Reviewed By: simonmar
      
      Subscribers: trommler, jrtc27, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4363
      20cbb016
  15. 18 Feb, 2018 1 commit
  16. 21 Jan, 2018 1 commit
    • 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
  17. 18 Jan, 2018 1 commit
  18. 15 Jan, 2018 1 commit
  19. 08 Jan, 2018 1 commit
    • 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
  20. 28 Dec, 2017 1 commit
  21. 19 Dec, 2017 1 commit
  22. 22 Nov, 2017 1 commit
  23. 21 Nov, 2017 1 commit
  24. 15 Nov, 2017 1 commit
    • John Ky's avatar
      Add new mbmi and mbmi2 compiler flags · f5dc8ccc
      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.
      
      Test Plan: Validate
      
      Reviewers: austin, simonmar, bgamari, hvr, goldfire, erikd
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, erikd, trommler, newhoggy, rwbarton, thomie
      
      GHC Trac Issues: #14206
      
      Differential Revision: https://phabricator.haskell.org/D4063
      f5dc8ccc
  25. 30 Oct, 2017 1 commit
  26. 16 Oct, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      Implement new `compareByteArrays#` primop · e3ba26f8
      Herbert Valerio Riedel authored
      The new primop
      
          compareByteArrays# :: ByteArray# -> Int# {- offset -}
                             -> ByteArray# -> Int# {- offset -}
                             -> Int# {- length -}
                             -> Int#
      
      allows to compare the subrange of the first `ByteArray#` to
      the (same-length) subrange of the second `ByteArray#` and returns a
      value less than, equal to, or greater than zero if the range is found,
      respectively, to be byte-wise lexicographically less than, to match,
      or be greater than the second range.
      
      Under the hood, the new primop is implemented in terms of the standard
      ISO C `memcmp(3)` function. It is currently an out-of-line primop but
      work is underway to optimise this into an inline primop for a future
      follow-up Differential (see D4091).
      
      This primop has applications in packages like `text`, `text-short`,
      `bytestring`, `text-containers`, `primitive`, etc.  which currently
      have to incur the overhead of an ordinary FFI call to directly or
      indirectly invoke `memcmp(3)` as well has having to deal with some
      `unsafePerformIO`-variant.
      
      While at it, this also improves the documentation for the existing
      `copyByteArray#` primitive which has a non-trivial type-signature
      that significantly benefits from a more explicit description of its
      arguments.
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D4090
      e3ba26f8
  27. 27 Sep, 2017 1 commit
  28. 26 Sep, 2017 1 commit
  29. 13 Sep, 2017 2 commits
    • Ben Gamari's avatar
      Model divergence of retry# as ThrowsExn, not Diverges · 10a1a478
      Ben Gamari authored
      The demand signature of the retry# primop previously had a Diverges
      result.  However, this caused the demand analyser to conclude that a
      program of the shape,
      
          catchRetry# (... >> retry#)
      
      would diverge. Of course, this is plainly wrong; catchRetry#'s sole
      reason to exist is to "catch" the "exception" thrown by retry#. While
      catchRetry#'s demand signature correctly had the ExnStr flag set on its
      first argument, indicating that it should catch divergence, the logic
      associated with this flag doesn't apply to Diverges results. This
      resulted in #14171.
      
      The solution here is to treat the divergence of retry# as an exception.
      Namely, give it a result type of ThrowsExn rather than Diverges.
      
      Updates stm submodule for tests.
      
      Test Plan: Validate with T14171
      
      Reviewers: simonpj, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14171, #8091
      
      Differential Revision: https://phabricator.haskell.org/D3919
      10a1a478
    • Sibi Prabakaran's avatar
      Clarify seq documentation · 4e222203
      Sibi Prabakaran authored
      Improves the documentation by specifying that the first argument in
      seq function is evaluated to WHNF.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: harendra, rwbarton, thomie
      
      GHC Trac Issues: #14213
      
      Differential Revision: https://phabricator.haskell.org/D3945
      4e222203
  30. 26 Jul, 2017 1 commit
  31. 19 Jun, 2017 1 commit
  32. 29 Apr, 2017 1 commit
  33. 25 Apr, 2017 1 commit
  34. 12 Apr, 2017 1 commit
  35. 04 Apr, 2017 1 commit
    • David Feuer's avatar
      Revert "Make raiseIO# produce topRes" · e83af07e
      David Feuer authored
      This reverts commit da4687f6.
      
      It's not entirely trivial to clean up the dead code this patch
      introduced. In particular, when we see
      
      ```
      case raiseIO# m s of
        s' -> e
      ```
      
      we want to know that `e` is dead. For scrutinees that are properly
      bottom (which we don't want to consider `raiseIO# m s` to be, this
      is handled by rewriting `bot` to `case bot of {}`. But if we do
      that for `raiseIO#`, we end up with
      
      ```
      case raiseIO# m s of {}
      ```
      
      which looks a lot like bottom and could confuse demand analysis.
      I think we need to wait with this change until we have a more
      complete story.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3413
      e83af07e
  36. 30 Mar, 2017 1 commit
  37. 28 Mar, 2017 1 commit
  38. 22 Mar, 2017 1 commit
    • David Feuer's avatar
      Make unsafeInterleaveST less unsafe · 30d68d63
      David Feuer authored
      * Make `unsafeInterleaveST` use `noDuplicate#` like
      `unsafeInterleaveIO` does to prevent the suspended action from
      being run in two threads.
      
      * In order to accomplish this without `unsafeCoerce#`, generalize
      the type of `noDuplicate#`.
      
      * Add `unsafeDupableInterleaveST` to get the old behavior.
      
      * Document unsafe `ST` functions and clean up some related
      documentation.
      
      Fixes #13457
      
      Reviewers: austin, hvr, bgamari, ekmett
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3370
      30d68d63