summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Force the Docs structure to prevent leaks in GHCi with -haddock without ↵wip/force-docsZubin Duggal2023-01-0311-12/+76
| | | | | | | | | | -fwrite-interface Involves adding many new NFData instances. Without forcing Docs, references to the TcGblEnv for each module are retained by the Docs structure. Usually these are forced when the ModIface is serialised but not when we aren't writing the interface.
* Drop support for kind constraints.wip/p547Richard Eisenberg2022-12-2418-426/+114
| | | | | | | | | | | | | | | | | | | | | | | | This implements proposal 547 and closes ticket #22298. See the proposal and ticket for motivation. Compiler perf improves a bit Metrics: compile_time/bytes allocated ------------------------------------- CoOpt_Singletons(normal) -2.4% GOOD T12545(normal) +1.0% T13035(normal) -13.5% GOOD T18478(normal) +0.9% T9872d(normal) -2.2% GOOD geo. mean -0.2% minimum -13.5% maximum +1.0% Metric Decrease: CoOpt_Singletons T13035 T9872d
* Store RdrName rather than OccName in HolesMatthew Pickering2022-12-2413-52/+100
| | | | | | | | | | | | | | | | | In #20472 it was pointed out that you couldn't defer out of scope but the implementation collapsed a RdrName into an OccName to stuff it into a Hole. This leads to the error message for a deferred qualified name dropping the qualification which affects the quality of the error message. This commit adds a bit more structure to a hole, so a hole can replace a RdrName without losing information about what that RdrName was. This is important when printing error messages. I also added a test which checks the Template Haskell deferral of out of scope qualified names works properly. Fixes #22130
* llvmGen: Fix relaxed orderingBen Gamari2022-12-241-1/+1
| | | | | | | Previously I used LLVM's `unordered` ordering for the C11 `relaxed` ordering. However, this is wrong and should rather use the LLVM `monotonic` ordering. Fixes #22640
* compiler: Ensure that GHC toolchain is first in search pathBen Gamari2022-12-241-5/+5
| | | | | | | As noted in #22561, it is important that GHC's toolchain look first for its own headers and libraries to ensure that the system's are not found instead. If this happens things can break in surprising ways (e.g. see #22561).
* add GHC.Utils.Binary.foldGet' and use for Ifacedoyougnu2022-12-232-2/+19
| | | | | | | | | | A minor optimization to remove lazy IO and a lazy accumulator strictify foldGet' IFace.Binary: use strict foldGet' remove superfluous bang
* Fix unifier bug: failing to decompose over-saturated type familySimon Peyton Jones2022-12-221-13/+15
| | | | This simple patch fixes #22647
* Refactor mkRuntimeErrorSimon Peyton Jones2022-12-228-91/+154
| | | | | | | | | This patch fixes #22634. Because we don't have TYPE/CONSTRAINT polymorphism, we need two error functions rather than one. I took the opportunity to rname runtimeError to impossibleError, to line up with mkImpossibleExpr, and avoid confusion with the genuine runtime-error-constructing functions.
* JS: fix support for -outputdir (#22641)Sylvain Henry2022-12-224-62/+56
| | | | | | | The `-outputdir` option wasn't correctly handled with the JS backend because the same code path was used to handle both objects produced by the JS backend and foreign .js files. Now we clearly distinguish the two in the pipeline, fixing the bug.
* EPA: Make EOF position part of AnnsModuleAlan Zimmerman2022-12-224-47/+38
| | | | | Closes #20951 Closes #19697
* base: Bump version to 4.18Ben Gamari2022-12-211-1/+1
| | | | Requires various submodule bumps.
* Fix an assertion check in addToEqualCtListSimon Peyton Jones2022-12-211-9/+17
| | | | | | | The old assertion saw that a constraint ct could rewrite itself (of course it can) and complained (stupid). Fixes #22645
* Fix shadowing lacuna in OccurAnalSimon Peyton Jones2022-12-212-23/+34
| | | | | | | | | | | | Issue #22623 demonstrated another lacuna in the implementation of wrinkle (BS3) in Note [The binder-swap substitution] in the occurrence analyser. I was failing to add TyVar lambda binders using addInScope/addOneInScope and that led to a totally bogus binder-swap transformation. Very easy to fix.
* Abstract over the right free varsSimon Peyton Jones2022-12-213-53/+118
| | | | | | | | | | | | | | | | | Fix #22459, in two ways: (1) Make the Specialiser not create a bogus specialisation if it is presented by strangely polymorphic dictionary. See Note [Weird special case in SpecDict] in GHC.Core.Opt.Specialise (2) Be more careful in abstractFloats See Note [Which type variables to abstract over] in GHC.Core.Opt.Simplify.Utils. So (2) stops creating the excessively polymorphic dictionary in abstractFloats, while (1) stops crashing if some other pass should nevertheless create a weirdly polymorphic dictionary.
* Allow transformers-0.6 in ghc, ghci, ghc-bin and hadrianBodigrim2022-12-211-1/+1
|
* Make GHC.Driver.Main.hscTcRnLookupRdrName to return NonEmptyBodigrim2022-12-203-4/+11
|
* Scrub some partiality in `GHC.Cmm.Info.Build`: `doSRTs` takes a `[(CAFSet, ↵M Farkas-Dyck2022-12-204-9/+23
| | | | CmmDecl)]` but truly wants a `[(CAFSet, CmmStatics)]`.
* compiler: make .wasm the default executable extension on wasm32Cheng Shao2022-12-172-4/+5
| | | | Following convention as in other wasm toolchains. Fixes #22594.
* compiler: add optional tail-call support in wasm NCGCheng Shao2022-12-167-32/+87
| | | | | | | | | When the `-mtail-call` clang flag is passed at configure time, wasm tail-call extension is enabled, and the wasm NCG will emit `return_call`/`return_call_indirect` instructions to take advantage of it and avoid the `StgRun` trampoline overhead. Closes #22461.
* compiler: change fallback function signature to Cmm function signature in ↵Cheng Shao2022-12-161-2/+4
| | | | | | | | | | wasm NCG In the wasm NCG, when handling a `CLabel` of undefined function without knowing its function signature, we used to fallback to `() -> ()` which is accepted by `wasm-ld`. This patch changes it to the signature of Cmm functions, which equally works, but would be required when we emit tail call instructions.
* compiler: add missing export list of GHC.CmmToAsm.Wasm.FromCmmCheng Shao2022-12-161-63/+7
| | | | Also removes some unreachable code here.
* compiler: remove obsolete commented code in wasm NCGCheng Shao2022-12-161-1/+0
| | | | | It was just a temporary hack to workaround a bug in the relooper, that bug has been fixed long before the wasm backend is merged.
* compiler: Use release store in eager blackholingBen Gamari2022-12-161-2/+2
|
* ghc: Fix data race in dump file handlingBen Gamari2022-12-161-12/+21
| | | | | | | Previously the dump filename cache would use a non-atomic update which could potentially result in lost dump contents. Note that this is still a bit racy since the first writer may lag behind a later appending writer.
* checkValidInst: Don't expand synonyms when splitting sigma typesRyan Scott2022-12-151-2/+29
| | | | | | | | | | | | | | | Previously, the `checkValidInst` function (used when checking that an instance declaration is headed by an actual type class, not a type synonym) was using `tcSplitSigmaTy` to split apart the `forall`s and instance context. This is incorrect, however, as `tcSplitSigmaTy` expands type synonyms, which can cause instances headed by quantified constraint type synonyms to be accepted erroneously. This patch introduces `splitInstTyForValidity`, a variant of `tcSplitSigmaTy` specialized for validity checking that does _not_ expand type synonyms, and uses it in `checkValidInst`. Fixes #22570.
* Fix bogus test in LintSimon Peyton Jones2022-12-154-79/+55
| | | | | | | | | | | | The Lint check for branch compatiblity within an axiom, in GHC.Core.Lint.compatible_branches was subtly different to the check made when contructing an axiom, in GHC.Core.FamInstEnv.compatibleBranches. The latter is correct, so I killed the former and am now using the latter. On the way I did some improvements to pretty-printing and documentation.
* compiler: Ensure that MutVar operations have necessary barriersBen Gamari2022-12-151-4/+5
| | | | | | | Here we add acquire and release barriers in readMutVar# and writeMutVar#, which are necessary for soundness. Fixes #22468.
* Package Imports: Get candidate packages also from re-exported modulesMatthew Pickering2022-12-152-3/+15
| | | | | | | | Previously we were just looking at the direct imports to try and work out what a package qualifier could apply to but #22333 pointed out we also needed to look for reexported modules. Fixes #22333
* codeGen: Introduce ThreadSanitizer instrumentationBen Gamari2022-12-157-2/+302
| | | | | | This introduces a new Cmm pass which instruments the program with ThreadSanitizer annotations, allowing full tracking of mutator memory accesses via TSAN.
* cmm/Parser: Atomic load syntaxBen Gamari2022-12-151-3/+23
| | | | | | | Originally I had thought I would just use the `prim` call syntax instead of introducing new syntax for atomic loads. However, it turns out that `prim` call syntax tends to make things quite unreadable. This new syntax seems quite natural.
* cmm/Parser: Add syntax for ordered loads and storesBen Gamari2022-12-153-6/+55
|
* cmm/Parser: Reduce some repetitionBen Gamari2022-12-151-29/+20
|
* Codegen/x86: Eliminate barrier for relaxed accessesBen Gamari2022-12-151-7/+12
|
* llvm: Respect memory specified orderingsBen Gamari2022-12-151-7/+15
|
* cmm: Introduce MemoryOrderingsBen Gamari2022-12-158-24/+36
|
* cmm: Introduce blockConcatBen Gamari2022-12-152-1/+4
|
* JS: fix object file name comparison (#22578)Sylvain Henry2022-12-131-1/+8
|
* EPA: When splitting out header comments, keep ones for first declAlan Zimmerman2022-12-131-3/+23
| | | | | Any comments immediately preceding the first declaration are no longer kept as header comments, but attach to the first declaration instead.
* Fix loop in the interface representation of some `Unfolding` fieldsGergő Érdi2022-12-1314-101/+224
| | | | | | | | | | | | | | | As discovered in #22272, dehydration of the unfolding info of a recursive definition used to involve a traversal of the definition itself, which in turn involves traversing the unfolding info. Hence, a loop. Instead, we now store enough data in the interface that we can produce the unfolding info without this traversal. See Note [Tying the 'CoreUnfolding' knot] for details. Fixes #22272 Co-authored-by: Simon Peyton Jones <simon.peytonjones@gmail.com>
* Respect -XStrict in the pattern-match checker (#21761)Sebastian Graf2022-12-131-2/+31
| | | | | | | | We were missing a call to `decideBangHood` in the pattern-match checker. There is another call in `matchWrapper.mk_eqn_info` which seems redundant but really is not; see `Note [Desugaring -XStrict matches in Pmc]`. Fixes #21761.
* hlint: Removed redundant UnboxedSums pragmasMatthew Pickering2022-12-093-3/+0
| | | | | | | UnboxedSums is quite confusingly implied by UnboxedTuples, alas, just the way it is. See #22485
* driver: Set correct UnitId when rehydrating modulesMatthew Pickering2022-12-091-2/+3
| | | | | | | | We were not setting the UnitId before rehydrating modules which just led to us attempting to find things in the wrong HPT. The test for this is the hadrian-multi command (which is now added as a CI job). Fixes #22222
* Fixes around primitive literalsKrzysztof Gogolewski2022-12-083-18/+19
| | | | | | | | | * The SourceText of primitive characters 'a'# did not include the #, unlike for other primitive literals 1#, 1##, 1.0#, 1.0##, "a"#. We can now remove the function pp_st_suffix, which was a hack to add the # back. * Negative primitive literals shouldn't use parentheses, as described in Note [Printing of literals in Core]. Added a testcase to T14681.
* Do not strictify a DFun's parameter dictionaries (#22549)Sebastian Graf2022-12-082-38/+66
| | | | | | | | | ... thus fixing #22549. The details are in the refurbished and no longer dead `Note [Do not strictify a DFun's parameter dictionaries]`. There's a regression test in T22549.
* Typeable: Fix module locations of some definitions in GHC.TypesMatthew Pickering2022-12-081-4/+17
| | | | | | | | | | | | | There was some confusion in Data.Typeable about which module certain wired-in things were defined in. Just because something is wired-in doesn't mean it comes from GHC.Prim, in particular things like LiftedRep and RuntimeRep are defined in GHC.Types and that's the end of the story. Things like Int#, Float# etc are defined in GHC.Prim as they have no Haskell definition site at all so we need to generate type representations for them (which live in GHC.Types). Fixes #22510
* Add initial support for LoongArch Architecture.lrzlin2022-12-0811-1/+100
|
* Fix mk_mod_usage_info if the interface file is not already loadedMatthew Pickering2022-12-083-32/+34
| | | | | | | | | | | | | | | | | | | | In #22217 it was observed that the order modules are compiled in affects the contents of an interface file. This was because a module dependended on another module indirectly, via a re-export but the interface file for this module was never loaded because the symbol was never used in the file. If we decide that we depend on a module then we jolly well ought to record this fact in the interface file! Otherwise it could lead to very subtle recompilation bugs if the dependency is not tracked and the module is updated. Therefore the best thing to do is just to make sure the file is loaded by calling the `loadSysInterface` function. This first checks the caches (like we did before) but then actually goes to find the interface on disk if it wasn't loaded. Fixes #22217
* backpack: Be more careful when adding together ImportAvailsMatthew Pickering2022-12-082-11/+22
| | | | | | | | | | | | | | There was some code in the signature merging logic which added together the ImportAvails of the signature and the signature which was merged into it. This had the side-effect of making the merged signature depend on the signature (via a normal module dependency). The intention was to propagate orphan instances through the merge but this also messed up recompilation logic because we shouldn't be attempting to load B.hi when mergeing it. The fix is to just combine the part of ImportAvails that we intended to (transitive info, orphan instances and type family instances) rather than the whole thing.
* Add version of `reachableGraph` that avoids loop for cyclic inputsGergő Érdi2022-12-081-26/+77
| | | | | | by building its result connected component by component Fixes #22512
* Remove copy-pasted definitions of `graphFromEdgedVertices*`Gergő Érdi2022-12-081-2/+2
|