Skip to content
Snippets Groups Projects
  1. Nov 04, 2020
    • Simon Peyton Jones's avatar
      This patch addresses the exponential blow-up in the simplifier. · 61b20bdd
      Simon Peyton Jones authored and Timo von Holtz's avatar Timo von Holtz committed
      Specifically:
        #13253 exponential inlining
        #10421 ditto
        #18140 strict constructors
        #18282 another nested-function call case
      
      This patch makes one really significant changes: change the way that
      mkDupableCont handles StrictArg.  The details are explained in
      GHC.Core.Opt.Simplify Note [Duplicating StrictArg].
      
      Specific changes
      
      * In mkDupableCont, when making auxiliary bindings for the other arguments
        of a call, add extra plumbing so that we don't forget the demand on them.
        Otherwise we haev to wait for another round of strictness analysis. But
        actually all the info is to hand.  This change affects:
        - Make the strictness list in ArgInfo be [Demand] instead of [Bool],
          and rename it to ai_dmds.
        - Add as_dmd to ValArg
        - Simplify.makeTrivial takes a Demand
        - mkDupableContWithDmds takes a [Demand]
      
      There are a number of other small changes
      
      1. For Ids that are used at most once in each branch of a case, make
         the occurrence analyser record the total number of syntactic
         occurrences.  Previously we recorded just OneBranch or
         MultipleBranches.
      
         I thought this was going to be useful, but I ended up barely
         using it; see Note [Note [Suppress exponential blowup] in
         GHC.Core.Opt.Simplify.Utils
      
         Actual changes:
           * See the occ_n_br field of OneOcc.
           * postInlineUnconditionally
      
      2. I found a small perf buglet in SetLevels; see the new
         function GHC.Core.Opt.SetLevels.hasFreeJoin
      
      3. Remove the sc_cci field of StrictArg.  I found I could get
         its information from the sc_fun field instead.  Less to get
         wrong!
      
      4. In ArgInfo, arrange that ai_dmds and ai_discs have a simpler
         invariant: they line up with the value arguments beyond ai_args
         This allowed a bit of nice refactoring; see isStrictArgInfo,
         lazyArgcontext, strictArgContext
      
      There is virtually no difference in nofib. (The runtime numbers
      are bogus -- I tried a few manually.)
      
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                  fft          +0.0%     -2.0%    -48.3%    -49.4%      0.0%
           multiplier          +0.0%     -2.2%    -50.3%    -50.9%      0.0%
      --------------------------------------------------------------------------------
                  Min          -0.4%     -2.2%    -59.2%    -60.4%      0.0%
                  Max          +0.0%     +0.1%     +3.3%     +4.9%      0.0%
       Geometric Mean          +0.0%     -0.0%    -33.2%    -34.3%     -0.0%
      
      Test T18282 is an existing example of these deeply-nested strict calls.
      We get a big decrease in compile time (-85%) because so much less
      inlining takes place.
      
      Metric Decrease:
          T18282
      
      (cherry picked from commit 0bd60059)
      61b20bdd
  2. Nov 01, 2020
  3. Oct 23, 2020
    • toonn's avatar
      Fix typos in 8.10.2 changelog · 929e09ed
      toonn authored and Ben Gamari's avatar Ben Gamari committed
      Replace an "as well" missing "as" with "and" in 4.1 Highlights.
      
      Add missing apostrophe in "user's guide", insert space in "work around"
      and dash in "cost-center" in 4.2.2 Runtime system.
      929e09ed
  4. Oct 22, 2020
  5. Oct 20, 2020
    • Tamar Christina's avatar
      rts: fix race condition in StgCRun · 658362c6
      Tamar Christina authored and Ben Gamari's avatar Ben Gamari committed
      On windows the stack has to be allocated 4k at a time, otherwise we get
      a segfault. This is done by using a helper ___chkstk_ms that is provided
      by libgcc. The Haskell side already knows how to handle this but we need
      to do the same from STG. Previously we would drop the stack in StgRun
      but would only make it valid whenever the scheduler loop ran.
      
      This approach was fundamentally broken in that it falls apart when you
      take a signal from the OS. We see it less often because you initially
      get allocated a 1MB stack block which you have to blow past first.
      
      Concretely this means we must always keep the stack valid.
      
      Fixes #18601.
      
      (cherry picked from commit fd984d68)
      658362c6
  6. Oct 15, 2020
  7. Oct 14, 2020
    • Moritz Angermann's avatar
      [macOS] improved runpath handling · 43f97049
      Moritz Angermann authored and Ben Gamari's avatar Ben Gamari committed
      
      In b592bd98 we started using
      -dead_strip_dylib on macOS when lining dynamic libraries and binaries.
      The underlying reason being the Load Command Size Limit in macOS
      Sierra (10.14) and later.
      
      GHC will produce @rpath/libHS... dependency entries together with a
      corresponding RPATH entry pointing to the location of the libHS...
      library. Thus for every library we produce two Load Commands.  One to
      specify the dependent library, and one with the path where to find it.
      This makes relocating libraries and binaries easier, as we just need to
      update the RPATH entry with the install_name_tool. The dynamic linker
      will then subsitute each @rpath with the RPATH entries it finds in the
      libraries load commands or the environement, when looking up @rpath
      relative libraries.
      
      -dead_strip_dylibs intructs the linker to drop unused libraries. This in
      turn help us reduce the number of referenced libraries, and subsequently
      the size of the load commands.  This however does not remove the RPATH
      entries.  Subsequently we can end up (in extreme cases) with only a
      single @rpath/libHS... entry, but 100s or more RPATH entries in the Load
      Commands.
      
      This patch rectifies this (slighly unorthodox) by passing *no* -rpath
      arguments to the linker at link time, but -headerpad 8000.  The
      headerpad argument is in hexadecimal and the maxium 32k of the load
      command size.  This tells the linker to pad the load command section
      enough for us to inject the RPATHs later.  We then proceed to link the
      library or binary with -dead_strip_dylibs, and *after* the linking
      inspect the library to find the left over (non-dead-stripped)
      dependencies (using otool).  We find the corresponding RPATHs for each
      @rpath relative dependency, and inject them into the library or binary
      using the install_name_tool.  Thus achieving a deadstripped dylib (and
      rpaths) build product.
      
      We can not do this in GHC, without starting to reimplement a dynamic
      linker as we do not know which symbols and subsequently libraries are
      necessary.
      
      Commissioned-by: Mercury Technologies, Inc. (mercury.com)
      (cherry picked from commit 4ff93292)
      Signed-off-by: default avatarMoritz Angermann <moritz.angermann@iohk.io>
      43f97049
  8. Oct 08, 2020
  9. Oct 06, 2020
    • GHC GitLab CI's avatar
      configure: Avoid hard-coded ld path on Windows · fec3a3cf
      GHC GitLab CI authored and Ben Gamari's avatar Ben Gamari committed
      The fix to #17962 ended up regressing on Windows as it failed to
      replicate the logic responsible for overriding the toolchain paths on
      Windows. This resulted in a hard-coded path to a directory that likely
      doesn't exist on the user's system (#18550).
      
      (cherry picked from commit 34e0fa96)
      fec3a3cf
    • Ömer Sinan Ağacan's avatar
      Fix uninitialized field read in Linker.c · 8a85216c
      Ömer Sinan Ağacan authored
      Valgrind report of the bug when running the test `linker_unload`:
      
          ==29666== Conditional jump or move depends on uninitialised value(s)
          ==29666==    at 0x369C5B4: setOcInitialStatus (Linker.c:1305)
          ==29666==    by 0x369C6C5: mkOc (Linker.c:1347)
          ==29666==    by 0x36C027A: loadArchive_ (LoadArchive.c:522)
          ==29666==    by 0x36C0600: loadArchive (LoadArchive.c:626)
          ==29666==    by 0x2C144CD: ??? (in /home/omer/haskell/ghc_2/testsuite/tests/rts/linker/linker_unload.run/linker_unload)
          ==29666==
          ==29666== Conditional jump or move depends on uninitialised value(s)
          ==29666==    at 0x369C5B4: setOcInitialStatus (Linker.c:1305)
          ==29666==    by 0x369C6C5: mkOc (Linker.c:1347)
          ==29666==    by 0x369C9F6: preloadObjectFile (Linker.c:1507)
          ==29666==    by 0x369CA8D: loadObj_ (Linker.c:1536)
          ==29666==    by 0x369CB17: loadObj (Linker.c:1557)
          ==29666==    by 0x3866BC: main (linker_unload.c:33)
      
      The problem is `mkOc` allocates a new `ObjectCode` and calls
      `setOcInitialStatus` without initializing the `status` field.
      `setOcInitialStatus` reads the field as first thing:
      
          static void setOcInitialStatus(ObjectCode* oc) {
              if (oc->status == OBJECT_DONT_RESOLVE)
                return;
      
              if (oc->archiveMemberName == NULL) {
                  oc->status = OBJECT_NEEDED;
              } else {
                  oc->status = OBJECT_LOADED;
              }
          }
      
      `setOcInitialStatus` is unsed in two places for two different purposes:
      in `mkOc` where we don't have the `status` field initialized yet (`mkOc`
      is supposed to initialize it), and `loadOc` where we do have `status`
      field initialized and we want to update it. Instead of splitting the
      function into two functions which are both called just once I inline the
      functions in the use sites and remove it.
      
      Fixes #18342
      
      (cherry picked from commit 08c1cb0f)
      8a85216c
    • Ben Gamari's avatar
      Bump text submodule to 1.2.4.0+ · a259e6da
      Ben Gamari authored
      Fixes #18588 and #17956.
      a259e6da
  10. Sep 12, 2020
  11. Aug 29, 2020
    • Vladislav Zavialov's avatar
      Import qualified Prelude in Cmm/Parser.y · e512d310
      Vladislav Zavialov authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
      In preparation for the next version of 'happy', c95920 added a qualified
      import to GHC/Parser.y but for some reason neglected GHC/Cmm/Parser.y
      
      This patch adds the missing qualified import to GHC/Cmm/Parser.y and
      also adds a clarifying comment to explain why this import is needed.
      
      (cherry picked from commit fddddbf4)
      e512d310
  12. Aug 22, 2020
  13. Aug 09, 2020
  14. Aug 07, 2020
  15. Aug 06, 2020
  16. Aug 05, 2020
    • Ben Gamari's avatar
      Refactor handling of object merging · e69b0d42
      Ben Gamari authored
      Previously to merge a set of object files we would invoke the linker as
      usual, adding -r to the command-line. However, this can result in
      non-sensical command-lines which causes lld to balk (#17962).
      
      To avoid this we introduce a new tool setting into GHC, -pgmlm, which is
      the linker which we use to merge object files.
      e69b0d42
  17. Aug 03, 2020
  18. Aug 01, 2020
  19. Jul 31, 2020
  20. Jul 30, 2020
Loading