1. 12 Oct, 2021 10 commits
    • Matthew Pickering's avatar
      Make ms_ghc_prim_import field strict · e40feab0
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      If you don't promptly force this field then it ends up retaining a lot
      of data structures related to parsing.
      
      For example, the following retaining chain can be observed when using
      GHCi.
      
      ```
      PState 0x4289365ca0 0x4289385d68 0x4289385db0 0x7f81b37a7838 0x7f81b3832fd8 0x4289365cc8 0x4289365cd8 0x4289365cf0 0x4289365cd8 0x4289365d08 0x4289385e48 0x7f81b4e4c290 0x7f818f63f440 0x7f818f63f440 0x7f81925ccd18 0x7f81b4e41230 0x7f818f63f440 0x7f81925ccd18 0x7f818f63f4a8 0x7f81b3832fd8 0x7f81b3832fd8 0x4289365d20 0x7f81b38233b8 0 19 <PState:GHC.Parser.Lexer:_build-ipe/stage1/compiler/build/GHC/Parser/Lexer.hs:3779:46>
      _thunk(  ) 0x4289384230 0x4289384160 <([LEpaComment], [LEpaComment]):GHC.Parser.Lexer:>
      _thunk(  ) 0x4289383250 <EpAnnComments:GHC.Parser.Lexer:compiler/GHC/Parser/Lexer.x:2306:19-40>
      _thunk(  ) 0x4289399850 0x7f818f63f440 0x4289399868 <SrcSpanAnnA:GHC.Parser:_build-ipe/stage1/compiler/build/GHC/Parser.hs:12527:13-30>
      L 0x4289397600 0x42893975a8 <GenLocated:GHC.Parser:_build-ipe/stage1/compiler/build/GHC/Parser.hs:12527:32>
      0x4289c4e8c8 : 0x4289c4e8b0 <[]:GHC.Parser.Header:compiler/GHC/Parser/Header.hs:104:36-54>
      (0x4289c4da70,0x7f818f63f440) <(,):GHC.Parser.Header:compiler/GHC/Parser/Header.hs:104:36-54>
      _thunk(  ) 0x4289c4d030 <Bool:GHC.Parser.Header:compiler/GHC/Parser/Header.hs:(112,22)-(115,27)>
      ExtendedModSummary 0x422e9c8998 0x7f81b617be78 0x422e9c89b0 0x4289c4c0c0 0x7f81925ccd18 0x7f81925ccd18 0x7f81925ccd18 0x7f81925ccd18 0x7f818f63f440 0x4289c4c0d8 0x4289c4c0f0 0x7f81925ccd18 0x422e9c8a20 0x4289c4c108 0x4289c4c730 0x7f818f63f440 <ExtendedModSummary:GHC.Driver.Make:compiler/GHC/Driver/Make.hs:2041:30-38>
      ModuleNode 0x4289c4b850 <ModuleGraphNode:GHC.Unit.Module.Graph:compiler/GHC/Unit/Module/Graph.hs:139:14-36>
      0x4289c4b590 : 0x4289c4b578 <[]:GHC.Unit.Module.Graph:compiler/GHC/Unit/Module/Graph.hs:139:31-36>
      ModuleGraph 0x4289c4b2f8 0x4289c4b310 0x4289c4b340 0x7f818f63f4a0 <ModuleGraph:GHC.Driver.Make:compiler/GHC/Driver/Make.hs:(242,19)-(244,40)>
      HscEnv 0x4289d9a4a8 0x4289d9aad0 0x4289d9aae8 0x4217062a88 0x4217060b38 0x4217060b58 0x4217060b68 0x7f81b38a7ce0 0x4217060b78 0x7f818f63f440 0x7f818f63f440 0x4217062af8 0x4289d9ab10 0x7f81b3907b60 0x4217060c00 114 <HscEnv:GHC.Runtime.Eval:compiler/GHC/Runtime/Eval.hs:790:31-44>
      ```
      e40feab0
    • Zubin's avatar
      driver: Share the graph of dependencies · 44384696
      Zubin authored and Marge Bot's avatar Marge Bot committed
      We want to share the graph instead of recomputing it for each key.
      44384696
    • CarrieMY's avatar
      Change affected tests stderr · 8e88ef36
      CarrieMY authored and Marge Bot's avatar Marge Bot committed
      8e88ef36
    • CarrieMY's avatar
      Add Hint to "Empty 'do' block" Error Message#20147 · 58223dfa
      CarrieMY authored and Marge Bot's avatar Marge Bot committed
      58223dfa
    • GHC GitLab CI's avatar
      rts/Linker: Fix __dso_handle handling · 2c06720e
      GHC GitLab CI authored and Marge Bot's avatar Marge Bot committed
      Previously the linker's handling of __dso_handle was quite wrong. Not
      only did we claim that __dso_handle could be NULL when statically
      linking (which it can not), we didn't even implement this mislead theory
      faithfully and instead resolved the symbol to a random pointer. This
      lead to the failing relocations on AArch64 noted in #20493.
      
      Here we try to implement __dso_handle as a dynamic linker would do,
      choosing an address within the loaded object (specifically its start
      address) to serve as the object's handle.
      2c06720e
    • Ben Gamari's avatar
      rts/nonmoving: Enable selector optimisation by default · 2e0c13ab
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      2e0c13ab
    • Ben Gamari's avatar
      rts/primops: Fix write barrier in stg_atomicModifyMutVarzuzh · 2c02ea8d
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously the call to dirty_MUT_VAR in stg_atomicModifyMutVarzuzh was
      missing its final argument.
      
      Fixes #20414.
      2c02ea8d
    • Ben Gamari's avatar
      rts/nonmoving: Rename mark_* to trace_* · aa520ba1
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      These functions really do no marking; they merely trace pointers.
      aa520ba1
    • Ben Gamari's avatar
      nonmoving: Fix and factor out mark_trec_chunk · 8d6de541
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      We need to ensure that the TRecChunk itself is marked, in addition to
      the TRecs it contains.
      8d6de541
    • Zejun Wu's avatar
      Derive Eq instance for the HieTypeFix type · 9f9d6280
      Zejun Wu authored and Marge Bot's avatar Marge Bot committed
      We have `instance Eq a => Eq (HieType a)` already. This instance can be
      handy when we want to impement a function to find all
      `fromIntegral :: a -> a` using
      `case ty of { Roll (HFunTy _ a b) -> a == b; _ -> False }`.
      9f9d6280
  2. 10 Oct, 2021 2 commits
  3. 09 Oct, 2021 1 commit
    • sheaf's avatar
      Reject GADT pattern matches in arrow notation · 31983ab4
      sheaf authored and Marge Bot's avatar Marge Bot committed
        Tickets #20469 and #20470 showed that the current
        implementation of arrows is not at all up to the task
        of supporting GADTs: GHC produces ill-scoped Core programs
        because it doesn't propagate the evidence introduced by a GADT
        pattern match.
      
        For the time being, we reject GADT pattern matches in arrow notation.
        Hopefully we are able to add proper support for GADTs in arrows
        in the future.
      31983ab4
  4. 08 Oct, 2021 15 commits
    • abarbu's avatar
      Add defaulting plugins. · a76409c7
      abarbu authored
      Like the built-in type defaulting rules these plugins can propose candidates
      to resolve ambiguous type variables.
      
      Machine learning and other large APIs like those for game engines introduce
      new numeric types and other complex typed APIs. The built-in defaulting
      mechanism isn't powerful enough to resolve ambiguous types in these cases forcing
      users to specify minutia that they might not even know how to do. There is
      an example defaulting plugin linked in the documentation. Applications include
      defaulting the device a computation executes on, if a gradient should be
      computed for a tensor, or the size of a tensor.
      
      See https://github.com/ghc-proposals/ghc-proposals/pull/396 for details.
      a76409c7
    • Matthew Pickering's avatar
      code gen: Disable dead code elimination when -finfo-table-map is enabled · 55a6377a
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      It's important that when -finfo-table-map is enabled that we generate
      IPE entries just for those info tables which are actually used. To this
      end, the info tables which are used are collected just before code
      generation starts and entries only created for those tables.
      
      Not accounted for in this scheme was the dead code elimination in the
      native code generator. When compiling GHC this optimisation removed an
      info table which had an IPE entry which resulting in the following kind
      of linker error:
      
      ```
      /home/matt/ghc-with-debug/_build/stage1/lib/../lib/x86_64-linux-ghc-9.3.20210928/libHSCabal-3.5.0.0-ghc9.3.20210928.so: error: undefined reference to '.Lc5sS_info'
      /home/matt/ghc-with-debug/_build/stage1/lib/../lib/x86_64-linux-ghc-9.3.20210928/libHSCabal-3.5.0.0-ghc9.3.20210928.so: error: undefined reference to '.Lc5sH_info'
      /home/matt/ghc-with-debug/_build/stage1/lib/../lib/x86_64-linux-ghc-9.3.20210928/libHSCabal-3.5.0.0-ghc9.3.202109...
      55a6377a
    • CarrieMY's avatar
      Fix -E -fno-code undesirable interactions #20439 · 816d2561
      CarrieMY authored and Marge Bot's avatar Marge Bot committed
      816d2561
    • Matthew Pickering's avatar
      Normalise output of T20199 test · 1f160cd9
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      1f160cd9
    • Matthew Pickering's avatar
      ci: Expect x86-darwin to pass · e6838872
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Closes #20013
      e6838872
    • Matthew Pickering's avatar
      ci: Remove BROKEN_TESTS for x86 darwin builds · a37275a3
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      The tests Capi_Ctype_001 Capi_Ctype_002 T12010 pass regularly on CI so
      let's mark them unbroken and hopefully then we can fix #20013.
      a37275a3
    • Teo Camarasu's avatar
      Fix nonmoving gen label in gc stats report · 374a718e
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      The current code assumes the non-moving generation is always
      generation 1, but this isn't the case if the amount of generations
      is greater than 2
      
      Fixes #20461
      374a718e
    • Joachim Breitner's avatar
      New test case: Variant of T14052 with data type definitions · 75aea732
      Joachim Breitner authored and Marge Bot's avatar Marge Bot committed
      previous attempts at fixing #11547 and #20455 were reverted because they
      showed some quadratic behaviour, and the test case T15052 was added to
      catch that.
      
      I believe that similar quadratic behavor can be triggered with current
      master, by using type definitions rather than value definitions, so this
      adds a test case similar to T14052. I have hopes that my attempts at
      fixing #11547 will lead to code that avoid the quadratic increase here.
      Or not, we will see. In any case, having this in `master` and included
      in future comparisons will be useful.
      75aea732
    • Sylvain Henry's avatar
      Don't link plugins' units with target code (#20218) · 3d31f11e
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Before this patch, plugin units were linked with the target code even
      when the unit was passed via `-plugin-package`. This is an issue to
      support plugins in cross-compilers (plugins are definitely not ABI
      compatible with target code).
      
      We now clearly separate unit dependencies for plugins and unit
      dependencies for target code and only link the latter ones.
      
      We've also added a test to ensure that plugin units passed via
      `-package` are linked with target code so that `thNameToGhcName` can
      still be used in plugins that need it (see T20218b).
      3d31f11e
    • Joachim Breitner's avatar
      Recover test case for T11547 · 01f5324f
      Joachim Breitner authored and Marge Bot's avatar Marge Bot committed
      commit 98c7749c has reverted commit 59d7ee53, including the test that
      that file added. That test case is still valuable, so I am re-adding it.
      I add it with it’s current (broken) behavior so that whoever fixes it
      intentionally or accidentially will notice and then commit the actual
      desired behavior (which is kinda unspecified, see
      ghc/ghc#20455 (comment 382030))
      01f5324f
    • Sylvain Henry's avatar
      Bignum: transfer NOINLINE from Natural to BigNat · 4d44058d
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      4d44058d
    • Sylvain Henry's avatar
      Bignum: remove outdated comment · 714568bb
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      714568bb
    • Sylvain Henry's avatar
      Bignum: allow naturalToWordClamp/Negate/Signum to inline (#20361) · 3a5a5c85
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      We don't need built-in rules now that bignum literals (e.g. 123 :: Natural)
      match with their constructors (e.g. NS 123##).
      3a5a5c85
    • Sylvain Henry's avatar
      Bignum: allow inlining of naturalEq/Ne/Gt/Lt/Ge/Le/Compare (#20361) · 44886aab
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Perform constant folding on bigNatCompare instead.
      
      Some functions of the Enum class for Natural now need to be inlined
      explicitly to be specialized at call sites (because `x > lim` for
      Natural is inlined and the resulting function is a little too big to
      inline). If we don't do this, T17499 runtime allocations regresses by
      16%.
      44886aab
    • Sylvain Henry's avatar
      Bignum: allow naturalEq#/Ne# to inline (#20361) · e1d02fb0
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      We now perform constant folding on bigNatEq# instead.
      e1d02fb0
  5. 07 Oct, 2021 6 commits
  6. 06 Oct, 2021 6 commits
    • sheaf's avatar
      Improve overlap error for polykinded constraints · a466b024
      sheaf authored and Marge Bot's avatar Marge Bot committed
      There were two problems around `mkDictErr`:
      
        1. An outdated call to `flattenTys` meant that we missed out on some
           instances. As we no longer flatten type-family applications,
           the logic is obsolete and can be removed.
      
        2. We reported "out of scope" errors in a poly-kinded situation
           because `BoxedRep` and `Lifted` were considered out of scope.
           We fix this by using `pretendNameIsInScope`.
      
      fixes #20465
      a466b024
    • Matthew Pickering's avatar
      Disable -dynamic-too if -dynamic is also passed · 9af29e7f
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Before if you passed both options then you would generate two identical
      hi/dyn_hi and o/dyn_o files, both in the dynamic way. It's better to
      warn this is happening rather than duplicating the work and causing
      potential confusion.
      
      -dynamic-too should only be used with -static.
      
      Fixes #20436
      9af29e7f
    • Sebastian Graf's avatar
      CprAnal: Two regression tests · 7fc986e1
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      For #16040 and #2387.
      7fc986e1
    • sheaf's avatar
      Add a regression test for #13233 · 4e91839a
      sheaf authored and Marge Bot's avatar Marge Bot committed
        This test fails on GHC 8.0.1, only when profiling is enabled,
        with the error:
      
          ghc: panic! (the 'impossible' happened)
            kindPrimRep.go a_12
      
        This was fixed by commit b460d6c9.
      4e91839a
    • Ryan Scott's avatar
      Remove the Maybe in primRepName's type · fc4c7ffb
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      There's no need for this `Maybe`, as it will always be instantiated to `Just`
      in practice.
      
      Fixes #20482.
      fc4c7ffb
    • Alan Zimmerman's avatar
      EPA: Remove duplicate AnnOpenP/AnnCloseP in DataDecl · 89e98bdf
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      The parens EPAs were added in the tyvars where they belong, but also
      at the top level of the declaration.
      
      Closes #20452
      89e98bdf