1. 23 Sep, 2018 1 commit
    • Simon Peyton Jones's avatar
      Buglet in reporting out of scope errors in rules · cad5d0b6
      Simon Peyton Jones authored
      Most out of scope errors get reported by the type checker these
      days, but not all.  Example, the function on the LHS of a RULE.
      
      Trace #15659 pointed out that this less-heavily-used code path
      produce a "wacky" error message.  Indeed so.  Easily fixed.
      cad5d0b6
  2. 22 Sep, 2018 1 commit
  3. 21 Sep, 2018 7 commits
  4. 20 Sep, 2018 7 commits
  5. 19 Sep, 2018 2 commits
  6. 18 Sep, 2018 8 commits
  7. 17 Sep, 2018 5 commits
    • Tamar Christina's avatar
      Updated PE linker, section alignment and cleanup. · 58407343
      Tamar Christina authored
      Summary:
      This patch is to address a couple of short comings of the PE linker.
      
      The first thing it does is properly honor section alignments, so SSE code
      will work reliably.
      
      While doing this I've also changed how it reads and stores ObjectFile
      information. Previously the entire object file was read in and treated
      as one blob, including headers, symbol tables etc.
      
      Now the ObjectFile is read in but stored in chunks, tables go into a temporary
      info struct and code/data into a new private heap. This allows me to free all
      meta data once we're done relocating. Which means we can reclaim this memory.
      
      As I've mentioned above I've also moved from using VirtualAlloc to HeapAlloc.
      The reason is VirtualAlloc is meant to be used for more low level memory
      allocation, it's very fast because it can only allocate whole blocks,
      (64k) by default, and the memory must be paged (4k) aligned.
      
      So when you ask for e.g. 30k of memory, you're given a whole block where 34k
      will be wasted memory. Nothing else can ever access that untill you free the 30k.
      
      One downside of HeapAlloc is that you're not in control of how the heap grows,
      and heap memory is always committed. So it's harder to tell how much we're
      actually using now.
      
      Another big upside of splitting off the ObjectCode tables to info structs
      is that I can adjust them, so that later addressings can just use array
      subscripts to index into them. This simplifies the code a lot and a lot of
      complicated casts and indexing can be removed. Leaving less and more simple
      code.
      
      This patch doesn't fix the memprotection but it doesn't regress it either.
      It does however make the next changes smaller and fixes the alignments.
      
      Test Plan: ./validate , new test T13617
      
      Reviewers: bgamari, erikd, simonmar, hvr, angerman
      
      Reviewed By: angerman
      
      Subscribers: nickkuk, carter, RyanGlScott, rwbarton, thomie
      
      GHC Trac Issues: #13617
      
      Differential Revision: https://phabricator.haskell.org/D3915
      58407343
    • Sebastian Graf's avatar
      Make sure forM_ and related functions fuse cleanly · e655aac1
      Sebastian Graf authored
      Summary:
      It was revealed in #8763 that it's hard to come up with a list fusion
      helper for `efdtIntFB` that doesn't duplicated occurrences of `c`,
      which is crucial in guaranteeing that it is inlined.
      
      Not inlining `c` led to spoiled join points, in turn leading to unnecessary
      heap allocation. This patch tackles the problem from a different angle:
      Fixing all consumers instead of the less often used producer
      `efdtIntFB` by inserting an INLINE pragma in the appropriate places.
      See https://ghc.haskell.org/trac/ghc/ticket/8763#comment:76 and the new
      Note [List fusion and continuations in 'c'].
      
      A quick run of NoFib revealed no regression or improvements whatsoever.
      
      Reviewers: hvr, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter
      
      GHC Trac Issues: #8763
      
      Differential Revision: https://phabricator.haskell.org/D5131
      e655aac1
    • Takenobu Tani's avatar
      users-guide: Fix code-block layout for QuantifiedConstraints · 43967c0c
      Takenobu Tani authored
      Summary:
      Fix code-block layout for QuantifiedConstraints.
      
      [ci skip]
      
      Test Plan: build
      
      Reviewers: bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5121
      43967c0c
    • Ben Gamari's avatar
      base: Add bangs to GHC.IO.Handle.Text hGet* functions · 88130dbe
      Ben Gamari authored
      Summary:
      I believe that demand analysis doesn't notice that these are morally strict in
      the pointer argument due to the `count == 0` special case. Fixes #15638.
      
      Test Plan: Validate
      
      Reviewers: andrewthad, hvr
      
      Reviewed By: andrewthad
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15638
      
      Differential Revision: https://phabricator.haskell.org/D5149
      88130dbe
    • David Feuer's avatar
      Stable name comment wibbles · d1c2f298
      David Feuer authored
      Summary:
      Some comments in the `StableName` code still referred to
      stable pointer details. Fix that.
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5152
      d1c2f298
  8. 16 Sep, 2018 1 commit
  9. 15 Sep, 2018 2 commits
    • Richard Eisenberg's avatar
      Correct submodule update for haddock · a3bce956
      Richard Eisenberg authored
      Previous commit (Coercion Quantification) was missing a
      commit on the haddock submodule. This (hopefully) corrects it.
      a3bce956
    • Ningning Xie's avatar
      Coercion Quantification · ea5ade34
      Ningning Xie authored
      This patch corresponds to #15497.
      
      According to https://ghc.haskell.org/trac/ghc/wiki/DependentHaskell/Phase2,
       we would like to have coercion quantifications back. This will
      allow us to migrate (~#) to be homogeneous, instead of its current
      heterogeneous definition. This patch is (lots of) plumbing only. There
      should be no user-visible effects.
      
      An overview of changes:
      
      - Both `ForAllTy` and `ForAllCo` can quantify over coercion variables,
      but only in *Core*. All relevant functions are updated accordingly.
      - Small changes that should be irrelevant to the main task:
          1. removed dead code `mkTransAppCo` in Coercion
          2. removed out-dated Note Computing a coercion kind and
             roles in Coercion
          3. Added `Eq4` in Note Respecting definitional equality in
             TyCoRep, and updated `mkCastTy` accordingly.
          4. Various updates and corrections of notes and typos.
      - Haddock submodule needs to be changed too.
      
      Acknowledgments:
      This work was completed mostly during Ningning Xie's Google Summer
      of Code, sponsored by Google. It was advised by Richard Eisenberg,
      supported by NSF grant 1704041.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, bgamari, hvr, erikd, simonmar
      
      Subscribers: RyanGlScott, monoidal, rwbarton, carter
      
      GHC Trac Issues: #15497
      
      Differential Revision: https://phabricator.haskell.org/D5054
      ea5ade34
  10. 14 Sep, 2018 5 commits
    • Sergei Azovskov's avatar
      Mark code related symbols as @function not @object · c23f057f
      Sergei Azovskov authored
      Summary:
      This diff is a part of the bigger project which goal is to improve
      common profiling tools support (perf) for GHC binaries.
      
      A similar job was already done and reverted in the past:
       * https://phabricator.haskell.org/rGHCb1f453e16f0ce11a2ab18cc4c350bdcbd36299a6
       * https://phabricator.haskell.org/rGHCf1f3c4f50650110ad0f700d6566a44c515b0548f
      
      Reasoning:
      
      `Perf` and similar tools build in memory symbol table from the .symtab
      section of the ELF file to display human-readable function names instead
      of the addresses in the output. `Perf` uses only two types of symbols:
      `@function` and `@notype` but GHC is not capable to produce any
      `@function` symbols so the `perf` output is pretty useless (All the
      haskell symbols that you can see in `perf` now are `@notype` internal
      symbols extracted by mistake/hack).
      
      The changes:
       * mark code related symbols as @function
       * small hack to mark InfoTable symbols as code if TABLES_NEXT_TO_CODE is true
      
      Limitations:
       * The perf symbolization support is not complete after this patch but
         I'm working on the second patch.
       * Constructor symbols are not supported. To fix that we can issue extra
         local symbols which mark code sections as code and will be only used
         for debug.
      
      Test Plan:
      tests
      any additional ideas?
      
      Perf output on stock ghc 8.4.1:
      ```
           9.78%  FibbSlow  FibbSlow            [.] ckY_info
           9.59%  FibbSlow  FibbSlow            [.] cjqd_info
           7.17%  FibbSlow  FibbSlow            [.] c3sg_info
           6.62%  FibbSlow  FibbSlow            [.] c1X_info
           5.32%  FibbSlow  FibbSlow            [.] cjsX_info
           4.18%  FibbSlow  FibbSlow            [.] s3rN_info
           3.82%  FibbSlow  FibbSlow            [.] c2m_info
           3.68%  FibbSlow  FibbSlow            [.] cjlJ_info
           3.26%  FibbSlow  FibbSlow            [.] c3sb_info
           3.19%  FibbSlow  FibbSlow            [.] cjPQ_info
           3.05%  FibbSlow  FibbSlow            [.] cjQd_info
           2.97%  FibbSlow  FibbSlow            [.] cjAB_info
           2.78%  FibbSlow  FibbSlow            [.] cjzP_info
           2.40%  FibbSlow  FibbSlow            [.] cjOS_info
           2.38%  FibbSlow  FibbSlow            [.] s3rK_info
           2.27%  FibbSlow  FibbSlow            [.] cjq0_info
           2.18%  FibbSlow  FibbSlow            [.] cKQ_info
           2.13%  FibbSlow  FibbSlow            [.] cjSl_info
           1.99%  FibbSlow  FibbSlow            [.] s3rL_info
           1.98%  FibbSlow  FibbSlow            [.] c2cC_info
           1.80%  FibbSlow  FibbSlow            [.] s3rO_info
           1.37%  FibbSlow  FibbSlow            [.] c2f2_info
      ...
      ```
      
      Perf output on patched ghc:
      ```
           7.97%  FibbSlow  FibbSlow            [.] c3rM_info
           6.75%  FibbSlow  FibbSlow            [.] 0x000000000032cfa8
           6.63%  FibbSlow  FibbSlow            [.] cifA_info
           4.98%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
           4.55%  FibbSlow  FibbSlow            [.] chXn_info
           4.52%  FibbSlow  FibbSlow            [.] c3rH_info
           4.45%  FibbSlow  FibbSlow            [.] chZB_info
           4.04%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
           4.03%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
           3.76%  FibbSlow  FibbSlow            [.] chXA_info
           3.67%  FibbSlow  FibbSlow            [.] cifu_info
           3.25%  FibbSlow  FibbSlow            [.] ci4r_info
           2.64%  FibbSlow  FibbSlow            [.] s3rf_info
           2.42%  FibbSlow  FibbSlow            [.] s3rg_info
           2.39%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
           2.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
           2.17%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
           2.09%  FibbSlow  FibbSlow            [.] cicc_info
           2.03%  FibbSlow  FibbSlow            [.] 0x0000000000331e15
           2.02%  FibbSlow  FibbSlow            [.] s3ri_info
           1.91%  FibbSlow  FibbSlow            [.] 0x0000000000331bb8
           1.89%  FibbSlow  FibbSlow            [.] ci4N_info
      ...
      ```
      
      Reviewers: simonmar, niteria, bgamari, goldfire
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: lelf, rwbarton, thomie, carter
      
      GHC Trac Issues: #15501
      
      Differential Revision: https://phabricator.haskell.org/D4713
      c23f057f
    • Sergei Azovskov's avatar
      Mark system and internal symbols as private symbols in asm · 64c54fff
      Sergei Azovskov authored
      Summary:
      This marks system and internal symbols as private in asm output so those
      random generated sysmbols won't appear in .symtab
      
      Reasoning:
       * internal symbols don't help to debug because names are just random
       * the symbols style breaks perf logic
       * internal symbols can take ~75% of the .symtab. In the same time
         .symtab can take about 20% of the binary file size
      
      Notice:
      This diff mostly makes sense on top of the D4713 (or similar)
      
      Test Plan:
      tests
      
      Perf from D4713
      ```
           7.97%  FibbSlow  FibbSlow            [.] c3rM_info
           6.75%  FibbSlow  FibbSlow            [.] 0x000000000032cfa8
           6.63%  FibbSlow  FibbSlow            [.] cifA_info
           4.98%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
           4.55%  FibbSlow  FibbSlow            [.] chXn_info
           4.52%  FibbSlow  FibbSlow            [.] c3rH_info
           4.45%  FibbSlow  FibbSlow            [.] chZB_info
           4.04%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
           4.03%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
           3.76%  FibbSlow  FibbSlow            [.] chXA_info
           3.67%  FibbSlow  FibbSlow            [.] cifu_info
           3.25%  FibbSlow  FibbSlow            [.] ci4r_info
           2.64%  FibbSlow  FibbSlow            [.] s3rf_info
           2.42%  FibbSlow  FibbSlow            [.] s3rg_info
           2.39%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
           2.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
           2.17%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
           2.09%  FibbSlow  FibbSlow            [.] cicc_info
           2.03%  FibbSlow  FibbSlow            [.] 0x0000000000331e15
           2.02%  FibbSlow  FibbSlow            [.] s3ri_info
           1.91%  FibbSlow  FibbSlow            [.] 0x0000000000331bb8
           1.89%  FibbSlow  FibbSlow            [.] ci4N_info
      ...
      ```
      
      Perf from this patch:
      ```
          15.37%  FibbSlow  FibbSlow            [.] Main_fibbzuslow_info
          15.33%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_minusInteger_info
          13.34%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqIntegerzh_info
           9.24%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_plusInteger_info
           9.08%  FibbSlow  FibbSlow            [.] frame_dummy
           8.25%  FibbSlow  FibbSlow            [.] integerzmgmp_GHCziIntegerziType_eqInteger_info
           4.29%  FibbSlow  FibbSlow            [.] 0x0000000000321ab0
           3.84%  FibbSlow  FibbSlow            [.] stg_ap_0_fast
           3.07%  FibbSlow  FibbSlow            [.] ghczmprim_GHCziClasses_zeze_info
           2.39%  FibbSlow  FibbSlow            [.] 0x0000000000321ab7
           1.90%  FibbSlow  FibbSlow            [.] 0x00000000003266b8
           1.88%  FibbSlow  FibbSlow            [.] base_GHCziNum_zm_info
           1.83%  FibbSlow  FibbSlow            [.] 0x0000000000326915
           1.34%  FibbSlow  FibbSlow            [.] 0x00000000003248cc
           1.07%  FibbSlow  FibbSlow            [.] base_GHCziNum_zp_info
           0.98%  FibbSlow  FibbSlow            [.] 0x00000000003247c8
           0.80%  FibbSlow  FibbSlow            [.] 0x0000000000121498
           0.79%  FibbSlow  FibbSlow            [.] stg_gc_noregs
           0.75%  FibbSlow  FibbSlow            [.] 0x0000000000321ad6
           0.67%  FibbSlow  FibbSlow            [.] 0x0000000000321aca
           0.64%  FibbSlow  FibbSlow            [.] 0x0000000000321b4a
           0.61%  FibbSlow  FibbSlow            [.] 0x00000000002ff633
      ```
      
      Reviewers: simonmar, niteria, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: lelf, angerman, olsner, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4722
      64c54fff
    • Krzysztof Gogolewski's avatar
      Fix T15502 on 32-bit · ecbe26b6
      Krzysztof Gogolewski authored
      Summary:
      The expected output uses a hardcoded value for
      maxBound :: Int.
      
      This should fix one of circleci failures on i386.
      
      Test Plan: make test TEST=T15502
      
      Reviewers: RyanGlScott, bgamari
      
      Reviewed By: RyanGlScott
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15502
      
      Differential Revision: https://phabricator.haskell.org/D5151
      ecbe26b6
    • Alp Mestanogullari's avatar
      tests: increase (compile) timeout multiplier for T13701 and MultiLayerModules · 3040444d
      Alp Mestanogullari authored
      Summary:
      Those tests are currently making our i386 validation fail on CircleCI:
      
        https://circleci.com/gh/ghc/ghc/8827
      
      Test Plan: Using my Phab<->CircleCI bridge to run i386 validation for this diff.
      
      Reviewers: bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15484, #15383
      
      Differential Revision: https://phabricator.haskell.org/D5103
      3040444d
    • Michael Sloan's avatar
      Add support for ImplicitParams and RecursiveDo in TH · 9c6b7493
      Michael Sloan authored
      Summary:
      This adds TH support for the ImplicitParams and RecursiveDo extensions.
      
      I'm submitting this as one review because I cannot cleanly make
      the two commits independent.
      
      Initially, my goal was just to add ImplicitParams support, and
      I found that reasonably straightforward, so figured I might
      as well use my newfound knowledge to address some other TH omissions.
      
      Test Plan: Validate
      
      Reviewers: goldfire, austin, bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: carter, RyanGlScott, thomie
      
      GHC Trac Issues: #1262
      
      Differential Revision: https://phabricator.haskell.org/D1979
      9c6b7493
  11. 13 Sep, 2018 1 commit