Skip to content
Snippets Groups Projects
  1. Aug 21, 2023
    • Zubin's avatar
      Prepare release 9.4.7 · 00920f17
      Zubin authored
    • Ben Gamari's avatar
      users-guide: Ensure extlinks is compatible with Sphinx <4 · e6e11bb3
      Ben Gamari authored and Zubin's avatar Zubin committed
      The semantics of the `extlinks` attribute annoyingly changed in Sphinx
      4. Reflect this in our configuration. See #22690.
      
      Fixes #23807.
      
      (cherry picked from commit 1726db3f)
      e6e11bb3
    • Ben Gamari's avatar
      users-guide: Support both distutils and packaging · 6d938a62
      Ben Gamari authored and Zubin's avatar Zubin committed
      As noted in #23818, some old distributions (e.g. Debian 9) only include
      `distutils` while newer distributions only include `packaging`.
      
      Fixes #23818.
      
      (cherry picked from commit d814bda9)
      6d938a62
    • Matthew Pickering's avatar
      Build vanilla alpine bindists · d8b5ea0f
      Matthew Pickering authored and Zubin's avatar Zubin committed
      We currently attempt to build and distribute fully static alpine
      bindists (ones which could be used on any linux platform) but most
      people who use the alpine bindists want to use alpine to build their own
      static applications (for which a fully static bindist is not necessary).
      We should build and distribute these bindists for these users whilst the
      fully-static bindist is still unusable.
      
      Fixes #23349
      
      (cherry picked from commit 29be39ba)
      d8b5ea0f
    • Jens Petersen's avatar
      make hadrian buildable with Cabal-3.8 · 39f728a6
      Jens Petersen authored and Zubin's avatar Zubin committed
      (cherry picked from commit 5042fb14)
      39f728a6
    • Simon Peyton Jones's avatar
      Fix a scoping bug in the Specialiser · 067db92e
      Simon Peyton Jones authored and Zubin's avatar Zubin committed
      In the call to `specLookupRule` in `already_covered`, in `specCalls`,
      we need an in-scope set that includes the free vars of the arguments.
      But we simply were not guaranteeing that: did not include the
      `rule_bndrs`.
      
      Easily fixed.  I'm not sure how how this bug has lain for quite
      so long without biting us.
      
      Fixes #21828.
      
      (cherry picked from commit 46050534)
      067db92e
    • Simon Peyton Jones's avatar
      Ensure floated dictionaries are in scope (again) · 15c1f32f
      Simon Peyton Jones authored and Zubin's avatar Zubin committed
      In the Specialiser, we missed one more call to
      bringFloatedDictsIntoScope (see #21391).
      
      This omission led to #21689. The problem is that the call
      to `rewriteClassOps` needs to have in scope any dictionaries
      floated out of the arguments we have just specialised.
      
      Easy fix.
      
      (cherry picked from commit 04209f2a)
      15c1f32f
    • Simon Peyton Jones's avatar
      Improve floated dicts in Specialise · ca2cd38a
      Simon Peyton Jones authored and Zubin's avatar Zubin committed
      Second fix to #21391.  It turned out that we missed calling
      bringFloatedDictsIntoScope when specialising imports, which
      led to the same bug as before.
      
      I refactored to move that call to a single place, in specCalls,
      so we can't forget it.
      
      This meant making `FloatedDictBinds` into its own type, pairing
      the dictionary bindings themselves with the set of their binders.
      Nicer this way.
      
      (cherry picked from commit 2c541f99)
      ca2cd38a
    • Simon Peyton Jones's avatar
      Fix substitution in bindAuxiliaryDict · 2726f5f9
      Simon Peyton Jones authored and Zubin's avatar Zubin committed
      In GHC.Core.Opt.Specialise.bindAuxiliaryDict we were unnecessarily
      calling `extendInScope` to bring into scope variables that were
      /already/ in scope.  Worse, GHC.Core.Subst.extendInScope strangely
      deleted the newly-in-scope variables from the substitution -- and that
      was fatal in #21391.
      
      I removed the redundant calls to extendInScope.
      
      More ambitiously, I changed GHC.Core.Subst.extendInScope (and cousins)
      to stop deleting variables from the substitution.  I even changed the
      names of the function to extendSubstInScope (and cousins) and audited
      all the calls to check that deleting from the substitution was wrong.
      In fact there are very few such calls, and they are all about
      introducing a fresh non-in-scope variable.  These are "OutIds"; it is
      utterly wrong to mess with the "InId" substitution.
      
      I have not added a Note, because I'm deleting wrong code, and it'd be
      distracting to document a bug.
      
      (cherry picked from commit 000b7d3d)
      2726f5f9
    • Zubin's avatar
      Specialise: Cherry-pick fix for #21332 from · d57244ef
      Zubin authored
      commit 4d2ee313
      Author: Sebastian Graf <sebastian.graf@kit.edu>
      Date:   Thu Apr 7 17:21:08 2022 +0200
      
          Specialising through specialised method calls (#19644)
      d57244ef
    • Zubin's avatar
      Bump bytestring submodule to 0.11.5.2 (#23789) · a98ae4ec
      Zubin authored
      a98ae4ec
  2. Aug 05, 2023
  3. Aug 04, 2023
    • Krzysztof Gogolewski's avatar
      Use tcInferFRR to prevent bad generalisation · dc2e9d2d
      Krzysztof Gogolewski authored and Zubin's avatar Zubin committed
      Fixes #23176
      
      (cherry picked from commit 4b89bb54)
      dc2e9d2d
    • sheaf's avatar
      Handle ConcreteTvs in inferResultToType · 734ad762
      sheaf authored and Zubin's avatar Zubin committed
      This patch fixes two issues.
      
        1. inferResultToType was discarding the ir_frr information, which meant
           some metavariables ended up being MetaTvs instead of ConcreteTvs.
      
           This function now creates new ConcreteTvs as necessary, instead of
           always creating MetaTvs.
      
        2. startSolvingByUnification can make some type variables concrete.
           However, it didn't return an updated type, so callers of this
           function, if they don't zonk, might miss this and accidentally
           perform a double update of a metavariable.
      
           We now return the updated type from this function, which avoids
           this issue.
      
      Fixes #23154
      
      (cherry picked from commit 9ab9b30e)
      734ad762
    • Krzysztof Gogolewski's avatar
      Show an error when we cannot default a concrete tyvar · 689a3ad2
      Krzysztof Gogolewski authored and Zubin's avatar Zubin committed
      Fixes #23153
      
      (cherry picked from commit 0da18eb7)
      (cherry picked from commit ca34a7c79a8855d08e491814db9d656b00a8fe3e)
      689a3ad2
    • Andreas Klebinger's avatar
      Arm: Fix lack of zero-extension for 8/16 bit add/sub with immediate. · 30fed8fa
      Andreas Klebinger authored and Zubin's avatar Zubin committed
      For 32/64bit we can avoid explicit extension/zeroing as the instructions
      set the full width of the registers.
      
      When doing 16/8bit computation we have to put a bit more work in so we
      can't use the fast path.
      
      Fixes #23749 for 9.4.
      
      (cherry picked from commit 0bb44f69)
      30fed8fa
    • Simon Peyton Jones's avatar
      Fix shadowing bug in prepareAlts · 8a8b6f23
      Simon Peyton Jones authored and Zubin's avatar Zubin committed
      As #23012 showed, GHC.Core.Opt.Simplify.Utils.prepareAlts was
      using an OutType to construct an InAlt.  When shadowing is in play,
      this is outright wrong.
      
      See Note [Shadowing in prepareAlts].
      
      (cherry picked from commit ece092d0)
      8a8b6f23
    • Matthew Pickering's avatar
      Add test for #21476 · 87882ce0
      Matthew Pickering authored and Zubin's avatar Zubin committed
      This issues seems to have been fixed since the ticket was made, so let's
      add a test and move on.
      
      Fixes #21476
      87882ce0
    • sheaf's avatar
      Add tests for eta-expansion of data constructors · c8c109e1
      sheaf authored and Zubin's avatar Zubin committed
      This patch adds several tests relating to the eta-expansion of
      data constructors, including UnliftedNewtypes and DataTypeContexts.
      c8c109e1
    • Zubin's avatar
      testsuite: accept new notes output · b9b4ddda
      Zubin authored
      b9b4ddda
    • Ben Gamari's avatar
      linker/PEi386: Don't sign-extend symbol section number · 0ffa158d
      Ben Gamari authored and Zubin's avatar Zubin committed
      Previously we incorrectly interpreted PE section numbers as signed
      values. However, this isn't the case; rather, it's an unsigned 16-bit number
      with a few special bit-patterns (0xffff and 0xfffe). This resulted in #22941
      as the linker would conclude that the sections were invalid.
      
      Fixing this required quite a bit of refactoring.
      
      Closes #22941.
      
      (cherry picked from commit 9a284cd5)
      0ffa158d
    • Ben Gamari's avatar
      rts/win32: Ensure reliability of IO manager shutdown · 2b81876b
      Ben Gamari authored and Zubin's avatar Zubin committed
      When the Win32 threaded IO manager shuts down, `ioManagerDie` sends an
      `IO_MANAGER_DIE` event to the IO manager thread using the
      `io_manager_event` event object. Finally, it will closes the event object,
      and invalidate `io_manager_event`.
      
      Previously, `readIOManagerEvent` would see that `io_manager_event` is
      invalid and return `0`, suggesting that everything is right with the
      world. This meant that if `ioManagerDie` invalidated the handle before
      the event manager was blocked on the event we would end up in a
      situation where the event manager would never realize it was asked to
      shut down.
      
      Fix this by ensuring that `readIOManagerEvent` instead returns
      `IO_MANAGER_DIE` when we detect that the event object has been
      invalidated by `ioManagerDie`.
      
      Fixes #23691.
      
      (cherry picked from commit 6448f0c0)
      2b81876b
    • Ben Gamari's avatar
      codeGen: Ensure that TSAN is aware of writeArray# write barriers · b4d9f54f
      Ben Gamari authored and Zubin's avatar Zubin committed
      By using a proper release store instead of a fence.
      
      (cherry picked from commit aca20a5d)
      b4d9f54f
    • Ben Gamari's avatar
      codeGen: Ensure that array reads have necessary barriers · 3b25886f
      Ben Gamari authored and Zubin's avatar Zubin committed
      This was the cause of #23541.
      
      (cherry picked from commit 453c0531)
      3b25886f
    • Ben Gamari's avatar
      hadrian: Ensure that way-flags are passed to CC · 46fd5f15
      Ben Gamari authored and Zubin's avatar Zubin committed
      Previously the way-specific compilation flags (e.g. `-DDEBUG`,
      `-DTHREADED_RTS`) would not be passed to the CC invocations. This meant
      that C dependency files would not correctly reflect
      dependencies predicated on the way, resulting in the rather
      painful #23554.
      
      Closes #23554.
      
      (cherry picked from commit cca74dab)
      46fd5f15
    • Matthew Craven's avatar
      StgToCmm: Upgrade -fcheck-prim-bounds behavior · 93c49f4c
      Matthew Craven authored and Zubin's avatar Zubin committed
      Fixes #21054. Additionally, we can now check for range overlap
      when generating Cmm for primops that use memcpy internally.
      
      (cherry picked from commit 65a442fc)
      93c49f4c
    • Ben Gamari's avatar
      rts: Various warnings fixes · 999f3de6
      Ben Gamari authored and Zubin's avatar Zubin committed
      (cherry picked from commit cb92051e)
      999f3de6
    • Ben Gamari's avatar
      rts/Trace: Ensure that debugTrace arguments are used · 242c976b
      Ben Gamari authored and Zubin's avatar Zubin committed
      As debugTrace is a macro we must take care to ensure that
      the fact is clear to the compiler lest we see warnings.
      
      (cherry picked from commit 7c7d1f66)
      242c976b
    • Ben Gamari's avatar
      Define FFI_GO_CLOSURES · b1daddf7
      Ben Gamari authored and Zubin's avatar Zubin committed
      The libffi shipped with Apple's XCode toolchain does not contain a
      definition of the FFI_GO_CLOSURES macro, despite containing references
      to said macro. Work around this by defining the macro, following the
      model of a similar workaround in OpenJDK [1].
      
      [1] https://github.com/openjdk/jdk17u-dev/pull/741/files
      
      (cherry picked from commit 8b35e8ca)
      b1daddf7
    • Bryan R's avatar
      Add missing void prototypes to rts functions · fd17a630
      Bryan R authored and Zubin's avatar Zubin committed
      See #23561.
      
      (cherry picked from commit 82ac6bf1)
      fd17a630
    • Ben Gamari's avatar
      testsuite: Add test for #23400 · 389138ab
      Ben Gamari authored and Zubin's avatar Zubin committed
      (cherry picked from commit 98185d52)
      389138ab
    • Ben Gamari's avatar
      rts: Ensure that pinned allocations respect block size · 7ee6af0f
      Ben Gamari authored and Zubin's avatar Zubin committed
      Previously, it was possible for pinned, aligned allocation requests to
      allocate beyond the end of the pinned accumulator block. Specifically,
      we failed to account for the padding needed to achieve the requested
      alignment in the "large object" check. With large alignment requests,
      this can result in the allocator using the capability's pinned object
      accumulator block to service a request which is larger than
      `PINNED_EMPTY_SIZE`.
      
      To fix this we reorganize `allocatePinned` to consistently account for
      the alignment padding in all large object checks. This is a bit subtle
      as we must handle the case of a small allocation request filling the
      accumulator block, as well as large requests.
      
      Fixes #23400.
      
      (cherry picked from commit fd8c5769)
      7ee6af0f
    • Rodrigo Mesquita's avatar
      codeGen: Fix LFInfo of imported datacon wrappers · 9c427455
      Rodrigo Mesquita authored and Zubin's avatar Zubin committed
      As noted in #23231 and in the previous commit, we were failing to give a
      an LFInfo of LFCon to a nullary datacon wrapper from another module,
      failing to properly tag pointers which ultimately led to the
      segmentation fault in #23146.
      
      On top of the previous commit which now considers wrappers where we
      previously only considered workers, we change the order of the guards so
      that we check for the arity of the binding before we check whether it is
      a constructor. This allows us to
      (1) Correctly assign `LFReEntrant` to imported wrappers whose worker was
      nullary, which we previously would fail to do
      (2) Remove the `isNullaryRepDataCon` predicate:
          (a) which was previously wrong, since it considered wrappers whose
          workers had zero-width arguments to be non-nullary and would fail to
          give `LFCon` to them
          (b) is now unnecessary, since arity == 0 guarantees
              - that the worker takes no arguments at all
              - and the wrapper takes no arguments and its RHS must be an
                application of the worker to zero-width-args only.
              - we lint these two items with an assertion that the datacon
                `hasNoNonZeroWidthArgs`
      
      We also update `isTagged` to use the new logic in determining the
      LFInfos of imported Ids.
      
      The creation of LFInfos for imported Ids and this detail are explained
      in Note [The LFInfo of Imported Ids].
      
      Note that before the patch to those issues we would already consider these
      nullary wrappers to have `LFCon` lambda form info; but failed to re-construct
      that information in `mkLFImported`
      
      Closes #23231, #23146
      
      (I've additionally batched some fixes to documentation I found while
      investigating this issue)
      
      (cherry picked from commit 2fc18e9e)
      9c427455
    • Ben Gamari's avatar
      codeGen: Give proper LFInfo to datacon wrappers · e977acbe
      Ben Gamari authored and Zubin's avatar Zubin committed
      As noted in `Note [Conveying CAF-info and LFInfo between modules]`,
      when importing a binding from another module we must ensure that it gets
      the appropriate `LambdaFormInfo` if it is in WHNF to ensure that
      references to it are tagged correctly.
      
      However, the implementation responsible for doing this,
      `GHC.StgToCmm.Closure.mkLFImported`, only dealt with datacon workers and
      not wrappers. This lead to the crash of this program in #23146:
      
          module B where
      
          type NP :: [UnliftedType] -> UnliftedType
          data NP xs where
            UNil :: NP '[]
      
          module A where
          import B
      
          fieldsSam :: NP xs -> NP xs -> Bool
          fieldsSam UNil UNil = True
      
          x = fieldsSam UNil UNil
      
      Due to its GADT nature, `UNil` produces a trivial wrapper
      
          $WUNil :: NP '[]
          $WUNil = UNil @'[] @~(<co:1>)
      
      which is referenced in the RHS of `A.x`. Due to the above-mentioned bug
      in `mkLFImported`, the references to `$WUNil` passed to `fieldsSam` were
      not tagged. This is problematic as `fieldsSam` expected its arguments to
      be tagged as they are unlifted.
      
      The fix is straightforward: extend the logic in `mkLFImported` to cover
      (nullary) datacon wrappers as well as workers. This is safe because we
      know that the wrapper of a nullary datacon will be in WHNF, even if it
      includes equalities evidence (since such equalities are not runtime
      relevant).
      
      Thanks to @MangoIV for the great ticket and @alt-romes for his
      minimization and help debugging.
      
      Fixes #23146.
      
      (cherry picked from commit 33a8c348)
      e977acbe
    • Ben Gamari's avatar
      codeGen: Fix some Haddocks · 0b495e2d
      Ben Gamari authored and Zubin's avatar Zubin committed
      (cherry picked from commit 76727617)
      0b495e2d
    • Ben Gamari's avatar
      testsuite: Add tests for #23146 · 2682c54b
      Ben Gamari authored and Zubin's avatar Zubin committed
      Both lifted and unlifted variants.
      
      (cherry picked from commit 33cf4659)
      2682c54b
    • Alexis King's avatar
      Use a uniform return convention in bytecode for unary results · 7db356e0
      Alexis King authored and Zubin's avatar Zubin committed
      fixes #22958
      
      (cherry picked from commit d85ed900)
      (cherry picked from commit 74b8e5bd)
      7db356e0
    • Alexis King's avatar
      bytecode: Fix bitmaps for BCOs used to tag tuples and prim call args · 628a2c36
      Alexis King authored and Zubin's avatar Zubin committed
      fixes #23068
      
      (cherry picked from commit bed3a292)
      628a2c36
    • Luite Stegeman's avatar
      Add support for sized literals in the bytecode interpreter. · 0a31e4d9
      Luite Stegeman authored and Zubin's avatar Zubin committed
      The bytecode interpreter only has branching instructions for
      word-sized values. These are used for pattern matching.
      Branching instructions for other types (e.g. Int16# or Word8#)
      weren't needed, since unoptimized Core or STG never requires
      branching on types like this.
      
      It's now possible for optimized STG to reach the bytecode
      generator (e.g. fat interface files or certain compiler flag
      combinations), which requires dealing with various sized
      literals in branches.
      
      This patch improves support for generating bytecode from
      optimized STG by adding the following new bytecode
      instructions:
      
          TESTLT_I64
          TESTEQ_I64
          TESTLT_I32
          TESTEQ_I32
          TESTLT_I16
          TESTEQ_I16
          TESTLT_I8
          TESTEQ_I8
          TESTLT_W64
          TESTEQ_W64
          TESTLT_W32
          TESTEQ_W32
          TESTLT_W16
          TESTEQ_W16
          TESTLT_W8
          TESTEQ_W8
      
      Fixes #21945
      
      (cherry picked from commit 28f8c0eb)
      0a31e4d9
Loading