summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update user's guide and release noteswip/t21766Finley McIlwaine2023-04-194-17/+38
| | | | | | | | Add mention of IPE data compression to user's guide and the release notes for 9.8.1. Also note the impact compression has on binary size in both places. See ticket #21766
* Add IPE-enabled builds to CIFinley McIlwaine2023-04-192-101/+243
| | | | | | | | | | | - Adds an IPE job to the CI pipeline which is triggered by the ~IPE label - Introduces CI logic to enable IPE data compression - Enables uncompressed IPE data on debug CI job - Regenerates jobs.yaml MR https://gitlab.haskell.org/ghc/ci-images/-/merge_requests/112 on the images repository is meant to ensure that the proper images have libzstd-dev installed.
* Add optional dependencies to ./configure outputFinley McIlwaine2023-04-191-0/+11
| | | | | | Changes the configure script to indicate whether libnuma, libzstd, or libdw are being used as dependencies due to their optional features being enabled.
* Fix IPE data decompression buffer allocationFinley McIlwaine2023-04-194-60/+79
| | | | | | | | | | Capacity of buffers allocated for decompressed IPE data was incorrect due to a misuse of the `ZSTD_findFrameCompressedSize` function. Fix by always storing decompressed size of IPE data in IPE buffer list nodes and using `ZSTD_findFrameCompressedSize` to determine the size of the compressed data. See ticket #21766
* Fix byte order of IPE data, fix IPE testsFinley McIlwaine2023-04-196-44/+83
| | | | | | | | | | | | Make sure byte order of written IPE buffer entries matches target. Make sure the IPE-related tests properly access the fields of IPE buffer entry nodes with the new IPE layout. This commit also introduces checks to avoid importing modules if IPE compression is not enabled. See ticket #21766.
* Add note describing IPE data compressionFinley McIlwaine2023-04-191-11/+41
| | | | See ticket #21766
* Fix libzstd detection in configure and RTSFinley McIlwaine2023-04-192-9/+16
| | | | | | Ensure that `HAVE_LIBZSTD` gets defined to either 0 or 1 in all cases and properly check that before IPE data decompression in the RTS. See ticket #21766.
* IPE data compressionFinley McIlwaine2023-04-193-22/+114
| | | | | | | Reference ticket #21766 When IPE data compression is enabled, compress the emitted IPE buffer entries and decompress them in the RTS.
* Add IPE compression to configureFinley McIlwaine2023-04-1911-3/+123
| | | | | | | | Reference ticket #21766 Adds an `--enable-ipe-data-compreesion` flag to the configure script which will check for libzstd and set the appropriate flags to allow for IPE data compression in the compiler
* Restructure IPE buffer layoutFinley McIlwaine2023-04-193-60/+156
| | | | | | | | | | | Reference ticket #21766 This commit restructures IPE buffer list entries to not contain references to their corresponding info tables. IPE buffer list nodes now point to two lists of equal length, one holding the list of info table pointers and one holding the corresponding entries for each info table. This will allow the entry data to be compressed without losing the references to the info tables.
* Don't panic in ltPatersonSizesheaf2023-04-183-20/+79
| | | | | | | | | | | | | | | | The function GHC.Tc.Utils.TcType.ltPatersonSize would panic when it encountered a type family on the RHS, as usually these are not allowed (type families are not allowed on the RHS of class instances or of quantified constraints). However, it is possible to still encounter type families on the RHS after doing a bit of constraint solving, as seen in test case T23171. This could trigger the panic in the call to ltPatersonSize in GHC.Tc.Solver.Canonical.mk_strict_superclasses, which is involved in avoiding loopy superclass constraints. This patch simply changes ltPatersonSize to return "I don't know, because there's a type family involved" in these cases. Fixes #23171
* Convert interface file loading errors into proper diagnosticsMatthew Pickering2023-04-1859-508/+853
| | | | | | | | | | | | | | This patch converts all the errors to do with loading interface files into proper structured diagnostics. * DriverMessage: Sometimes in the driver we attempt to load an interface file so we embed the IfaceMessage into the DriverMessage. * TcRnMessage: Most the time we are loading interface files during typechecking, so we embed the IfaceMessage This patch also removes the TcRnInterfaceLookupError constructor which is superceded by the IfaceMessage, which is now structured compared to just storing an SDoc before.
* Misc cleanupKrzysztof Gogolewski2023-04-1713-33/+30
| | | | | | - Use dedicated list functions - Make cloneBndrs and cloneRecIdBndrs monadic - Fix invalid haddock comments in libraries/base
* validDerivPred: Reject exotic constraints in IrredPredsRyan Scott2023-04-1712-111/+285
| | | | | | | | | | | | | | | | | | | | | | | | | This brings the `IrredPred` case in sync with the treatment of `ClassPred`s as described in `Note [Valid 'deriving' predicate]` in `GHC.Tc.Validity`. Namely, we should reject `IrredPred`s that are inferred from `deriving` clauses whose arguments contain other type constructors, as described in `(VD2) Reject exotic constraints` of that Note. This has the nice property that `deriving` clauses whose inferred instance context mention `TypeError` will now emit the type error in the resulting error message, which better matches existing intuitions about how `TypeError` should work. While I was in town, I noticed that much of `Note [Valid 'deriving' predicate]` was duplicated in a separate `Note [Exotic derived instance contexts]` in `GHC.Tc.Deriv.Infer`. I decided to fold the latter Note into the former so that there is a single authority on describing the conditions under which an inferred `deriving` constraint can be considered valid. This changes the behavior of `deriving` in a way that existing code might break, so I have made a mention of this in the GHC User's Guide. It seems very, very unlikely that much code is relying on this strange behavior, however, and even if there is, there is a clear, backwards-compatible migration path using `StandaloneDeriving`. Fixes #22696.
* Add regression test for #23199Simon Peyton Jones2023-04-172-0/+11
|
* Account for special GHC.Prim import in warnUnusedPackagesMatthew Pickering2023-04-173-3/+14
| | | | | | | | | | | | The GHC.Prim import is treated quite specially primarily because there isn't an interface file for GHC.Prim. Therefore we record separately in the ModSummary if it's imported or not so we don't go looking for it. This logic hasn't made it's way to `-Wunused-packages` so if you imported GHC.Prim then the warning would complain you didn't use `-package ghc-prim`. Fixes #23212
* Add import lists to few GHC.Driver.Session importsOleg Grenrus2023-04-164-4/+6
| | | | | | Related to https://gitlab.haskell.org/ghc/ghc/-/issues/23261. There are a lot of GHC.Driver.Session which only use DynFlags, but not the parsing code.
* Transfer DFunId_ness onto specialised bindingsSimon Peyton Jones2023-04-161-41/+78
| | | | | | | | | | | | | | | | | | | | Whether a binding is a DFunId or not has consequences for the `-fdicts-strict` flag, essentially if we are doing demand analysis for a DFunId then `-fdicts-strict` does not apply because the constraint solver can create recursive groups of dictionaries. In #22549 this was fixed for the "normal" case, see Note [Do not strictify the argument dictionaries of a dfun]. However the loop still existed if the DFunId was being specialised. The problem was that the specialiser would specialise a DFunId and turn it into a VanillaId and so the demand analyser didn't know to apply special treatment to the binding anymore and the whole recursive group was optimised to bottom. The solution is to transfer over the DFunId-ness of the binding in the specialiser so that the demand analyser knows not to apply the `-fstrict-dicts`. Fixes #22549
* Handle ConcreteTvs in inferResultToTypewip/T23153sheaf2023-04-1513-34/+90
| | | | | | | | | | 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. Fixes #23154
* Show an error when we cannot default a concrete tyvarKrzysztof Gogolewski2023-04-157-4/+55
| | | | Fixes #23153
* docs: Update template-haskell docs to use Code Q a rather than Q (TExp a)Matthew Pickering2023-04-151-37/+41
| | | | | | | | Since GHC Proposal #195, the type of [|| ... ||] has been Code Q a rather than Q (TExp a). The documentation in the `template-haskell` library wasn't updated to reflect this change. Fixes #23148
* Make approximateWC a bit clevererwip/T22194-flagsSimon Peyton Jones2023-04-141-61/+94
| | | | | | | | | | | This MR fixes #23224: making approximateWC more clever See the long `Note [ApproximateWC]` in GHC.Tc.Solver All this is delicate and ad-hoc -- but it /has/ to be: we are talking about inferring a type for a binding in the presence of GADTs, type families and whatnot: known difficult territory. We just try as hard as we can.
* Improve partial signaturesSimon Peyton Jones2023-04-1411-138/+181
| | | | | | | | | | | | | | | | | | | | | | | This MR fixes #23223. The changes are in two places: * GHC.Tc.Bind.checkMonomorphismRestriction See the new `Note [When the MR applies]` We now no longer stupidly attempt to apply the MR when the user specifies a context, e.g. f :: Eq a => _ -> _ * GHC.Tc.Solver.decideQuantification See rewritten `Note [Constraints in partial type signatures]` Fixing this bug apparently breaks three tests: * partial-sigs/should_compile/T11192 * partial-sigs/should_fail/Defaulting1MROff * partial-sigs/should_fail/T11122 However they are all symptoms of #23232, so I'm marking them as expect_broken(23232). I feel happy about this MR. Nice.
* Add some documentation about redundant constraintsSimon Peyton Jones2023-04-142-5/+28
|
* Major refactor in the handling of equality constraintsSimon Peyton Jones2023-04-1440-1240/+2181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR substantially refactors the way in which the constraint solver deals with equality constraints. The big thing is: * Intead of a pipeline in which we /first/ canonicalise and /then/ interact (the latter including performing unification) the two steps are more closely integreated into one. That avoids the current rather indirect communication between the two steps. The proximate cause for this refactoring is fixing #22194, which involve solving [W] alpha[2] ~ Maybe (F beta[4]) by doing this: alpha[2] := Maybe delta[2] [W] delta[2] ~ F beta[4] That is, we don't promote beta[4]! This is very like introducing a cycle breaker, and was very awkward to do before, but now it is all nice. See GHC.Tc.Utils.Unify Note [Promotion and level-checking] and Note [Family applications in canonical constraints]. The big change is this: * Several canonicalisation checks (occurs-check, cycle-breaking, checking for concreteness) are combined into one new function: GHC.Tc.Utils.Unify.checkTyEqRhs This function is controlled by `TyEqFlags`, which says what to do for foralls, type families etc. * `canEqCanLHSFinish` now sees if unification is possible, and if so, actually does it: see `canEqCanLHSFinish_try_unification`. There are loads of smaller changes: * The on-the-fly unifier `GHC.Tc.Utils.Unify.unifyType` has a cheap-and-cheerful version of `checkTyEqRhs`, called `simpleUnifyCheck`. If `simpleUnifyCheck` succeeds, it can unify, otherwise it defers by emitting a constraint. This is simpler than before. * I simplified the swapping code in `GHC.Tc.Solver.Equality.canEqCanLHS`. Especially the nasty stuff involving `swap_for_occurs` and `canEqTyVarFunEq`. Much nicer now. See Note [Orienting TyVarLHS/TyFamLHS] Note [Orienting TyFamLHS/TyFamLHS] * Added `cteSkolemOccurs`, `cteConcrete`, and `cteCoercionHole` to the problems that can be discovered by `checkTyEqRhs`. * I fixed #23199 `pickQuantifiablePreds`, which actually allows GHC to to accept both cases in #22194 rather than rejecting both. Yet smaller: * Added a `synIsConcrete` flag to `SynonymTyCon` (alongside `synIsFamFree`) to reduce the need for synonym expansion when checking concreteness. Use it in `isConcreteType`. * Renamed `isConcrete` to `isConcreteType` * Defined `GHC.Core.TyCo.FVs.isInjectiveInType` as a more efficient way to find if a particular type variable is used injectively than finding all the injective variables. It is called in `GHC.Tc.Utils.Unify.definitely_poly`, which in turn is used quite a lot. * Moved `rewriterView` to `GHC.Core.Type`, so we can use it from the constraint solver. Fixes #22194, #23199 Compile times decrease by an average of 0.1%; but there is a 7.4% drop in compiler allocation on T15703. Metric Decrease: T15703
* Stop if type constructors have kind errorsSimon Peyton Jones2023-04-146-17/+35
| | | | | | | | | Otherwise we get knock-on errors, such as #23252. This makes GHC fail a bit sooner, and I have not attempted to add recovery code, to add a fake TyCon place of the erroneous one, in an attempt to get more type errors in one pass. We could do that (perhaps) if there was a call for it.
* docs: Generate docs/index.html with version numberMatthew Pickering2023-04-143-4/+5
| | | | | | | | | | * Generate docs/index.html to include the version of the ghc library * This also fixes the packageVersions interpolations which were - Missing an interpolation for `LIBRARY_ghc_VERSION` - Double quoting the version so that "9.7" was being inserted. Fixes #23121
* rts: improve memory ordering and add some comments in the StablePtr ↵Adam Sandberg Ericsson2023-04-141-10/+36
| | | | implementation
* Base/JS: GHC.JS.Foreign.Callback module (issue 23126)Josh Meredith2023-04-1328-4/+638
| | | | | | | | | | | | | * Add the Callback module for "exporting" Haskell functions to be available to plain JavaScript code * Fix some primitives defined in GHC.JS.Prim * Add a JavaScript section to the user guide with instructions on how to use the JavaScript FFI, building up to using Callbacks to interact with the browser * Add tests for the JavaScript FFI and Callbacks
* Make WordQuotRem2Op ok-for-speculation tooSylvain Henry2023-04-132-3/+6
|
* Make Int64/Word64 division ok for speculation too.Sylvain Henry2023-04-132-13/+10
| | | | Only when the divisor is definitely non-zero.
* Add quot folding rule (#22152)Sylvain Henry2023-04-136-19/+177
| | | | | | | (x / l1) / l2 l1 and l2 /= 0 l1*l2 doesn't overflow ==> x / (l1 * l2)
* Add quotRem rules (#22152)Sylvain Henry2023-04-135-0/+92
| | | | | | | | | | | | | | case quotRemInt# x y of (# q, _ #) -> body ====> case quotInt# x y of q -> body case quotRemInt# x y of (# _, r #) -> body ====> case remInt# x y of r -> body
* Add regression test for #23229Rodrigo Mesquita2023-04-123-0/+3
|
* Allow generation of TTH syntax with THOleg Grenrus2023-04-1217-1/+88
| | | | | | | | | | | | | | | | | | | | In other words allow generation of typed splices and brackets with Untyped Template Haskell. That is useful in cases where a library is build with TTH in mind, but we still want to generate some auxiliary declarations, where TTH cannot help us, but untyped TH can. Such example is e.g. `staged-sop` which works with TTH, but we would like to derive `Generic` declarations with TH. An alternative approach is to use `unsafeCodeCoerce`, but then the derived `Generic` instances would be type-checked only at use sites, i.e. much later. Also `-ddump-splices` output is quite ugly: user-written instances would use TTH brackets, not `unsafeCodeCoerce`. This commit doesn't allow generating of untyped template splices and brackets with untyped TH, as I don't know why one would want to do that (instead of merging the splices, e.g.)
* Clarify a couple of Notes about 'nospec'Simon Peyton Jones2023-04-112-5/+12
|
* Set base 'maintainer' field to CLCBodigrim2023-04-111-2/+2
|
* compiler: apply cmm node-splitting for wasm backendCheng Shao2023-04-112-3/+10
| | | | | This patch applies cmm node-splitting for wasm32 NCG, which is required when handling irreducible CFGs. Fixes #23237.
* compiler: make WasmCodeGenM an instance of MonadUniqueCheng Shao2023-04-112-6/+14
|
* Add missing cases in -Di prettyprinterKrzysztof Gogolewski2023-04-115-0/+86
| | | | Fixes #23142
* Add support for -debug in the testsuiteKrzysztof Gogolewski2023-04-116-5/+21
| | | | Confusingly, GhcDebugged referred to GhcDebugAssertions.
* Renamer: don't call addUsedGRE on an exact Namesheaf2023-04-076-16/+41
| | | | | | | | | | When looking up a record field in GHC.Rename.Env.lookupRecFieldOcc, we could end up calling addUsedGRE on an exact Name, which would then lead to a panic in the bestImport function: it would be incapable of processing a GRE which is not local but also not brought into scope by any imports (as it is referred to by its unique instead). Fixes #23240
* Add structured error messages for GHC.Tc.TyCl.UtilsTorsten Schmits2023-04-077-18/+42
| | | | | | | | | Tracking ticket: #20117 MR: !10251 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`.
* Adjust wording wrt representation polymorphism of ($)Sebastian Graf2023-04-071-1/+1
|
* Remove trailing whitespace from ($) commentaryAlex Dixon2023-04-071-3/+3
|
* Improve documentation for ($) (#22963)Alex Dixon2023-04-071-12/+63
|
* Add release note for GHC.Unicode refactor in base-4.18.Pierre Le Marre2023-04-061-3/+4
| | | | | Also merge CLC proposal 130 in base-4.19 with CLC proposal 59 in base-4.18 and add proper release date.
* Fix reverse flag for -Wunsupported-llvm-versionBrandon Chinn2023-04-061-1/+1
|
* nonmoving: Disable slop-zeroingBen Gamari2023-04-061-4/+8
| | | | | | | | | As noted in #23170, the nonmoving GC can race with a mutator zeroing the slop of an updated thunk (in much the same way that two mutators would race). Consequently, we must disable slop-zeroing when the nonmoving GC is in use. Closes #23170
* Add testcase for #23192sheaf2023-04-042-0/+17
| | | | | | | | | | This issue around solving of constraints arising from superclass expansion using other constraints also borned from superclass expansion was the topic of commit aed1974e. That commit made sure we don't emit a "redundant constraint" warning in a situation in which removing the constraint would cause errors. Fixes #23192