Skip to content
Snippets Groups Projects
  1. Oct 09, 2021
    • 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
  2. Oct 08, 2021
    • 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.20210928.so: error: undefined reference to '.Lc5sm_info'
      collect2: error: ld returned 1 exit status
      `cc' failed in phase `Linker'. (Exit code: 1)
      Development.Shake.cmd, system command failed
      ```
      
      Unfortunately, by the time this optimisation happens the structure of
      the CmmInfoTable has been lost, we only have the generated code for the
      info table to play with so we can no longer just collect all the used
      info tables and generate the IPE map.
      
      This leaves us with two options:
      
      1. Return a list of the names of the discarded info tables and then
         remove them from the map. This is awkward because we need to do code
         generation for the map as well.
      2. Just disable this small code size optimisation when -finfo-table-map
         is enabled. The option produces very big object files anyway.
      
      Option 2 is much easier to implement and means we don't have to thread
      information around awkwardly. It's at the cost of slightly larger object
      files (as dead code is not eliminated).
      
      Disabling this optimisation allows an IPE build of GHC to complete
      successfully.
      
      Fixes #20428
      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
  3. Oct 07, 2021
  4. Oct 06, 2021
    • 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
    • Dominik Peteler's avatar
      Corrected types of thread ids obtained from the RTS · 435ff398
      Dominik Peteler authored and Marge Bot's avatar Marge Bot committed
      While the thread ids had been changed to 64 bit words in
      e57b7cc6 the return type of the foreign
      import function used to retrieve these ids - namely
      'GHC.Conc.Sync.getThreadId' - was never updated accordingly.
      In order to fix that this function returns now a 'CUULong'.
      
      In addition to that the types used in the thread labeling subsystem were
      adjusted as well and several format strings were modified throughout the
      whole RTS to display thread ids in a consistent and correct way.
      
      Fixes #16761
      435ff398
  5. Oct 05, 2021
    • Zubin's avatar
      docs: Clarify documentation of `getFileSystemEncoding` (#20344) · 29ee04f3
      Zubin authored and Marge Bot's avatar Marge Bot committed
      It may not always be a Unicode encoding
      29ee04f3
    • Sylvain Henry's avatar
      Constant folding for (.&.) maxBound (#20448) · 11240b74
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      11240b74
    • Simon Peyton Jones's avatar
      Ensure top-level binders in scope in SetLevels · 52400ebb
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      Ticket #20200 (the Agda failure) showed another case in which
      lookupIdSubst would fail to find a local Id in the InScopeSet.
      This time it was because SetLevels was given a program in which
      the top-level bindings were not in dependency order.
      
      The Simplifier (see Note [Glomming] in GHC.Core.Opt.Occuranal) and
      the specialiser (see Note [Top level scope] in GHC.Core.Opt.Specialise)
      may both produce top-level bindings where an early binding refers
      to a later one.
      
      One solution would be to run the occurrence analyser again to
      put them all in the right order. But a simpler one is to make
      SetLevels OK with this input by bringing all top-level binders into
      scope at the start. That's what this patch does.
      52400ebb
    • Alfredo Di Napoli's avatar
      Eradicate TcRnUnknownMessage from GHC.Tc.Deriv · ac275f42
      Alfredo Di Napoli authored and Marge Bot's avatar Marge Bot committed
      This (big) commit finishes porting the GHC.Tc.Deriv module to support
      the new diagnostic infrastructure (#18516) by getting rid of the legacy
      calls to `TcRnUnknownMessage`. This work ended up being quite pervasive
      and touched not only the Tc.Deriv module but also the Tc.Deriv.Utils and
      Tc.Deriv.Generics module, which needed to be adapted to use the new
      infrastructure. This also required generalising `Validity`.
      
      More specifically, this is a breakdown of the work done:
      
      * Add and use the TcRnUselessTypeable data constructor
      * Add and use TcRnDerivingDefaults data constructor
      * Add and use the TcRnNonUnaryTypeclassConstraint data constructor
      * Add and use TcRnPartialTypeSignatures
      * Add T13324_compile2 test to test another part of the
        TcRnPartialTypeSignatures diagnostic
      * Add and use TcRnCannotDeriveInstance data constructor, which introduces a
        new data constructor to TcRnMessage called TcRnCannotDeriveInstance, which
        is further sub-divided to carry a `DeriveInstanceErrReason` which explains
        the reason why we couldn't derive a typeclass instance.
      * Add DerivErrSafeHaskellGenericInst data constructor to DeriveInstanceErrReason
      * Add DerivErrDerivingViaWrongKind and DerivErrNoEtaReduce
      * Introduce the SuggestExtensionInOrderTo Hint, which adds (and use) a new
        constructor to the hint type `LanguageExtensionHint` called `SuggestExtensionInOrderTo`,
        which can be used to give a bit more "firm" recommendations when it's
        obvious what the required extension is, like in the case for the
        `DerivingStrategies`, which automatically follows from having enabled
        both `DeriveAnyClass` and `GeneralizedNewtypeDeriving`.
      * Wildcard-free pattern matching in mk_eqn_stock, which removes `_` in
        favour of pattern matching explicitly on `CanDeriveAnyClass` and
        `NonDerivableClass`, because that determine whether or not we can
        suggest to the user `DeriveAnyClass` or not.
      ac275f42
    • Alfredo Di Napoli's avatar
      Make GHC.Utils.Error.Validity type polymorphic · f52df067
      Alfredo Di Napoli authored and Marge Bot's avatar Marge Bot committed
      This commit makes the `Validity` type polymorphic:
      
      ```
      data Validity' a
        = IsValid      -- ^ Everything is fine
        | NotValid a   -- ^ A problem, and some indication of why
      
      -- | Monomorphic version of @Validity'@ specialised for 'SDoc's.
      type Validity = Validity' SDoc
      ```
      
      The type has been (provisionally) renamed to Validity' to not break
      existing code, as the monomorphic `Validity` type is quite pervasive
      in a lot of signatures in GHC.
      
      Why having a polymorphic Validity? Because it carries the evidence of
      "what went wrong", but the old type carried an `SDoc`, which clashed
      with the new GHC diagnostic infrastructure (#18516). Having it
      polymorphic it means we can carry an arbitrary, richer diagnostic type,
      and this is very important for things like the
      `checkOriginativeSideConditions` function, which needs to report the
      actual diagnostic error back to `GHC.Tc.Deriv`.
      
      It also generalises Validity-related functions to be polymorphic in @a@.
      f52df067
    • vdukhovni's avatar
      Explain Endo, Dual, ... in laws · 5282eaa1
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      5282eaa1
    • vdukhovni's avatar
      Adopt David Feuer's explantion of foldl' via foldr · f49c7012
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      f49c7012
    • vdukhovni's avatar
      Minor wording tweaks/fixes · fb6b772f
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      fb6b772f
    • vdukhovni's avatar
      Note elem ticket 20421 · 56899c8d
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      56899c8d
    • vdukhovni's avatar
      Note linear `elem` cost · 43358ab9
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      This is a writeup of the state of play for better than linear `elem` via
      a helper type class.
      43358ab9
    • vdukhovni's avatar
      Add laws link and tweak Traversable class text · 7059a729
      vdukhovni authored and Marge Bot's avatar Marge Bot committed
      7059a729
Loading