Skip to content
Snippets Groups Projects
  1. Jul 03, 2023
  2. Jun 29, 2023
    • Ben Gamari's avatar
      Define FFI_GO_CLOSURES · 8b35e8ca
      Ben Gamari authored and Marge Bot's avatar Marge Bot 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
      8b35e8ca
    • Ben Gamari's avatar
      Rip out runtime linker/compiler checks · b1e611d5
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      We used to choose flags to pass to the toolchain at runtime based on the
      platform running GHC, and in this commit we drop all of those runtime
      linker checks
      
      Ultimately, this represents a change in policy: We no longer adapt at
      runtime to the toolchain being used, but rather make final decisions
      about the toolchain used at /configure time/
      (we have deleted Note [Run-time linker info] altogether!).
      
      This works towards the goal of having all toolchain configuration logic
      living in the same place, which facilities the work towards a
      runtime-retargetable GHC (see #19877).
      
      As of this commit, the runtime linker/compiler logic was moved to
      autoconf, but soon it, and the rest of the existing toolchain
      configuration logic, will live in the standalone ghc-toolchain program
      (see !9263)
      
      In particular, what used to be done at runtime is now as follows:
      * The flags -Wl,--no-as-needed for needed shared libs are configured
        into settings
      * The flag -fstack-check is configured into settings
      * The check for broken tables-next-to-code was outdated
      * We use the configured c compiler by default as the assembler program
      * We drop `asmOpts` because we already configure -Qunused-arguments flag
        into settings (see !10589)
      
      Fixes #23562
      
      Co-author: Rodrigo Mesquita (@alt-romes)
      b1e611d5
    • Matthew Pickering's avatar
      Add -fpolymorphic-specialisation flag (off by default at all optimisation levels) · 9f01d14b
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Polymorphic specialisation has led to a number of hard to diagnose
      incorrect runtime result bugs (see #23469, #23109, #21229, #23445) so
      this commit introduces a flag `-fpolymorhphic-specialisation` which
      allows users to turn on this experimental optimisation if they are
      willing to buy into things going very wrong.
      
      Ticket #23469
      9f01d14b
    • Rodrigo Mesquita's avatar
      Configure MergeObjs supports response files rather than Ld · fcf310e7
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      The previous configuration script to test whether Ld supported response
      files was
      * Incorrect (see #23542)
      * Used, in practice, to check if the *merge objects tool* supported
        response files.
      
      This commit modifies the macro to run the merge objects tool (rather
      than Ld), using a response file, and checking the result with $NM
      
      Fixes #23542
      fcf310e7
    • Ryan Scott's avatar
      Fix typechecking of promoted empty lists · c335fb7c
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      The `'[]` case in `tc_infer_hs_type` is smart enough to handle arity-0 uses of
      `'[]` (see the newly added `T23543` test case for an example), but the `'[]`
      case in `tc_hs_type` was not. We fix this by changing the `tc_hs_type` case to
      invoke `tc_infer_hs_type`, as prescribed in `Note [Future-proofing the type
      checker]`.
      
      There are some benign changes to test cases' expected output due to the new
      code path using `forall a. [a]` as the kind of `'[]` rather than `[k]`.
      
      Fixes #23543.
      c335fb7c
    • Sven Tennie's avatar
      Fix number of free double regs · ef81a1eb
      Sven Tennie authored and Marge Bot's avatar Marge Bot committed
      D1..D4 are defined for aarch64 and thus not free.
      ef81a1eb
    • Sven Tennie's avatar
      compiler: Drop MO_ReadBarrier · 0fc5cb97
      Sven Tennie authored and Marge Bot's avatar Marge Bot committed
      0fc5cb97
    • Ben Gamari's avatar
      compiler: Drop MO_WriteBarrier · b787e259
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      rts: Drop write_barrier
      b787e259
    • Ben Gamari's avatar
      compiler: Introduce MO_{ACQUIRE,RELEASE}_FENCE · 30525b00
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      30525b00
    • Rodrigo Mesquita's avatar
      Configure CPP into settings · 5ffc7d7b
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      There is a distinction to be made between the Haskell Preprocessor and
      the C preprocessor. The former is used to preprocess Haskell files,
      while the latter is used in C preprocessing such as Cmm files.
      
      In practice, they are both the same program (usually the C compiler) but
      invoked with different flags.
      
      Previously we would, at configure time, configure the haskell
      preprocessor and save the configuration in the settings file, but,
      instead of doing the same for CPP, we had hardcoded in GHC that the CPP
      program was either `cc -E` or `cpp`.
      
      This commit fixes that asymmetry by also configuring CPP at configure
      time, and tries to make more explicit the difference between HsCpp and
      Cpp (see Note [Preprocessing invocations]).
      
      Note that we don't use the standard CPP and CPPFLAGS to configure Cpp,
      but instead use the non-standard --with-cpp and --with-cpp-flags.
      The reason is that autoconf sets CPP to "$CC -E", whereas we expect the
      CPP command to be configured as a standalone executable rather than a
      command. These are symmetrical with --with-hs-cpp and
      --with-hs-cpp-flags.
      
      Cleanup: Hadrian no longer needs to pass the CPP configuration for CPP
               to be C99 compatible through -optP, since we now configure that
               into settings.
      
      Closes #23422
      5ffc7d7b
  3. Jun 27, 2023
  4. Jun 26, 2023
    • Torsten Schmits's avatar
      Propagate breakpoint information when inlining across modules · c59fbb0b
      Torsten Schmits authored
      Tracking ticket: #23394
      
      MR: !10448
      
      * Add constructor `IfaceBreakpoint` to `IfaceTickish`
      * Store breakpoint data in interface files
      * Store `BreakArray` for the breakpoint's module, not the current module, in BCOs
      * Store module name in BCOs instead of `Unique`, since the `Unique` from an `Iface` doesn't match the modules in GHCi's
        state
      * Allocate module name in `ModBreaks`, like `BreakArray`
      * Lookup breakpoint by module name in GHCi
      * Skip creating breakpoint instructions when no `ModBreaks` are available, rather than injecting `ModBreaks` in the
        linker when breakpoints are enabled, and panicking when `ModBreaks` is missing
      c59fbb0b
    • Arnaud Spiwack's avatar
      Revert "Avoid desugaring non-recursive lets into recursive lets" · 522bd584
      Arnaud Spiwack authored and Marge Bot's avatar Marge Bot committed
      This (temporary) reverts commit 3e80c2b4.
      
      Fixes #23550
      522bd584
    • Sylvain Henry's avatar
      JS: support levity-polymorphic datatypes (#22360,#22291) · 8d6574bc
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      - thread knowledge about levity into PrimRep instead of panicking
      - JS: remove assumption that unlifted heap objects are rts objects (TVar#, etc.)
      
      Doing this also fixes #22291 (test added).
      
      There is a small performance hit (~1% more allocations).
      
      Metric Increase:
          T18698a
          T18698b
      8d6574bc
  5. Jun 24, 2023
    • Luite Stegeman's avatar
      Support large stack frames/offsets in GHCi bytecode interpreter · 564164ef
      Luite Stegeman authored
      Bytecode instructions like PUSH_L (push a local variable) contain
      an operand that refers to the stack slot. Before this patch, the
      operand type was SmallOp (Word16), limiting the maximum stack
      offset to 65535 words. This could cause compiler panics in some
      cases (See #22888).
      
      This patch changes the operand type for stack offsets from
      SmallOp to Op, removing the stack offset limit.
      
      Fixes #22888
      564164ef
  6. Jun 21, 2023
    • Bartłomiej Cieślar's avatar
      Add support for deprecating exported items (proposal #134) · 711b1d24
      Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
      
      This is an implementation of the deprecated exports proposal #134.
      The proposal introduces an ability to introduce warnings to exports.
      This allows for deprecating a name only when it is exported from a specific
      module, rather than always depreacting its usage. In this example:
      
          module A ({-# DEPRECATED "do not use" #-} x) where
          x = undefined
          ---
          module B where
          import A(x)
      
      `x` will emit a warning when it is explicitly imported.
      
      Like the declaration warnings, export warnings are first accumulated within
      the `Warnings` struct, then passed into the ModIface, from which they are
      then looked up and warned about in the importing module in the `lookup_ie`
      helpers of the `filterImports` function (for the explicitly imported names)
      and in the `addUsedGRE(s)` functions where they warn about regular usages
      of the imported name.
      
      In terms of the AST information, the custom warning is stored in the
      extension field of the variants of the `IE` type (see Trees that Grow for
      more information).
      
      The commit includes a bump to the haddock submodule added in MR #28
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      711b1d24
    • Sylvain Henry's avatar
    • Sylvain Henry's avatar
      Fix some recompilation avoidance tests · fab2ad23
      Sylvain Henry authored
      fab2ad23
    • Sylvain Henry's avatar
      Stg: return imported FVs · f84ff161
      Sylvain Henry authored
      This is used to determine what to link when using the interpreter.
      For now it's only used by the JS interpreter but it could easily be used
      by the native interpreter too (instead of extracting names from compiled BCOs).
      f84ff161
    • Sylvain Henry's avatar
      Don't use getKey · 3249cf12
      Sylvain Henry authored
      3249cf12
    • Sylvain Henry's avatar
      JS: implement TH support · 4d356ea3
      Sylvain Henry authored
      
      - Add ghc-interp.js bootstrap script for the JS interpreter
      - Interactively link and execute iserv code from the ghci package
      - Incrementally load and run JS code for splices into the running iserv
      
      Co-authored-by: default avatarLuite Stegeman <stegeman@gmail.com>
      4d356ea3
    • Finley McIlwaine's avatar
      Fix associated data family doc structure items · 8185b1c2
      Finley McIlwaine authored and Ben Gamari's avatar Ben Gamari committed
      Associated data families were being given their own export DocStructureItems,
      which resulted in them being documented separately from their classes in
      haddocks. This commit fixes it.
      8185b1c2
    • Finley McIlwaine's avatar
      Memory usage fixes for Haddock · 3d1d42b7
      Finley McIlwaine authored and Ben Gamari's avatar Ben Gamari committed
      - Do not include `mi_globals` in the `NoBackend` backend. It was only included
        for Haddock, but Haddock does not actually need it. This causes a 200MB
        reduction in max residency when generating haddocks on the Agda codebase
        (roughly 1GB to 800MB).
      
      - Make haddock_{parser,renamer}_perf tests more accurate by forcing docs to
        be written to interface files using `-fwrite-interface`
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.base
      3d1d42b7
  7. Jun 20, 2023
    • Magnus Viernickel's avatar
      [feat] add a hint to `HasField` error message · 1464a2a8
      Magnus Viernickel authored and Marge Bot's avatar Marge Bot committed
      - add a hint that indicates that the record that the record dot is used
        on might just be missing a field
      - as the intention of the programmer is not entirely clear, it is only
        shown if the type is known
      - This addresses in part issue #22382
      1464a2a8
    • Arnaud Spiwack's avatar
      Avoid desugaring non-recursive lets into recursive lets · 3e80c2b4
      Arnaud Spiwack authored and Marge Bot's avatar Marge Bot committed
      This prepares for having linear let expressions in the frontend.
      
      When desugaring lets, SPECIALISE statements create more copies of a
      let binding. Because of the rewrite rules attached to the bindings,
      there are dependencies between the generated binds.
      
      Before this commit, we simply wrapped all these in a mutually
      recursive let block, and left it to the simplified to sort it out.
      
      With this commit: we are careful to generate the bindings in
      dependency order, so that we can wrap them in consecutive lets (if the
      source is non-recursive).
      3e80c2b4
  8. Jun 19, 2023
    • Gergő Érdi's avatar
      Add `IfaceWarnings` to represent the `ModIface`-storable parts · 0cbc3ae0
      Gergő Érdi authored and Marge Bot's avatar Marge Bot committed
      of a `Warnings GhcRn`.
      
      Fixes #23516
      0cbc3ae0
    • Finley McIlwaine's avatar
      IPE data compression · cb9e1ce4
      Finley McIlwaine authored
      IPE data resulting from the `-finfo-table-map` flag may now be
      compressed by configuring the GHC build with the
      `--enable-ipe-data-compression` flag. This results in about a 20%
      reduction in the size of IPE-enabled build results.
      
      The compression library, zstd, may optionally be statically linked by
      configuring with the `--enabled-static-libzstd` flag (on non-darwin
      platforms)
      
      libzstd version 1.4.0 or greater is required.
      cb9e1ce4
  9. Jun 18, 2023
  10. Jun 17, 2023
    • Andrei Borzenkov's avatar
      Type/data instances: require that variables on the RHS are mentioned on the LHS (#23512) · 800aad7e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" restricts the
      scope of type and data family instances as follows:
      
        In type family and data family instances, require that every variable
        mentioned on the RHS must also occur on the LHS.
      
      For example, here are three equivalent type instance definitions accepted before this patch:
      
        type family F1 a :: k
        type instance F1 Int = Any :: j -> j
      
        type family F2 a :: k
        type instance F2 @(j -> j) Int = Any :: j -> j
      
        type family F3 a :: k
        type instance forall j. F3 Int = Any :: j -> j
      
      - In F1, j is implicitly quantified and it occurs only on the RHS;
      - In F2, j is implicitly quantified and it occurs both on the LHS and the RHS;
      - In F3, j is explicitly quantified.
      
      Now F1 is rejected with an out-of-scope error, while F2 and F3 continue to be accepted.
      800aad7e
  11. Jun 16, 2023
  12. Jun 15, 2023
    • Andrei Borzenkov's avatar
      Report scoped kind variables at the type-checking phase (#16635) · 78cd1132
      Andrei Borzenkov authored
      This patch modifies the renamer to respect ScopedTypeVariables in kind
      signatures. This means that kind variables bound by the outermost
      `forall` now scope over the type:
      
        type F = '[Right @a @() () :: forall a. Either a ()]
        --         ^^^^^^^^^^^^^^^          ^^^
        --          in scope here        bound here
      
      However, any use of such variables is a type error, because we don't
      have type-level lambdas to bind them in Core. This is described in the
      new Note [Type variable scoping errors during type check] in GHC.Tc.Types.
      78cd1132
    • Vladislav Zavialov's avatar
      Check visibility of nested foralls in can_eq_nc (#18863) · 469ff08b
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Prior to this change, `can_eq_nc` checked the visibility of the
      outermost layer of foralls:
      
      	forall a. forall b. forall c. phi1
      	forall x. forall y. forall z. phi2
      	        ^^
      	     up to here
      
      Then it delegated the rest of the work to `can_eq_nc_forall`, which
      split off all foralls:
      
      	forall a. forall b. forall c. phi1
      	forall x. forall y. forall z. phi2
      	                            ^^
      	                         up to here
      
      This meant that some visibility flags were completely ignored.
      We fix this oversight by moving the check to `can_eq_nc_forall`.
      469ff08b
Loading