Skip to content
Snippets Groups Projects
  1. Apr 20, 2024
  2. Apr 19, 2024
    • Matthew Craven's avatar
      testsuite: Give the pre_cmd for mhu-perf more time · dba03aab
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      dba03aab
    • Alan Zimmerman's avatar
      EPA: Fix span for PatBuilderAppType · 26036f96
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      Include the location of the prefix @ in the span for InVisPat.
      
      Also removes unnecessary annotations from HsTP.
      
      Contributes to #24669
      26036f96
    • Alan Zimmerman's avatar
      EPA: Provide correct span for PatBind · c90c6039
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      And remove unused parameter in checkPatBind
      
      Contributes to #24669
      c90c6039
    • Alan Zimmerman's avatar
      EPA: Fix comments in mkListSyntaxTy0 · f0701585
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      Also extend the test to confirm.
      
      Addresses #24669, 1 of 4
      f0701585
    • Simon Peyton Jones's avatar
      Do not float HNFs out of lambdas · 55a9d699
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR adjusts SetLevels so that it is less eager to float a
      HNF (lambda or constructor application) out of a lambda, unless
      it gets to top level.
      
      Data suggests that this change is a small net win:
       * nofib bytes-allocated falls by -0.09% (but a couple go up)
       * perf/should_compile bytes-allocated falls by -0.5%
       * perf/should_run bytes-allocated falls by -0.1%
      See !12410 for more detail.
      
      When fiddling elsewhere, I also found that this patch had a huge
      positive effect on the (very delicate) test
        perf/should_run/T21839r
      But that improvement doesn't show up in this MR by itself.
      
      Metric Decrease:
          MultiLayerModulesRecomp
          T15703
          parsing001
      55a9d699
    • Matthew Pickering's avatar
      testsuite: Rename isCross() predicate to needsTargetWrapper() · 5eaa46e7
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      isCross() was a misnamed because it assumed that all cross targets would
      provide a target wrapper, but the two most common cross targets
      (javascript, wasm) don't need a target wrapper.
      
      Therefore we rename this predicate to `needsTargetWrapper()` so
      situations in the testsuite where we can check whether running
      executables requires a target wrapper or not.
      5eaa46e7
  3. Apr 17, 2024
  4. Apr 15, 2024
  5. Apr 12, 2024
    • Simon Peyton Jones's avatar
      Don't generate wrappers for `type data` constructors with StrictData · 5e4f4ba8
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      
      Previously, the logic for checking if a data constructor needs a wrapper or not
      would take into account whether the constructor's fields have explicit
      strictness (e.g., `data T = MkT !Int`), but the logic would _not_ take into
      account whether `StrictData` was enabled. This meant that something like `type
      data T = MkT Int` would incorrectly generate a wrapper for `MkT` if
      `StrictData` was enabled, leading to the horrible errors seen in #24620. To fix
      this, we disable generating wrappers for `type data` constructors altogether.
      
      Fixes #24620.
      
      Co-authored-by: default avatarRyan Scott <ryan.gl.scott@gmail.com>
      5e4f4ba8
    • Ben Gamari's avatar
      testsuite: Add broken test for CApiFFI with -fprefer-bytecode · d23afb8c
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      See #24634.
      d23afb8c
    • Zubin's avatar
      driver: Make `checkHomeUnitsClosed` faster · a933aff3
      Zubin authored and Marge Bot's avatar Marge Bot committed
      The implementation of `checkHomeUnitsClosed` was traversing every single path
      in the unit dependency graph - this grows exponentially and quickly grows to be
      infeasible on larger unit dependency graphs.
      
      Instead we replace this with a faster implementation which follows from the
      specificiation of the closure property - there is a closure error if there are
      units which are both are both (transitively) depended upon by home units and
      (transitively) depend on home units, but are not themselves home units.
      
      To compute the set of units required for closure, we first compute the closure
      of the unit dependency graph, then the transpose of this closure, and find all
      units that are reachable from the home units in the transpose of the closure.
      a933aff3
  6. Apr 10, 2024
    • Ben Gamari's avatar
      testsuite: Add test for lookupSymbolInNativeObj · dccd3ea1
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      dccd3ea1
    • Rodrigo Mesquita's avatar
      rts: Make addDLL a wrapper around loadNativeObj · dcfaa190
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Rewrite the implementation of `addDLL` as a wrapper around the more
      principled `loadNativeObj` rts linker function. The latter should be
      preferred while the former is preserved for backwards compatibility.
      
      `loadNativeObj` was previously only available on ELF platforms, so this
      commit further refactors the rts linker to transform loadNativeObj_ELF
      into loadNativeObj_POSIX, which is available in ELF and MachO platforms.
      
      The refactor made it possible to remove the `dl_mutex` mutex in favour
      of always using `linker_mutex` (rather than a combination of both).
      
      Lastly, we implement `loadNativeObj` for Windows too.
      dcfaa190
    • Alexis King's avatar
      linker: Avoid linear search when looking up Haskell symbols via dlsym · e008a19a
      Alexis King authored and Marge Bot's avatar Marge Bot committed
      
      See the primary Note [Looking up symbols in the relevant objects] for a
      more in-depth explanation.
      
      When dynamically loading a Haskell symbol (typical when running a splice or
      GHCi expression), before this commit we would search for the symbol in
      all dynamic libraries that were loaded. However, this could be very
      inefficient when too many packages are loaded (which can happen if there are
      many package dependencies) because the time to lookup the would be
      linear in the number of packages loaded.
      
      This commit drastically improves symbol loading performance by
      introducing a mapping from units to the handles of corresponding loaded
      dlls. These handles are returned by dlopen when we load a dll, and can
      then be used to look up in a specific dynamic library.
      
      Looking up a given Name is now much more precise because we can get
      lookup its unit in the mapping and lookup the symbol solely in the
      handles of the dynamic libraries loaded for that unit.
      
      In one measurement, the wait time before the expression was executed
      went from +-38 seconds down to +-2s.
      
      This commit also includes Note [Symbols may not be found in pkgs_loaded],
      explaining the fallback to the old behaviour in case no dll can be found
      in the unit mapping for a given Name.
      
      Fixes #23415
      
      Co-authored-by: default avatarRodrigo Mesquita <(@alt-romes)>
      e008a19a
    • Jade's avatar
      Validate -main-is flag using parseIdentifier · 3d0806fc
      Jade authored and Marge Bot's avatar Marge Bot committed
      Fixes #24368
      3d0806fc
  7. Apr 09, 2024
  8. Apr 08, 2024
    • Hannes Siebenhandl's avatar
      Avoid UArray when indexing is not required · 88cb3e10
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      `UnlinkedBCO`'s can occur many times in the heap. Each `UnlinkedBCO`
      references two `UArray`'s but never indexes them. They are only needed
      to encode the elements into a `ByteArray#`. The three words for
      the lower bound, upper bound and number of elements are essentially
      unused, thus we replace `UArray` with a wrapper around `ByteArray#`.
      This saves us up to three words for each `UnlinkedBCO`.
      
      Further, to avoid re-allocating these words for `ResolvedBCO`, we repeat
      the procedure for `ResolvedBCO` and add custom `Binary` and `Show` instances.
      
      For example, agda's repl session has around 360_000 UnlinkedBCO's,
      so avoiding these three words is already saving us around 8MB residency.
      88cb3e10
  9. Apr 05, 2024
    • Ben Gamari's avatar
      compiler: Allow more types in GHCForeignImportPrim · 9b9e031b
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      For many, many years `GHCForeignImportPrim` has suffered from the rather
      restrictive limitation of not allowing any non-trivial types in arguments
      or results. This limitation was justified by the code generator allegely
      barfing in the presence of such types.
      
      However, this restriction appears to originate well before the NCG
      rewrite and the new NCG does not appear to have any trouble with such
      types (see the added `T24598` test). Lift this restriction.
      
      Fixes #24598.
      9b9e031b
  10. Apr 04, 2024
    • Andrei Borzenkov's avatar
      Change how invisible patterns represented in haskell syntax and TH AST (#24557) · 36a75b80
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      Before this patch:
        data ArgPat p
          = InvisPat (LHsType p)
          | VisPat (LPat p)
      
      With this patch:
        data Pat p
          = ...
          | InvisPat (LHsType p)
          ...
      
      And the same transformation in the TH land. The rest of the
      changes is just updating code to handle new AST and writing tests
      to check if it is possible to create invalid states using TH.
      
      Metric Increase:
          MultiLayerModulesTH_OneShot
      36a75b80
    • Hannes Siebenhandl's avatar
      Compact FlatBag array representation · 82cfe10c
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      `Array` contains three additional `Word`'s we do not need in `FlatBag`. Move
      `FlatBag` to `SmallArray`.
      
      Expand the API of SmallArray by `sizeofSmallArray` and add common
      traversal functions, such as `mapSmallArray` and `foldMapSmallArray`.
      Additionally, allow users to force the elements of a `SmallArray`
      via `rnfSmallArray`.
      82cfe10c
    • Hannes Siebenhandl's avatar
      Replace `SizedSeq` with `FlatBag` for flattened structure · 5f085d3a
      Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
      LinkedLists are notoriously memory ineffiecient when all we do is
      traversing a structure.
      As 'UnlinkedBCO' has been identified as a data structure that impacts
      the overall memory usage of GHCi sessions, we avoid linked lists and
      prefer flattened structure for storing.
      
      We introduce a new memory efficient representation of sequential
      elements that has special support for the cases:
      
      * Empty
      * Singleton
      * Tuple Elements
      
      This improves sharing in the 'Empty' case and avoids the overhead of
      'Array' until its constant overhead is justified.
      5f085d3a
    • Ben Gamari's avatar
      testsuite: Introduce template-haskell-exports test · 0fde229f
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      0fde229f
  11. Apr 03, 2024
    • Simon Peyton Jones's avatar
      Account for bottoming functions in OccurAnal · 271a7812
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This fixes #24582, a small but long-standing bug
      271a7812
    • Simon Peyton Jones's avatar
      Testsuite message changes from simplifier improvements · 27db3c5e
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      27db3c5e
    • Duncan Coutts's avatar
      Accept changes to base-exports · 1adc6fa4
      Duncan Coutts authored and Marge Bot's avatar Marge Bot committed
      All the changes are in fact not changes at all.
      
      Previously, the IoSubSystem data type was defined in GHC.RTS.Flags and
      exported from both GHC.RTS.Flags and GHC.IO.SubSystem. Now, the data
      type is defined in GHC.IO.SubSystem and still exported from both
      modules.
      
      Therefore, the same exports and same instances are still available from
      both modules. But the base-exports records only the defining module, and
      so it looks like a change when it is fully compatible.
      
      Related: we do add a deprecation to the export of the type via
      GHC.RTS.Flags, telling people to use the export from GHC.IO.SubSystem.
      
      Also the sort order for some unrelated Show instances changed. No idea
      why.
      
      The same changes apply in the other versions, with a few more changes
      due to sort order weirdness.
      1adc6fa4
    • Simon Peyton Jones's avatar
      Deal with duplicate tyvars in type declarations · faa30b41
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      GHC was outright crashing before this fix: #24604
      faa30b41
    • Sylvain Henry's avatar
      JS: fix h$appendToHsString implementation (#24495) · 527616e9
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      h$appendToHsString needs to wrap its argument in an updatable thunk
      to behave like unpackAppendCString#. Otherwise if a SingleEntry thunk is
      passed, it is stored as-is in a CONS cell, making the resulting list
      impossible to deepseq (forcing the thunk doesn't update the contents of
      the CONS cell)!
      
      The added test checks that the optimization kicks in and that
      h$appendToHsString works as intended.
      
      Fix #24495
      527616e9
  12. Apr 02, 2024
  13. Mar 27, 2024
  14. Mar 23, 2024
    • Andreas Klebinger's avatar
      NCG: Fix a bug in jump shortcutting. · 5bd8ed53
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      When checking if a jump has more than one destination account for the
      possibility of some jumps not being representable by a BlockId.
      
      We do so by having isJumpishInstr return a `Maybe BlockId` where Nothing
      represents non-BlockId jump destinations.
      
      Fixes #24507
      5bd8ed53
    • Simon Peyton Jones's avatar
      Print more info about kinds in error messages · b72705e9
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This fixes #24553, where GHC unhelpfully said
      
        error: [GHC-83865]
          • Expected kind ‘* -> * -> *’, but ‘Foo’ has kind ‘* -> * -> *’
      
      See Note [Showing invisible bits of types in error messages]
      b72705e9
    • Apoorv Ingle's avatar
      Fix for #24552 (see testcase T24552) · 0c48f2b9
      Apoorv Ingle authored and Marge Bot's avatar Marge Bot committed
      Fixes for a bug in desugaring pattern synonyms matches, introduced
      while working on  on expanding `do`-blocks in #18324
      
      The `matchWrapper` unecessarily (and incorrectly) filtered out the
      default wild patterns in a match. Now the wild pattern alternative is
      simply ignored by the pm check as its origin is `Generated`.
      The current code now matches the expected semantics according to the language spec.
      0c48f2b9
  15. Mar 22, 2024
  16. Mar 21, 2024
    • Andrei Borzenkov's avatar
      Fix TH handling in `pat_to_type_pat` function (#24571) · 6fafc51e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      There was missing case for `SplicePat` in `pat_to_type_at` function,
      hence patterns with splicing that checked against `forall->` doesn't work
      properly because they fall into the "illegal pattern" case.
      
      Code example that is now accepted:
      
        g :: forall a -> ()
        g $([p| a |]) = ()
      6fafc51e
Loading