Skip to content
Snippets Groups Projects
  1. Mar 19, 2025
    • Matthew Craven's avatar
      Add interface-stability test for ghc-bignum · 27cf7361
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      As with ghc-prim, it makes sense to have some protection against
      accidental interface changes to this package caused by changes
      in ghc-internal.
      27cf7361
    • Sjoerd Visscher's avatar
      Multiplicity annotation on records · 443fc8b1
      Sjoerd Visscher authored and Marge Bot's avatar Marge Bot committed
      Needing to store multiplicity annotations on records triggered a refactoring of AST of data declarations:
      
      Moved HsBangTy and HsRecTy from HsType to HsTypeGhcPsExt, the extension of HsType during parsing, since they are only needed during parsing.
      
      New HsConDeclField that stores all source data shared by all constructor declaration fields: unpackedness, strictness, multiplicity, documentation and the type of the field.
      
      Merged HsMultAnn and HsArrowOf, so all multiplicity annotations share the same data type.
      
      HsBang was no longer needed as a separate type, and was inlined into HsSrcBang.
      443fc8b1
    • Simon Peyton Jones's avatar
      Specialising expressions -- at last · 393531ff
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR addresses #24359, which implements the GHC proposal 493 on SPECIALISE pragmas.
      
      * The old code path (using SpecSig and SpecPrag) still exists.
      * The new code path (using SpecSigE and SpecPragE) runs alongside it.
      * All SPECIALISE pragmas are routed through the new code path, except
        if you give multiple type sigs, when the old code path is still used.
      * Main documentation: Note [Handling new-form SPECIALISE pragmas] in
        GHC.Tc.Gen.Sig`
      
      Thanks to @sheaf for helping with this MR.
      
      The Big Thing is to introduce
      
        {-# SPECIALISE forall x.  f @Int x True #-}
      
      where you can give type arguments and value argument to specialise; and
      you can quantify them with forall, just as in Rules.
      
      I thought it was going to be pretty simple, but it was a Long, Long Saga.
      
      Highlights
      
      * Overview Note [Handling new-form SPECIALISE pragmas] in GHC.Tc.Gen.Sig
        - New data constructor `SpecSigE` in data type `L.H.S.Binds.Sig`
        - New data construtor `SpecPragE` in data type `GHC.Hs.B...
      393531ff
  2. Mar 13, 2025
    • Matthew Craven's avatar
      Add interface-stability test for ghc-prim · 24d373a6
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      24d373a6
    • Matthew Pickering's avatar
      interfaces: Ensure that forceModIface deeply forces a ModIface · 915a6781
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      A ModIface is the result of compilation that we keep for a long time in
      memory. Therefore, it's very important to manage what we are going to
      retain and remove any external references to things which we might have
      captured compilation.
      
      If storing your ModIface in memory uses too much space, then store
      less things or make it use a more efficient representation.
      
      In the past there have been many space leak bugs by not sufficiently
      forcing a ModIface (#15111)
      
      This patch adds all the missing NFData instances for all the places I
      could find where we weren't deeply forcing the structure.
      915a6781
  3. Mar 12, 2025
  4. Mar 11, 2025
    • Vladislav Zavialov's avatar
      One list in ConPat (part of #25127) · 7b84c588
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch changes PrefixCon to use one list instead of two:
      
      	-data HsConDetails tyarg arg rec
      	-  = PrefixCon [tyarg] [arg]
      	+data HsConDetails arg rec
      	+  = PrefixCon [arg]
      	   | RecCon    rec
      	   | InfixCon  arg arg
      
      The [tyarg] list is now gone. To understand the effect of this change,
      recall that there are three instantiations of HsConDetails:
      
      1. type HsConPatDetails p =
            HsConDetails (HsConPatTyArg (NoGhcTc p))  -- tyarg
                         (LPat p)                     -- arg
                         (HsRecFields p (LPat p))     -- rec
      
      2. type HsConDeclH98Details pass =
            HsConDetails Void                              -- tyarg
                         (HsScaled pass (LBangType pass))  -- arg
                         (XRec pass [LConDeclField pass])  -- rec
      
      3. type HsPatSynDetails pass =
            HsConDetails Void                     -- tyarg
                         (LIdP pass)              -- arg
                         [RecordPatSynField pass] -- rec
      
      In cases (2) and (3), tyarg was instantiated to Void, so the [tyarg]
      list was always empty. Its removal is basically a no-op.
      
      The interesting case is (1), which is used in ConPat to represent
      pattern matching of the form (MkE @tp1 @tp2 p1 p2).
      With this patch, its representation is changed as follows:
      
        ConPat "MkE" [tp1, tp2] [p1, p2]               -- old
        ConPat "MkE" [InvisP tp1, InvisP tp2, p1, p2]  -- new
      
      The new mixed-list representation is consintent with lambdas, where
      InvisP is already used to deal with \ @tp1 @tp2 p1 p2 -> body.
      
      The immediate effect of the new representation is an improvement to
      error messages. Consider the pattern (Con x @t y). Previously it
      resulted in a parse error because @t could not occur after x. Now it is
      reported as [GHC-14964]. Test case: TyAppPat_MisplacedApplication.
      
      In the long term, this is intended as preparation for #18389 and #25127,
      which would make (Con x @t y) potentially valid, e.g. if its type is
        Con :: forall a -> forall b. (a, b) -> T
      
      The TH AST is left unchanged for the moment to avoid breakage.
      7b84c588
  5. Mar 09, 2025
    • Cheng Shao's avatar
      wasm: revamp JSFFI internal implementation and documentation · fd40eaa1
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch revamps the wasm backend's JSFFI internal implementation
      and documentation:
      
      - `JSValManager` logic to allocate a key is simplified to simple
        bumping. According to experiments with all major browsers, the
        internal `Map` would overflow the heap much earlier before we really
        exhaust the 32-bit key space, so there's no point in the extra
        complexity.
      - `freeJSVal` is now idempotent and safe to call more than once. This
        is achieved by attaching the `StablePtr#` to the `JSVal#` closure
        and nullifying it when calling `freeJSVal`, so the same stable
        pointer cannot be double freed.
      - `mkWeakJSVal` no longer exposes the internal `Weak#` pointer and
        always creates a new `Weak#` on the fly. Otherwise by finalizing
        that `Weak#`, user could accidentally drop the `JSVal`, but
        `mkWeakJSVal` is only supposed to create a `Weak` that observes the
        `JSVal`'s liveliness without actually interfering it.
      - `PromisePendingException` is no longer exported since it's never
        meant to be caught by user code; it's a severe bug if it's actually
        raised at runtime.
      - Everything exported by user-facing `GHC.Wasm.Prim` now has proper
        haddock documentation.
      - Note [JSVal representation for wasm] has been updated to reflect the
        new JSVal# memory layout.
      fd40eaa1
    • Cheng Shao's avatar
      wasm: don't create a wasm global for dyld poison · 75fcc5c9
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      There's a much more efficient way to convert an unsigned i32 to a
      signed one. Thanks, o3-mini-high.
      75fcc5c9
    • Cheng Shao's avatar
      wasm: do not use wasm type reflection in dyld · cca68421
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      The wasm dynamic linker used to depend on v8's experimental wasm type
      reflection support to generate stub functions when treating GOT.func
      items that aren't exported by any loaded library yet. However, as we
      work towards wasm ghci browser mode (#25399), we need to ensure the
      wasm dyld logic is portable across browsers. So this commit removes
      the usage of wasm type reflection in wasm dyld, and it shall only be
      added many months later when this feature is widely available in
      browsers.
      cca68421
  6. Mar 05, 2025
    • Teo Camarasu's avatar
      ghc-boot-th: expose all TH packages from proper GHC.Boot.* modules · f2d43e11
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      Previously we defined some modules here in the GHC.Internal namespace.
      Others were merely re-exposed from GHC.Internal.
      
      Re-exposed modules weren't handled correctly by Haddock, so the
      Haddocks for the `template-haskell` library couldn't see them.
      This change also makes the home package of these modules a bit clearer.
      
      Work towards #25705
      f2d43e11
  7. Mar 04, 2025
  8. Feb 27, 2025
  9. Feb 23, 2025
  10. Feb 22, 2025
    • Cheng Shao's avatar
      wasm: fix dyld for shared libraries created by llvm 20.x · cb60da24
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch fixes wasm dyld script for shared libraries created by llvm
      20.x. The __wasm_apply_data_relocs function is now optional and may be
      omitted for shared libraries without any runtime relocatable data
      segments, so only call __wasm_apply_data_relocs when it's present.
      cb60da24
    • Cheng Shao's avatar
      wasm: bump dyld v8 heap size limit · fbf3d020
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      This patch sets `--max-old-space-size=65536` as wasm dyld shebang
      arguments to lessen v8 heap pressure in certain workloads that load
      the full ghc package. It doesn't really commit 64G memory but it does
      help reduce v8 gc overhead.
      fbf3d020
  11. Feb 18, 2025
  12. Feb 08, 2025
  13. Feb 04, 2025
  14. Jan 25, 2025
  15. Jan 21, 2025
    • Jens Petersen's avatar
      hp2ps/Utilities.c: add extern parameter types for malloc and realloc for C23 · f983a00f
      Jens Petersen authored and Marge Bot's avatar Marge Bot committed
      Fix build with gcc-15 which defaults to C23 standard (-std=gnu23)
      Fixes #25662
      ```
      utils/hp2ps/Utilities.c:6:14: error:
           warning: conflicting types for built-in function ‘malloc’; expected ‘void *(long unsigned int)’ [-Wbuiltin-declaration-mismatch]
              6 | extern void* malloc();
                |              ^~~~~~
        |
      6 | extern void* malloc();
        |              ^
      utils/hp2ps/Utilities.c:5:1: error:
           note: ‘malloc’ is declared in header ‘<stdlib.h>’
              4 | #include "Error.h"
            +++ |+#include <stdlib.h>
              5 | 
        |
      5 | 
        | ^
      utils/hp2ps/Utilities.c: In function ‘xmalloc’:
      utils/hp2ps/Utilities.c:80:17: error:
           error: too many arguments to function ‘malloc’; expected 0, have 1
             80 |     r = (void*) malloc(n);
                |                 ^~~~~~ ~
         |
      80 |     r = (void*) malloc(n);
         |                 ^
      utils/hp2ps/Utilities.c:6:14: error:
           note: declared here
              6 | extern void* malloc();
                |              ^~~~~~
        |
      6 | extern void* malloc();
        |              ^
      utils/hp2ps/Utilities.c: In function ‘xrealloc’:
      utils/hp2ps/Utilities.c:92:18: error:
           warning: conflicting types for built-in function ‘realloc’; expected ‘void *(void *, long unsigned int)’ [-Wbuiltin-declaration-mismatch]
             92 |     extern void *realloc();
                |                  ^~~~~~~
         |
      92 |     extern void *realloc();
         |                  ^
      utils/hp2ps/Utilities.c:92:18: error:
           note: ‘realloc’ is declared in header ‘<stdlib.h>’
         |
      92 |     extern void *realloc();
         |                  ^
      utils/hp2ps/Utilities.c:94:9: error:
           error: too many arguments to function ‘realloc’; expected 0, have 2
             94 |     r = realloc(p, n);
                |         ^~~~~~~ ~
         |
      94 |     r = realloc(p, n);
         |         ^
      utils/hp2ps/Utilities.c:92:18: error:
           note: declared here
             92 |     extern void *realloc();
                |                  ^~~~~~~
         |
      92 |     extern void *realloc();
         |                  ^
      ```
      f983a00f
    • Rodrigo Mesquita's avatar
      driver: Store the HomePackageTable in a mutable reference · 6b7ea592
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      
      This commit refactors the HomePackageTable and HomeUnitGraph:
      
      (1) It fixes a quadratic-in-the-number-of-modules space leak in upsweep (#25511)
      
      (2) And it reworks these structures into their own modules to simplify
          the driver. The refactor is driven by the introduction of IO in the HPT
          interface, but is a bit more aggressive in simplifying the
          interfaces to enforce correct usage (ie to avoid performance
          pitfalls).
      
      Specifically:
      
      - The `HomeUnitGraph` (HUG) is now in `GHC.Unit.Home.Graph`
      - The `HomePackageTable` (HPT) is now in `GHC.Unit.Home.PackageTable`
          - The HPT now stores an `IORef` with the table of loaded home package modules.
          - The interface to the HPT now requires IO
          - The interface now enforces that the HPT is a datastructure that
            only grows
          - This is not enforced in the interface, but, clients of the HPT
            should never care about there being more or less entries in the
            HPT when these additional entries are not relevant to their result.
          - The exception to the invariant that the HPT is monotonically
            increasing is `restrictHpt`, a function which is called at a
            "barrier point" (during which there are no other threads
            inspecting or inserting in the HPT). The invariant can be
            temporarily broken at this point (currently, after upsweep).
            This is safe because a single thread holds control over the
            structure (thus the invariant being broken is never observed).
      
      The hug_var and associated structures in the driver, which aimed to
      improve memory usage in the driver by updating in place a HUG during
      upsweep, are no longer required as the HPT entries in the HUG are now
      themselves mutable by construction. This was previously explained in
      Note [ModuleNameSet, efficiency and space leaks], which is no longer
      relevant and was deleted.
      
      Fixes #25511
      
      Co-authored-by: default avatarMatthew Pickering <matthewtpickering@gmail.com>
      
      -------------------------
      Metric Decrease:
          MultiComponentModulesRecomp
          MultiLayerModulesRecomp
      -------------------------
      6b7ea592
  16. Jan 15, 2025
    • amesgen's avatar
      wasm: prevent bundlers from resolving import("node:timers") · f6493dbc
      amesgen authored and Marge Bot's avatar Marge Bot committed
      This fixes the following esbuild error:
      
          ✘ [ERROR] Could not resolve "node:timers"
      
              www/ghc_wasm_jsffi.js:66:25:
                66 │     return (await import("node:timers")).setImmediate;
                   ╵                          ~~~~~~~~~~~~~
      
            The package "node:timers" wasn't found on the file system but is built into node. Are you trying
            to bundle for node? You can use "--platform=node" to do that, which will remove this error.
      
      Previously (i.e. after !13503), one had to work around this by passing
      `--external:node:timers`.
      f6493dbc
  17. Jan 10, 2025
    • Ben Gamari's avatar
      dump-decls: Suppress unit-ids · e1c133f2
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      While the testsuite driver already normalizes these away, they are
      nevertheless a severe nuisance when diffing outside of the testsuite.
      
      Intriguingly, this doesn't completely eliminate the unit IDs; some
      wired-in names are still printed. However, this is a cheap and helpful
      improvement over the status quo so I am simply going to accept this.
      
      Fixes #25334.
      e1c133f2
  18. Dec 29, 2024
    • Zubin's avatar
      Bump base, ghc-prim and template-haskell versions for 9.12 · 7f79257a
      Zubin authored and Zubin's avatar Zubin committed
      Also bump various submodules.
      
      (cherry picked from commit 6fc1fa3b)
      
      Bump base bound to 4.21 for GHC 9.12
      
      (cherry picked from commit 473a201c)
      
      Bump binary submodule to 0.8.9.2
      
      (cherry picked from commit 7199869a)
      (cherry picked from commit ec2f40b4)
      
      Bump exceptions submodule to 0.10.9
      
      (cherry picked from commit f5b5d1dc)
      
      Bump file-io submodule to 0.1.4
      
      (cherry picked from commit ba786681)
      
      bump os-string submodule to 2.0.6
      
      (cherry picked from commit 3a7ffdbb)
      
      bump transformers submodule to 0.6.1.2
      
      (cherry picked from commit 53b46fd4)
      
      Bump directory submodule to v1.3.9.0
      
      (cherry picked from commit 27dc2664)
      
      Bump Win32 submodule to v2.14.1.0
      
      (cherry picked from commit 80df8808)
      
      Bump filepath submodule to 1.5.3.0
      
      (cherry picked from commit 29bfae2c)
      
      Bump file-io submodule to avoid usage of QuasiQuotes
      
      (cherry picked from commit 97b0dff2)
      
      Bump unix submodule to 2.8.6.0
      
      (cherry picked from commit a1f56d6d)
      
      Bump os-string submodule to 2.0.8
      
      (cherry picked from commit 0121b76f)
      
      Bump file-io submodule to avoid usage of QuasiQuotes
      
      (cherry picked from commit 962ceb50)
      
      Bump filepath submodule to 1.5.4.0
      
      (cherry picked from commit 7bc6877f)
      
      Bump file-io submodule to 0.1.5
      
      (cherry picked from commit 9478b5ae)
      
      Bump Cabal submodule to 3.14.1.0
      
      (cherry picked from commit 5c9c3e3f)
      
      Bump directory submodule to 0.12.2.0
      
      (cherry picked from commit 89790626)
      
      Bump array submodule for base bump
      
      Bump stm submodule for base bump
      
      Bump process submodule for base bump
      7f79257a
  19. Nov 27, 2024
  20. Nov 25, 2024
  21. Nov 15, 2024
  22. Nov 13, 2024
  23. Nov 12, 2024
  24. Nov 11, 2024
  25. Nov 08, 2024
  26. Nov 04, 2024
    • Hassan Al-Awwadi's avatar
      Refactored BooleanFormula to be in line with TTG (#21592) · 97f600c6
      Hassan Al-Awwadi authored and Rodrigo Mesquita's avatar Rodrigo Mesquita committed
      There are two parts to this commit.
      * We moved the definition of BooleanFormula over to L.H.S.BooleanFormula
      * We parameterized the BooleanFormula over the pass
      
      The GHC specific details of BooleanFormula remain in Ghc.Data.BooleanFormula.
      Because its parameterized over the pass its no longer a functor or
      traversable, but we defined bfMap and bfTraverse for the cases where we
      needed fmap and traverse originally. Most other changes are just churn.
      
      -------------------------
      Metric Decrease:
          MultiLayerModulesTH_OneShot
      -------------------------
      Verified
      97f600c6
  27. Oct 31, 2024
Loading