1. 20 Nov, 2018 1 commit
  2. 19 Nov, 2018 4 commits
    • Sebastian Graf's avatar
      Don't track free variables in STG syntax by default · 47bbc709
      Sebastian Graf authored
      Summary:
      Currently, `CoreToStg` annotates `StgRhsClosure`s with their set of non-global
      free variables.  This free variable information is only needed in the final
      code generation step (i.e. `StgCmm.codeGen`), which leads to transformations
      such as `StgCse` and `StgUnarise` having to maintain this information.
      
      This is tiresome and unnecessary, so this patch introduces a trees-to-grow-like
      approach that only introduces the free variable set into the syntax tree in the
      code gen pass, along with a free variable analysis on STG terms to generate
      that information.
      
      Fixes #15754.
      
      Reviewers: simonpj, osa1, bgamari, simonmar
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15754
      
      Differential Revision: https://phabricator.haskell.org/D5324
      47bbc709
    • Alp Mestanogullari's avatar
      hadrian: make it possible to run the testsuite with quickest and quick · cc615c69
      Alp Mestanogullari authored
      More generally, we so far assumed that the testsuite would be executed
      with a flavour that's as comprehensive as perf in terms of available RTS
      and library flavours (at least vanilla + dynamic + prof). This would
      manifest itself concretely by needing 3 "ways" of the iserv program,
      unconditionally.
      
      We now only require the ways among vanilla, dynamic and prof that we
      can find in our current Flavour's rtsWays.
      
      Test Plan:
      hadrian/build.sh --flavour={quick, quickest} test now goes through
      (with a few failing tests, of course).
      
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: mpickering, RyanGlScott, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5355
      cc615c69
    • Matthew Pickering's avatar
      eventlog: Log the current stack size when stack overflows · 7e570676
      Matthew Pickering authored
      Reviewers: maoe, bgamari, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter, sjorn3
      
      Differential Revision: https://phabricator.haskell.org/D5287
      7e570676
    • Ömer Sinan Ağacan's avatar
      Tiny refactor in exitScheduler · 348ea161
      Ömer Sinan Ağacan authored
      348ea161
  3. 18 Nov, 2018 1 commit
    • Chris Done's avatar
      Fix typo in docs · ecfc7b46
      Chris Done authored
      I've been reading this line of docs for years and it ruffles my feathers.
      ecfc7b46
  4. 17 Nov, 2018 14 commits
    • Abhiroop Sarkar's avatar
      Introduce Int16# and Word16# · 36fcf9ed
      Abhiroop Sarkar authored
      This builds off of D4475.
      
      Bumps binary submodule.
      
      Reviewers: carter, AndreasK, hvr, goldfire, bgamari, simonmar
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D5006
      36fcf9ed
    • Chris Smith's avatar
      Fix trac #15702, as a followon to fix for #13704. · 0e7790ab
      Chris Smith authored
      Summary:
      The effect of this change is that -main-is changes the default
      export list for the main module, but does not apply the same
      change to non-main modules.  This fixes some cases where -main-is
      was used to wrap a module that expected that default behavior
      (exporting `main`, even when that wasn't the main entry point
      name).
      
      Reviewers: mpickering, monoidal, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #13704, #15702
      
      Differential Revision: https://phabricator.haskell.org/D5322
      0e7790ab
    • Gabor Greif's avatar
      798c9437
    • Roland Senn's avatar
      Remove -Wamp flag (#11477) · 33f57258
      Roland Senn authored
      Summary:
      Add line
        "The deprecated ghc-flag -Wamp has been removed."
      to the release notes for 8.8.1
      
      Reviewers: bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #11477
      
      Differential Revision: https://phabricator.haskell.org/D5296
      33f57258
    • Sebastian Graf's avatar
      More compact Outputable instance for `Uniq(D)Set` · 17e771e1
      Sebastian Graf authored
      Summary:
      Until now, `UniqSet` and `UniqDSet` inherited their `Outputable`
      instances from `UniqFM` and `UniqDFM`.
      
      That made for verbose and redundant output. This patch rectifies
      that by pretty-printing these sets in common math notation.
      E.g., previously, we would render `UniqSet`s like this:
      
          [s2fE :-> x_s2fE, s2fF :-> y_s2fF, s2fG :-> z_s2fG, s2fH :-> g_s2fH]
      
      Now, they're are printed like this:
      
          {x_s2fE, y_s2fF, z_s2fG, g_s2fH}
      
      Reviewers: simonpj, bgamari, AndreasK, dfeuer, osa1
      
      Reviewed By: osa1
      
      Subscribers: osa1, rwbarton, carter
      
      GHC Trac Issues: #15879
      
      Differential Revision: https://phabricator.haskell.org/D5315
      17e771e1
    • Simon Jakobi's avatar
      Speed up MonadUtils.mapMaybeM · 5bf07866
      Simon Jakobi authored
      Summary: This version is nearly 2x faster according to a few small benchmarks.
      
      Reviewers: bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5344
      5bf07866
    • Roland Senn's avatar
      Fix #12906: GHC fails to typecheck Main module without main · 92f81841
      Roland Senn authored
      Summary: The function fail is no longer called immediately
      after adding the no-main error message to the TcM monad.
      The rest of the module will be typechecked.
      
      Test Plan: make test TEST=T12906
      
      Reviewers: dfeuer, RyanGlScott, ezyang, mpickering, bgamari
      
      Reviewed By: RyanGlScott
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #12906
      
      Differential Revision: https://phabricator.haskell.org/D5338
      92f81841
    • Roland Senn's avatar
      Fix #12525: Remove derived bindings from the TyThings from getBindings · 921fd890
      Roland Senn authored
      Summary:
      Remove derived OccNames from the list of TyThings returned by the function GHC.getBindings.
      Therefore the output of the `:show bindings `command will not contain names generated by GHC.
      
      Test Plan: make test TEST=T12525
      
      Reviewers: austin, hvr, alanz, angerman, thomie, bgamari, osa1
      
      Reviewed By: osa1
      
      Subscribers: simonpj, osa1, rwbarton, carter
      
      GHC Trac Issues: #12525
      
      Differential Revision: https://phabricator.haskell.org/D5326
      921fd890
    • Krzysztof Gogolewski's avatar
      Building GHC with hadrian on FreeBSD · 65517979
      Krzysztof Gogolewski authored
      Summary: I'm currently trying to make `hadrian` work as a build system
      on FreeBSD (https://ghc.haskell.org/trac/ghc/ticket/15860).
      I'm still having some issues with `libgmp` but one can get a working
      `ghc` using `--integer-simple` and this patch.
      
      Reviewers: bgamari, erikd, alpmestan
      
      Reviewed By: alpmestan
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5335
      65517979
    • Alp Mestanogullari's avatar
      fix T15898 · fc670c4d
      Alp Mestanogullari authored
      Summary:
      validate is currently broken [1] on master, this patches addresses
      the failure by removing an expected stdout file for T15898 since no output
      is generated there.
      
      [1]: https://circleci.com/gh/ghc/ghc/11416
      
      Test Plan: TEST=T15898 ./validate
      
      Reviewers: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5345
      fc670c4d
    • Andreas Klebinger's avatar
      NCG: New code layout algorithm. · 912fd2b6
      Andreas Klebinger authored
      Summary:
      This patch implements a new code layout algorithm.
      It has been tested for x86 and is disabled on other platforms.
      
      Performance varies slightly be CPU/Machine but in general seems to be better
      by around 2%.
      Nofib shows only small differences of about +/- ~0.5% overall depending on
      flags/machine performance in other benchmarks improved significantly.
      
      Other benchmarks includes at least the benchmarks of: aeson, vector, megaparsec, attoparsec,
      containers, text and xeno.
      
      While the magnitude of gains differed three different CPUs where tested with
      all getting faster although to differing degrees. I tested: Sandy Bridge(Xeon), Haswell,
      Skylake
      
      * Library benchmark results summarized:
        * containers: ~1.5% faster
        * aeson: ~2% faster
        * megaparsec: ~2-5% faster
        * xml library benchmarks: 0.2%-1.1% faster
        * vector-benchmarks: 1-4% faster
        * text: 5.5% faster
      
      On average GHC compile times go down, as GHC compiled with the new layout
      is faster than the overhead introduced by using the new layout algorithm,
      
      Things this patch does:
      
      * Move code responsilbe for block layout in it's own module.
      * Move the NcgImpl Class into the NCGMonad module.
      * Extract a control flow graph from the input cmm.
      * Update this cfg to keep it in sync with changes during
        asm codegen. This has been tested on x64 but should work on x86.
        Other platforms still use the old codelayout.
      * Assign weights to the edges in the CFG based on type and limited static
        analysis which are then used for block layout.
      * Once we have the final code layout eliminate some redundant jumps.
      
        In particular turn a sequences of:
            jne .foo
            jmp .bar
          foo:
        into
            je bar
          foo:
            ..
      
      Test Plan: ci
      
      Reviewers: bgamari, jmct, jrtc27, simonmar, simonpj, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, trommler, jmct, carter, thomie, rwbarton
      
      GHC Trac Issues: #15124
      
      Differential Revision: https://phabricator.haskell.org/D4726
      912fd2b6
    • Dmitry Ivanov's avatar
    • Ben Price's avatar
      user's guide: typo in ViewPatterns example · 96962829
      Ben Price authored
      96962829
    • Ömer Sinan Ağacan's avatar
      Some assertions and comments in scheduler · 66772351
      Ömer Sinan Ağacan authored
      Test Plan:
      I can't validate this because of existing errors with the debug runtime. I'll
      see if this introduces any new failures.
      
      Reviewers: simonmar, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5337
      66772351
  5. 16 Nov, 2018 3 commits
  6. 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
  7. 14 Nov, 2018 1 commit
  8. 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
  9. 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
  10. 11 Nov, 2018 4 commits
  11. 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
  12. 07 Nov, 2018 1 commit
    • 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