- Mar 19, 2025
-
-
As with ghc-prim, it makes sense to have some protection against accidental interface changes to this package caused by changes in ghc-internal.
-
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.
-
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...
-
- Mar 13, 2025
-
-
-
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.
-
- Mar 12, 2025
-
-
- Mar 11, 2025
-
-
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.
-
- Mar 09, 2025
-
-
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.
-
There's a much more efficient way to convert an unsigned i32 to a signed one. Thanks, o3-mini-high.
-
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.
-
- Mar 05, 2025
-
-
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
-
- Mar 04, 2025
-
-
This brings it into line with the changes in https://hackage.haskell.org/package/ghc-exactprint-1.12.0.0 But also keeps the latest changes from master.
-
- Feb 27, 2025
-
-
We currently have no way of keeping this up-to-date with the project version
-
- Feb 23, 2025
-
-
This patch adds a note to explain how the magic variables like `__ghc_wasm_jsffi_dyld` are brought into scope of JSFFI code snippets, as follow up work of !13583.
-
- Feb 22, 2025
-
-
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.
-
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.
-
- Feb 18, 2025
-
-
- Feb 08, 2025
-
-
In particular, use `NonEmpty` where appropriate: - the argument of `FieldLabelString` - the argument of `HsMultiIf` - `grhssGRHSs` Decreases overall compile-time allocation by about 0.1% in the benchmark suite (min -0.8%, max +0.3%). Metric Decrease: T3294
-
- Feb 04, 2025
-
-
This is a moniker used for later 32-bit x86 implementations (Pentium Pro and later). Fixes #25691.
-
- Jan 25, 2025
-
-
use portable C types!
-
ghc-internal becomes the only wired-in package exposing primitives. There are some minor GHC allocation regressions, but they barely cross the thresholds and only with the wasm backend. They're likely due to longer symbols (ghc-internal vs ghc-prim, GHC.Internal.X vs GHC.X). Metric Increase: T13035 T1969 T4801 T9961
-
- Jan 21, 2025
-
-
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(); | ^ ```
-
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:
Matthew Pickering <matthewtpickering@gmail.com> ------------------------- Metric Decrease: MultiComponentModulesRecomp MultiLayerModulesRecomp -------------------------
-
- Jan 15, 2025
-
-
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`.
-
- Jan 10, 2025
-
-
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.
-
- Dec 29, 2024
-
-
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
-
- Nov 27, 2024
-
-
We verify that required flags (currently `--output` and `--triple`) are provided. The implementation is truly awful, but so is getopt. Begins to address #25500.
-
- Nov 25, 2024
-
-
This is never used for lexing / parsing. It is only used by `GHC.Parser.Header.getOptions`.
-
- Nov 15, 2024
-
-
This patch fixes foreign import javascript "wrapper" in wasm backend's TH/ghci by fixing the handling of dyld/finalization_registry magic variables. Fixes T25473 and closes #25473.
-
- Nov 13, 2024
-
-
Closes #25467
-
- Nov 12, 2024
-
-
This patch fixes FinalizationRegistry related logic for Cloudflare Workers in wasm backend js post linker. Cloudflare Workers doesn't support FinalizationRegistry, in this case we use a dummy implementation that doesn't do anything.
-
This patch fixes setImmediate() implementation for Cloudflare Workers in the wasm backend's js prelude script. Cloudflare Workers doesn't support the MessageChannel API, and we use a setTimeout() based fallback implementation in this case.
-
And keep track of promotion status in HsExplicitTupleTy, so the round-trip ppr test works for it. Updates Haddock output too, using the PromotionFlag in HsExplicitTupleTy. Closes #25454
-
- Nov 11, 2024
-
- Nov 08, 2024
-
-
The executable wrappers are handled by hadrian and bindist Makefile. The various .wrapper scripts in the tree are unused since removal of Make build system, so this patch removes them all.
-
This patch cleans up obsolete CPP guarded code paths from the tree. The minimum supported boot GHC version is 9.6, and all the pre-9.6 era code paths can be removed.
-
- Nov 04, 2024
-
-
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 -------------------------
-
- Oct 31, 2024
-
-
For import declarations, NameAnnCommas and NPlusKPat. And remove anchor, it is the same as epaLocationRealSrcSpan.
-