1. 15 Nov, 2018 4 commits
    • Simon Peyton Jones's avatar
      Smarter HsType pretty-print for promoted datacons · ae2c9b40
      Simon Peyton Jones authored
      Fix Trac #15898, by being smarter about when to print
      a space before a promoted data constructor, in a HsType.
      I had to implement a mildly tiresome function
          HsType.lhsTypeHasLeadingPromotionQuote
      It has multiple cases, of course, but it's very simple.
      
      The patch improves the error-message output in a bunch of
      cases, and (to my surprise) actually fixes a bug in the
      output of T14343 (Trac #14343), thus
      
        -  In the expression: _ :: Proxy '('( 'True,  'False),  'False)
        +  In the expression: _ :: Proxy '( '( 'True, 'False), 'False)
      
      I discovered that there were two copies of the PromotionFlag
      type (a boolean, with helpfully named data cons), one in
      IfaceType and one in HsType.  So I combined into one,
      PromotionFlag, and moved it to BasicTypes.  That's why
      quite a few files are touched, but it's all routine.
      ae2c9b40
    • Simon Peyton Jones's avatar
      0ce66be9
    • Simon Peyton Jones's avatar
      Comments only, about polykinded TyConApps · fe057642
      Simon Peyton Jones authored
      See Trac #15704 comment:8ff
      fe057642
    • Simon Marlow's avatar
      Fix a bug in SRT generation (#15892) · eb46345d
      Simon Marlow authored
      Summary:
      The logic in `Note [recursive SRTs]` was correct. However, my
      implementation of it wasn't: I got the associativity of
      `Set.difference` wrong, which led to an extremely subtle and difficult
      to find bug.
      
      Fortunately now we have a test case. I was able to cut down the code
      to something manageable, and I've added it to the test suite.
      
      Test Plan:
      Before (using my stage 1 compiler without the fix):
      
      ```
      ====> T15892(normal) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
      T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output  -O
      cd "T15892.run" && ./T15892  +RTS -G1 -A32k -RTS
      Wrong exit code for T15892(normal)(expected 0 , actual 134 )
      Stderr ( T15892 ):
      T15892: internal error: evacuate: strange closure type 0
          (GHC version 8.7.20181113 for x86_64_unknown_linux)
          Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      Aborted (core dumped)
      *** unexpected failure for T15892(normal)
      =====> T15892(g1) 1 of 1 [0, 1, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
      T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output  -O
      cd "T15892.run" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS
      Wrong exit code for T15892(g1)(expected 0 , actual 134 )
      Stderr ( T15892 ):
      T15892: internal error: evacuate: strange closure type 0
          (GHC version 8.7.20181113 for x86_64_unknown_linux)
          Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      Aborted (core dumped)
      ```
      
      After (using my stage 2 compiler with the fix):
      
      ```
      =====> T15892(normal) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
      -o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output
      cd "T15892.run" && ./T15892  +RTS -G1 -A32k -RTS
      =====> T15892(g1) 1 of 1 [0, 0, 0]
      cd "T15892.run" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
      -o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
      -fno-warn-missed-specialisations -fshow-warning-groups
      -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
      -dno-debug-output
      cd "T15892.run" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS
      ```
      
      Reviewers: bgamari, osa1, erikd
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15892
      
      Differential Revision: https://phabricator.haskell.org/D5334
      eb46345d
  2. 14 Nov, 2018 1 commit
  3. 13 Nov, 2018 1 commit
    • Sebastian Graf's avatar
      Make `UniqDSet` a newtype · 5b98a38a
      Sebastian Graf authored
      Summary:
      This brings the situation of `UniqDSet` in line with `UniqSet`.
      
      @dfeuer said in D3146#92820 that he would do this, but probably
      never got around to it.
      
      Validated locally.
      
      Reviewers: AndreasK, mpickering, bgamari, dfeuer, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter, dfeuer
      
      GHC Trac Issues: #15879, #13114
      
      Differential Revision: https://phabricator.haskell.org/D5313
      5b98a38a
  4. 12 Nov, 2018 5 commits
    • Ben Gamari's avatar
    • Shao Cheng's avatar
      Correct link to GHC API in docs index. · 89bf7d54
      Shao Cheng authored
      89bf7d54
    • Alp Mestanogullari's avatar
      compareByPreference: handle the integer-gmp vs -simple case · 86ee74dc
      Alp Mestanogullari authored
      Currently, it assumes the package names are identical and this
      breaks in the case where integer-gmp is in one package db and
      integer-simple in another. This became a problem with
      the commit: fc2ff6dd.
      
      Instead of following the precedence information, leading to
      the right choice, the current code would compare the
      integer-gmp and integer-simple versions and pick integer-gmp
      because it happened to have a greater version, despite having
      a lower precedence. See
      https://github.com/snowleopard/hadrian/issues/702 for
      a comprehensive report about the problem.
      
      This effectively un-breaks integer-simple builds with hadrian.
      
      Test Plan: hadrian/build.sh --integer-simple
      
      Reviewers: snowleopard, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: snowleopard, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5266
      86ee74dc
    • Ömer Sinan Ağacan's avatar
      Remove StgBinderInfo and related computation in CoreToStg · d30352ad
      Ömer Sinan Ağacan authored
      - The StgBinderInfo type was never used in the code gen, so the type, related
        computation in CoreToStg, and some comments about it are removed. See #15770
        for more details.
      
      - Simplified CoreToStg after removing the StgBinderInfo computation: removed
        StgBinderInfo arguments and mfix stuff.
      
      The StgBinderInfo values were not used in the code gen, but I still run nofib
      just to make sure: 0.0% change in allocations and binary sizes.
      
      Test Plan: Validated locally
      
      Reviewers: simonpj, simonmar, bgamari, sgraf
      
      Reviewed By: sgraf
      
      Subscribers: AndreasK, sgraf, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5232
      d30352ad
    • Edward Z. Yang's avatar
      Fix #15594 (--abi-hash with Backpack sometimes fails) · 13ff0b7c
      Edward Z. Yang authored
      Summary:
      For holes, its necessary to "see through" the instantiation
      of the hole to get accurate family instance dependencies.
      For example, if B imports <A>, and <A> is instantiated with
      F, we must grab and include all of the dep_finsts from
      F to have an accurate transitive dep_finsts list.
      
      However, we MUST NOT do this for regular modules.
      First, for efficiency reasons, doing this
      bloats the the dep_finsts list, because we *already* had
      those modules in the list (it wasn't a hole module, after
      all). But there's a second, more important correctness
      consideration: we perform module renaming when running
      --abi-hash.  In this case, GHC's contract to the user is that
      it will NOT go and read out interfaces of any dependencies
      (https://github.com/haskell/cabal/issues/3633); the point of
      --abi-hash is just to get a hash of the on-disk interfaces
      for this *specific* package.  If we go off and tug on the
      interface for /everything/ in dep_finsts, we're gonna have a
      bad time.  (It's safe to do do this for hole modules, though,
      because the hmap for --abi-hash is always trivial, so the
      interface we request is local.  Though, maybe we ought
      not to do it in this case either...)
      Signed-off-by: default avatarEdward Z. Yang <ezyang@fb.com>
      
      Test Plan: validate
      
      Reviewers: alexbiehl, goldfire, bgamari
      
      Subscribers: ppk, shlevy, rwbarton, carter
      
      GHC Trac Issues: #15594
      
      Differential Revision: https://phabricator.haskell.org/D5123
      13ff0b7c
  5. 11 Nov, 2018 4 commits
  6. 08 Nov, 2018 1 commit
    • Ryan Scott's avatar
      Fix #15845 by defining etaExpandFamInstLHS and using it · 63a81707
      Ryan Scott authored
      Summary:
      Both #9692 and #14179 were caused by GHC being careless
      about using eta-reduced data family instance axioms. Each of those
      tickets were fixed by manually whipping up some code to eta-expand
      the axioms. The same sort of issue has now caused #15845, so I
      figured it was high time to factor out the code that each of these
      fixes have in common.
      
      This patch introduces the `etaExpandFamInstLHS` function, which takes
      a family instance's type variables, LHS types, and RHS type, and
      returns type variables and LHS types that have been eta-expanded if
      necessary, in the case of a data family instance. (If it's a type
      family instance, `etaExpandFamInstLHS` just returns the supplied type
      variables and LHS types unchanged).
      
      Along the way, I noticed that many references to
      `Note [Eta reduction for data families]` (in `FamInstEnv`) had
      slightly bitrotted (they either referred to a somewhat different
      name, or claimed that the Note lived in a different module), so
      I took the liberty of cleaning those up.
      
      Test Plan: make test TEST="T9692 T15845"
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15845
      
      Differential Revision: https://phabricator.haskell.org/D5294
      63a81707
  7. 07 Nov, 2018 8 commits
    • davide's avatar
      testsuite: Save performance metrics in git notes. · 932cd41d
      davide authored
      This patch makes the following improvement:
        - Automatically records test metrics (per test environment) so that
          the programmer need not supply nor update expected values in *.T
          files.
          - On expected metric changes, the programmer need only indicate the
            direction of change in the git commit message.
        - Provides a simple python tool "perf_notes.py" to compare metrics
          over time.
      
      Issues:
        - Using just the previous commit allows performance to drift with each
          commit.
          - Currently we allow drift as we have a preference for minimizing
            false positives.
          - Some possible alternatives include:
            - Use metrics from a fixed commit per test: the last commit that
              allowed a change in performance (else the oldest metric)
            - Or use some sort of aggregate since the last commit that allowed
              a change in performance (else all available metrics)
            - These alternatives may result in a performance issue (with the
              test driver) having to heavily search git commits/notes.
        - Run locally, performance tests will trivially pass unless the tests
          were run locally on the previous commit. This is often not the case
          e.g.  after pulling recent changes.
      
      Previously, *.T files contain statements such as:
      ```
      stats_num_field('peak_megabytes_allocated', (2, 1))
      compiler_stats_num_field('bytes allocated',
                               [(wordsize(64), 165890392, 10)])
      ```
      This required the programmer to give the expected values and a tolerance
      deviation (percentage). With this patch, the above statements are
      replaced with:
      ```
      collect_stats('peak_megabytes_allocated', 5)
      collect_compiler_stats('bytes allocated', 10)
      ```
      So that programmer must only enter which metrics to test and a tolerance
      deviation. No expected value is required. CircleCI will then run the
      tests per test environment and record the metrics to a git note for that
      commit and push them to the git.haskell.org ghc repo. Metrics will be
      compared to the previous commit. If they are different by the tolerance
      deviation from the *.T file, then the corresponding test will fail. By
      adding to the git commit message e.g.
      ```
       # Metric (In|De)crease <metric(s)> <options>: <tests>
      Metric Increase ['bytes allocated', 'peak_megabytes_allocated'] \
               (test_env='linux_x86', way='default'):
          Test012, Test345
      Metric Decrease 'bytes allocated':
          Test678
      Metric Increase:
          Test711
      ```
      This will allow the noted changes (letting the test pass). Note that by
      omitting metrics or options, the change will apply to all possible
      metrics/options (i.e. in the above, an increase for all metrics in all
      test environments is allowed for Test711)
      
      phabricator will use the message in the description
      
      Reviewers: bgamari, hvr
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #12758
      
      Differential Revision: https://phabricator.haskell.org/D5059
      932cd41d
    • Ben Gamari's avatar
      Revert "CircleCI: Build DWARF-enabled Linux bindists" · 82a5c241
      Ben Gamari authored
      This reverts commit 406978c4.
      82a5c241
    • Ben Gamari's avatar
      Revert "Multiple fixes / improvements for LLVM backend" · 39cd12b8
      Ben Gamari authored
      This reverts commit adcb5fb4.
      39cd12b8
    • Ben Gamari's avatar
      Revert "Fix for T14251 on ARM" · 802ce6eb
      Ben Gamari authored
      This reverts commit d8495549.
      802ce6eb
    • Michal Terepeta's avatar
      [LlvmCodeGen] Fixes for Int8#/Word8# · f424515f
      Michal Terepeta authored
      This fixes two isssues:
      
      - Using bitcast for MO_XX_Conv
        Arguments to a bitcast must be of the same size. We should be using
        `trunc` and `zext` instead.
      
      - Using unsupported MO_*_QuotRem for LLVM
        The two primops `MO_*_QuotRem` are not supported by the LLVM backend,
      so
        we shouldn't use them for `Int8#`/`Word8#` (just as we do not use
      them for
        `Int#`/`Word#`).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: manually run tests with WAY=llvm
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15864
      
      Differential Revision: https://phabricator.haskell.org/D5304
      f424515f
    • Ben Gamari's avatar
      CircleCI: Build DWARF-enabled Linux bindists · 406978c4
      Ben Gamari authored
      406978c4
    • Ben Gamari's avatar
      Bump directory submodule to 1.3.3.1 · 648b0c2d
      Ben Gamari authored
      648b0c2d
    • Ben Gamari's avatar
      integer-gmp: Fix TBA in changelog · 7189469a
      Ben Gamari authored
      7189469a
  8. 06 Nov, 2018 1 commit
  9. 05 Nov, 2018 1 commit
  10. 04 Nov, 2018 1 commit
    • Roland Senn's avatar
      Fix for Trac #15611: Scope errors lie about what modules are imported. · 1a3b9bd0
      Roland Senn authored
      Summary:
      For the error message:
          Not in scope X.Y
          Module X does not export Y
          No module named ‘X’ is imported:
      there are 2 cases, where we don't show the last "no module named is imported" line:
      1. If the module X has been imported.
      2. If the module X is the current module. There are 2 subcases:
      
         2.1 If the unknown module name is in a input source file,
             then we can use the getModule function to get the current module name.
      
         2.2 If the unknown module name has been entered by the user in GHCi,
             then the getModule function returns something like "interactive:Ghci1",
             and we have to check the current module in the last added entry of
             the HomePackageTable.
      
      Test Plan: make test TESTS="T15611a T15611b"
      
      Reviewers: monoidal, hvr, thomie, dfeuer, bgamari, DavidEichmann
      
      Reviewed By: monoidal, DavidEichmann
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15611
      
      Differential Revision: https://phabricator.haskell.org/D5284
      1a3b9bd0
  11. 02 Nov, 2018 8 commits
  12. 01 Nov, 2018 5 commits