summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Give parsing plugins access to errorswip/T20803Jakob Brünker2022-03-2418-22/+226
| | | | | | | | | | | Previously, when the parser produced non-fatal errors (i.e. it produced errors but the 'PState' is 'POk'), compilation would be aborted before the 'parsedResultAction' of any plugin was invoked. This commit changes that, so that such that 'parsedResultAction' gets collections of warnings and errors as argument, and must return them after potentially modifying them. Closes #20803
* Hadrian: use IntSet Binary instance for Way (#19209)Sylvain Henry2022-03-121-2/+2
|
* Hadrian: avoid allocations in WayUnit's Read instance (#19209)Sylvain Henry2022-03-121-1/+8
|
* Hadrian: remove useless importsSylvain Henry2022-03-122-5/+0
| | | | Added for no reason in 7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6
* Hadrian: avoid allocating in stageString (#19209)Sylvain Henry2022-03-121-1/+6
|
* Hadrian: avoid useless allocations in trackArgumentSylvain Henry2022-03-121-4/+12
| | | | | | | | Cf ticky report before the change: Entries Alloc Alloc'd Non-void Arguments STG Name -------------------------------------------------------------------------------- 696987 29044128 0 1 L main:Target.trackArgument_go5{v r24kY} (fun)
* Rename -fprof-late-ccs to -fprof-lateAndreas Klebinger2022-03-124-6/+6
|
* checkUnboxedLitPat: use non-fatal addErrorVladislav Zavialov2022-03-122-2/+10
| | | | This enables GHC to report more parse errors in a single pass.
* ghc-bignum: Tweak integerOrSimon Jakobi2022-03-111-2/+2
| | | | | | The result of ORing two BigNats is always greater or equal to the larger of the two. Therefore it is safe to skip the magnitude checks of integerFromBigNat#.
* users guide: Eliminate spurious \spxentry mentionsBen Gamari2022-03-112-3/+9
| | | | | | | We were failing to pass the style file to `makeindex`, as is done by the mklatex configuration generated by Sphinx. Fixes #20913.
* CmmToC: fix -Wunused-value warning in ASSIGN_BaseRegCheng Shao2022-03-111-1/+1
| | | | | | When ASSIGN_BaseReg is a no-op, we shouldn't generate any C code, otherwise C compiler complains a bunch of -Wunused-value warnings when doing unregisterised codegen.
* CmmToC: make floatToWord32/doubleToWord64 fasterCheng Shao2022-03-111-24/+3
| | | | | Use castFloatToWord32/castDoubleToWord64 in base to perform the reinterpret cast.
* CmmToC: emit __builtin_unreachable() when CmmSwitch doesn't contain fallback ↵Cheng Shao2022-03-111-1/+1
| | | | | | | case Otherwise the C compiler may complain "warning: non-void function does not return a value in all control paths [-Wreturn-type]".
* CmmToC: use __builtin versions of memcpyish functions to fix type mismatchCheng Shao2022-03-111-5/+4
| | | | | | | | | | | | | Our memcpyish primop's type signatures doesn't match the C type signatures. It's not a problem for typical archs, since their C ABI permits dropping the result, but it doesn't work for wasm. The previous logic would cast the memcpyish function pointer to an incorrect type and perform an indirect call, which results in a runtime trap on wasm. The most straightforward fix is: don't emit EFF_ for memcpyish functions. Since we don't want to include extra headers in .hc to bring in their prototypes, we can just use the __builtin versions.
* CmmToC: fix Double# literal payload for 32-bit targetsCheng Shao2022-03-111-3/+2
| | | | | | Contrary to the legacy comment, the splitting didn't happen and we ended up with a single StgWord64 literal in the output code! Let's just do the splitting here.
* CmmToC: make 64-bit word splitting for 32-bit targets respect target endiannessCheng Shao2022-03-111-1/+3
| | | | This used to been broken for little-endian targets.
* Demand: Document why we need three additional equations of multSubDmdSebastian Graf2022-03-111-17/+20
|
* gitignore all (build) directories headed by _Sebastian Graf2022-03-111-2/+2
|
* Improve clearBit and complementBit for NaturalSimon Jakobi2022-03-114-8/+46
| | | | | | Also optimize bigNatComplementBit#. Fixes #21175, #21181, #21194.
* Improve -dtag-inference-checks checks.Andreas Klebinger2022-03-113-13/+40
| | | | | FUN closures don't get tagged when evaluated. So no point in checking their tags.
* Remove partOfGhci check in the loaderMatthew Pickering2022-03-111-29/+7
| | | | | | | | | | | | | | | | | | This special logic has been part of GHC ever since template haskell was introduced in 9af77fa423926fbda946b31e174173d0ec5ebac8. It's hard to believe in any case that this special logic pays its way at all. Given * The list is out-of-date, which has potential to lead to miscompilation when using "editline", which was removed in 2010 (46aed8a4). * The performance benefit seems negligable as each load only happens once anyway and packages specified by package flags are preloaded into the linker state at the start of compilation. Therefore we just remove this logic. Fixes #19791
* gitlab-ci: Use the linters image in hlint jobBen Gamari2022-03-1115-20/+7
| | | | | | As the `hlint` executable is only available in the linters image. Fixes #21146.
* Refactor tcDeriving to generate tyfam insts before any bindingsRyan Scott2022-03-116-309/+347
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, there was an awful hack in `genInst` (now called `genInstBinds` after this patch) where we had to return a continutation rather than directly returning the bindings for a derived instance. This was done for staging purposes, as we had to first infer the instance contexts for derived instances and then feed these contexts into the continuations to ensure the generated instance bindings had accurate instance contexts. `Note [Staging of tcDeriving]` in `GHC.Tc.Deriving` described this confusing state of affairs. The root cause of this confusing design was the fact that `genInst` was trying to generate instance bindings and associated type family instances for derived instances simultaneously. This really isn't possible, however: as `Note [Staging of tcDeriving]` explains, one needs to have access to the associated type family instances before one can properly infer the instance contexts for derived instances. The use of continuation-returning style was an attempt to circumvent this dependency, but it did so in an awkward way. This patch detangles this awkwardness by splitting up `genInst` into two functions: `genFamInsts` (for associated type family instances) and `genInstBinds` (for instance bindings). Now, the `tcDeriving` function calls `genFamInsts` and brings all the family instances into scope before calling `genInstBinds`. This removes the need for the awkward continuation-returning style seen in the previous version of `genInst`, making the code easier to understand. There are some knock-on changes as well: 1. `hasStockDeriving` now needs to return two separate functions: one that describes how to generate family instances for a stock-derived instance, and another that describes how to generate the instance bindings. I factored out this pattern into a new `StockGenFns` data type. 2. While documenting `StockGenFns`, I realized that there was some inconsistency regarding which `StockGenFns` functions needed which arguments. In particular, the function in `GHC.Tc.Deriv.Generics` which generates `Rep(1)` instances did not take a `SrcSpan` like other `gen_*` functions did, and it included an extra `[Type]` argument that was entirely redundant. As a consequence, I refactored the code in `GHC.Tc.Deriv.Generics` to more closely resemble other `gen_*` functions. A happy result of all this is that all `StockGenFns` functions now take exactly the same arguments, which makes everything more uniform. This is purely a refactoring that should not have any effect on user-observable behavior. The new design paves the way for an eventual fix for #20719.
* Normalise output of T10970 testMatthew Pickering2022-03-103-3/+3
| | | | | | The output of this test changes each time the containers submodule version updates. It's easier to apply the version normaliser so that the test checks that there is a version number, but not which one it is.
* Add an inline pragma to lookupVarEnvMatthew Pickering2022-03-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The containers bump reduced the size of the Data.IntMap.Internal.lookup function so that it no longer experienced W/W. This means that the size of lookupVarEnv increased over the inlining threshold and it wasn't inlined into the hot code path in substTyVar. See containers#821, #21159 and !7638 for some more explanation. ------------------------- Metric Decrease: LargeRecord T12227 T13386 T15703 T18223 T5030 T8095 T9872a T9872b T9872c TcPlugin_RewritePerf -------------------------
* Bump submodules: containers, exceptionsVladislav Zavialov2022-03-103-1/+1
| | | | | | GHC Proposal #371 requires TypeOperators to use type equality a~b. This submodule update pulls in the appropriate forward-compatibility changes in 'libraries/containers' and 'libraries/exceptions'
* mr-template: Mention timeframe for reviewBen Gamari2022-03-101-0/+4
|
* ci: Fix save_cache functionwip/linters-stage1Matthew Pickering2022-03-092-1/+2
| | | | | | | | | | | | | | Each interation of saving the cache would copy the whole `cabal` store into a subfolder in the CACHE_DIR rather than copying the contents of the cabal store into the cache dir. This resulted in a cache which looked like: ``` /builds/ghc/ghc/cabal-cache/cabal/cabal/cabal/cabal/cabal/cabal/cabal/cabal/cabal/cabal/ ``` So it would get one layer deeper every CI run and take longer and longer to compress.
* Revert "hadrian: Correctly set whether we have a debug compiler when running ↵Matthew Pickering2022-03-092-11/+3
| | | | | | | | | | | tests" Needing the arguments for "GHC/Utils/Constant.hs" implies a dependency on the previous stage compiler. Whilst we work out how to get around this I will just revert this commit (as it only affects running the testsuite in debug way). This reverts commit ce65d0cceda4a028f30deafa3c39d40a250acc6a.
* Add 10 minute timeout to linters jobMatthew Pickering2022-03-091-1/+1
|
* Move bootstrap and cabal-reinstall test jobs to nightlywip/night-jobsMatthew Pickering2022-03-081-4/+4
| | | | | CI is creaking under the pressure of too many jobs so attempt to reduce the strain by removing a couple of jobs.
* Delete GenericKind_ in favor of GenericKind_DCRyan Scott2022-03-073-71/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deriving a `Generic1` instance, we need to know what the last type variable of a data type is. Previously, there were two mechanisms to determine this information: * `GenericKind_`, where `Gen1_` stored the last type variable of a data type constructor (i.e., the `tyConTyVars`). * `GenericKind_DC`, where `Gen1_DC` stored the last universally quantified type variable in a data constructor (i.e., the `dataConUnivTyVars`). These had different use cases, as `GenericKind_` was used for generating `Rep(1)` instances, while `GenericKind_DC` was used for generating `from(1)` and `to(1)` implementations. This was already a bit confusing, but things went from confusing to outright wrong after !6976. This is because after !6976, the `deriving` machinery stopped using `tyConTyVars` in favor of `dataConUnivTyVars`. Well, everywhere with the sole exception of `GenericKind_`, which still continued to use `tyConTyVars`. This lead to disaster when deriving a `Generic1` instance for a GADT family instance, as the `tyConTyVars` do not match the `dataConUnivTyVars`. (See #21185.) The fix is to stop using `GenericKind_` and replace it with `GenericKind_DC`. For the most part, this proves relatively straightforward. Some highlights: * The `forgetArgVar` function was deleted entirely, as it no longer proved necessary after `GenericKind_`'s demise. * The substitution that maps from the last type variable to `Any` (see `Note [Generating a correctly typed Rep instance]`) had to be moved from `tc_mkRepTy` to `tc_mkRepFamInsts`, as `tc_mkRepTy` no longer has access to the last type variable. Fixes #21185.
* Expand and improve the Note [Strict Worker Ids].Andreas Klebinger2022-03-072-5/+24
| | | | | I've added an explicit mention of the invariants surrounding those. As well as adding more direct cross references to the Strict Field Invariant.
* Remove leftover trace in testsuiteMatthew Pickering2022-03-071-1/+0
|
* Improve setBit for NaturalSimon Jakobi2022-03-074-0/+14
| | | | | | | Previously the default definition was used, which involved allocating intermediate Natural values. Fixes #21173.
* Fix reporting constraints in pprTcSolverReportMsgKrzysztof Gogolewski2022-03-072-18/+24
| | | | 'no_instance_msg' and 'no_deduce_msg' were omitting the first wanted.
* Fix gen_contents_index logic for hadrian bindistMatthew Pickering2022-03-074-4/+26
|
* Replace use of BIN_DIST_PREP_TAR_COMP with BIN_DIST_NAMEMatthew Pickering2022-03-072-7/+8
| | | | | And adds a check to make sure we are not accidently settings BIN_DIST_PREP_TAR_COMP when using hadrian.
* ci: Convert all deb10 make jobs into hadrian jobsMatthew Pickering2022-03-071-151/+139
| | | | | | | | | | | | | | | This is the first step in converting all the CI configs to use hadrian rather than make. (#21129) The metrics increase due to hadrian using --hyperlinked-source for haddock builds. (See #21156) ------------------------- Metric Increase: haddock.Cabal haddock.base haddock.compiler -------------------------
* hadrian: Add little flavour transformer to build stage2 with assertionsMatthew Pickering2022-03-072-1/+15
| | | | | This can be useful to build a `perf+assertions` build or even better `default+no_profiled_libs+omit_pragmas+assertions`.
* Always generalise top-level bindingsSimon Peyton Jones2022-03-075-30/+70
| | | | | Fix #21023 by always generalising top-level binding; change the documentation of -XMonoLocalBinds to match.
* Make T20214 terminate promptly be setting input to /dev/nullGreg Steuck2022-03-051-1/+1
| | | | It was hanging and timing out on OpenBSD before.
* Don't allow Float#/Double# literal patternssheaf2022-03-0513-20/+132
| | | | | | | | | | | | | | This patch does the following two things: 1. Fix the check in Core Lint to properly throw an error when it comes across Float#/Double# literal patterns. The check was incorrect before, because it expected the type to be Float/Double instead of Float#/Double#. 2. Add an error in the parser when the user writes a floating-point literal pattern such as `case x of { 2.0## -> ... }`. Fixes #21115
* remove MonadFail instances of STArtem Pelenitsyn2022-03-056-18/+7
| | | | | | | | CLC proposal: https://github.com/haskell/core-libraries-committee/issues/33 The instances had `fail` implemented in terms of `error`, whereas the idea of the `MonadFail` class is that the `fail` method should be implemented in terms of the monad itself.
* Fix comments about Int64/Word64 primopsSylvain Henry2022-03-041-6/+2
|
* base: Mark GHC.Bits not-home for haddockSimon Jakobi2022-03-041-0/+2
| | | | | Most (all) of the exports are re-exported from the preferable Data.Bits.
* Update documentation of LiberalTypeSynonymsKrzysztof Gogolewski2022-03-041-21/+1
| | | | | | | | | We no longer require LiberalTypeSynonyms to use 'forall' or an unboxed tuple in a synonym. I also removed that kind checking before expanding synonyms "could be changed". This was true when type synonyms were thought of macros, but with the extensions such as SAKS or matchability I don't see it changing.
* Replace ad-hoc CPP with constant from GHC.Utils.ConstantMatthew Pickering2022-03-031-8/+2
| | | | Fixes #21154
* docs: Add note to RULES documentation about locally bound variables [skip ci]Matthew Pickering2022-03-031-0/+25
| | | | Fixes #20100
* docs: Add note to unsafeCoerce function that you might want to use coerce ↵Matthew Pickering2022-03-031-0/+4
| | | | | | [skip ci] Fixes #15429