summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update the users guide paragraph on -O in GHCiHEADmasterTorsten Schmits2023-05-171-30/+8
| | | | In relation to #23056
* Use setSrcSpan rather than setLclEnv in solveForAllMatthew Pickering2023-05-172-5/+7
| | | | | | | | | In subsequent MRs (#23409) we want to remove the TcLclEnv argument from a CtLoc. This MR prepares us for that by removing the one place where the entire TcLclEnv is used, by using it more precisely to just set the contexts source location. Fixes #23390
* JS: fix getpid (fix #23399)Sylvain Henry2023-05-164-1/+12
|
* Use glossary directiveBen Gamari2023-05-161-8/+9
|
* Update glossary.rstBen Gamari2023-05-161-11/+5
|
* users guide: Add glossaryBen Gamari2023-05-162-0/+19
| | | | | Currently this merely explains the meaning of "technology preview" in the context of released features.
* testsuite: add test for T22744Zubin Duggal2023-05-163-0/+44
| | | | | | | | | | | | | | This test checks for #22744 by compiling 100 modules which each have a dependency on 1000 distinct external files. Previously, when loading these interfaces from disk, each individual instance of a filepath in the interface will would be allocated as an individual object on the heap, meaning we have heap objects for 100*1000 files, when there are only 1000 distinct files we care about. This test checks this by first compiling the module normally, then measuring the peak memory usage in a no-op recompile, as the recompilation checking will force the allocation of all these filepaths.
* compiler: Use compact representation for UsageFile (#22744)Zubin Duggal2023-05-164-6/+9
| | | | | | Use FastString to store filepaths in interface files, as this data is highly redundant so we want to share all instances of filepaths in the compiler session.
* compiler: Use compact representation/FastStrings for `SourceNote`sZubin Duggal2023-05-1615-28/+33
| | | | | | | | `SourceNote`s should not be stored as [Char] as this is highly wasteful and in certain scenarios can be highly duplicated. Metric Decrease: hard_hole_fits
* compiler: Use compact representation for SourceTextZubin Duggal2023-05-1615-111/+123
| | | | | | | | | | | | SourceText is serialized along with INLINE pragmas into interface files. Many of these SourceTexts are identical, for example "{-# INLINE#". When deserialized, each such SourceText was previously expanded out into a [Char], which is highly wasteful of memory, and each such instance of the text would allocate an independent list with its contents as deserializing breaks any sharing that might have existed. Instead, we use a `FastString` to represent these, so that each instance unique text will be interned and stored in a memory efficient manner.
* JS: Implement h$clock_gettime in the JavaScript RTS (#23360)Josh Meredith2023-05-163-1/+22
|
* base: Introduce printToHandleFinalizerExceptionHandlerBen Gamari2023-05-167-3/+31
|
* base: Export {get,set}ExceptionFinalizer from System.Mem.WeakBen Gamari2023-05-162-0/+10
| | | | | | As proposed in CLC Proposal #126 [1]. [1]: https://github.com/haskell/core-libraries-committee/issues/126
* Add -Wmissing-role-annotationsOleg Grenrus2023-05-1612-4/+144
| | | | Implements #22702
* rts: fix --disable-large-address-spaceCheng Shao2023-05-162-9/+8
| | | | | | | | This patch moves ACQUIRE_ALLOC_BLOCK_SPIN_LOCK/RELEASE_ALLOC_BLOCK_SPIN_LOCK from Storage.h to HeapAlloc.h. When --disable-large-address-space is passed to configure, the code in HeapAlloc.h makes use of these two macros. Fixes #23385.
* configure: Drop unused AC_PROG_CPPRodrigo Mesquita2023-05-161-3/+0
| | | | | | | | | | | | | In configure, we were calling `AC_PROG_CPP` but never making use of the $CPP variable it sets or reads. The issue is $CPP will show up in the --help output of configure, falsely advertising a configuration option that does nothing. The reason we don't use the $CPP variable is because HS_CPP_CMD is expected to be a single command (without flags), but AC_PROG_CPP, when CPP is unset, will set said variable to something like `/usr/bin/gcc -E`. Instead, we configure HS_CPP_CMD through $CC.
* Migrate errors to diagnostics in GHC.Tc.Modulesheaf2023-05-15110-1378/+2223
| | | | | | | | | | | | | | | | | | | | This commit migrates the errors in GHC.Tc.Module to use the new diagnostic infrastructure. It required a significant overhaul of the compatibility checks between an hs-boot or signature module and its implementation; we now use a Writer monad to accumulate errors; see the BootMismatch datatype in GHC.Tc.Errors.Types, with its panoply of subtypes. For the sake of readability, several local functions inside the 'checkBootTyCon' function were split off into top-level functions. We split off GHC.Types.HscSource into a "boot or sig" vs "normal hs file" datatype, as this mirrors the logic in several other places where we want to treat hs-boot and hsig files in a similar fashion. This commit also refactors the Backpack checks for type synonyms implementing abstract data, to correctly reject implementations that contain qualified or quantified types (this fixes #23342 and #23344).
* Split up tyThingToIfaceDecl from GHC.Iface.Makesheaf2023-05-157-362/+404
| | | | | | | This commit moves tyThingToIfaceDecl and coAxiomToIfaceDecl from GHC.Iface.Make into GHC.Iface.Decl. This avoids GHC.Types.TyThing.Ppr, which needs tyThingToIfaceDecl, transitively depending on e.g. GHC.Iface.Load and GHC.Tc.Utils.Monad.
* rts: Don't sanity-check StgTSO.global_linkBen Gamari2023-05-151-3/+38
| | | | | | See Note [Avoid dangling global_link pointers]. Fixes #19146.
* rts: Introduce printGlobalThreadsBen Gamari2023-05-152-0/+15
|
* rts: Assert that pointers aren't cleared by -DZBen Gamari2023-05-153-18/+51
| | | | | | | | This turns many segmentation faults into much easier-to-debug assertion failures by ensuring that LOOKS_LIKE_*_PTR checks recognize bit-patterns produced by `+RTS -DZ` clearing as invalid pointers. This is a bit ad-hoc but this is the debug runtime.
* rts: Forcibly flush eventlog on barfBen Gamari2023-05-151-1/+6
| | | | | | | | | Previously we would attempt to flush via `endEventLogging` which can easily deadlock, e.g., if `barf` fails during GC. Using `flushEventLog` directly may result in slightly less consistent eventlog output (since we don't take all capabilities before flushing) but avoids deadlocking.
* rts: Don't force debug output to stderrBen Gamari2023-05-151-6/+7
| | | | | | | Previously `+RTS -Dw -l` would emit debug output to the eventlog while `+RTS -l -Dw` would emit it to stderr. This was because the parser for `-D` would unconditionally override the debug output target. Now we instead only do so if no it is currently `TRACE_NONE`.
* rts: Weak pointer cleanupsBen Gamari2023-05-152-14/+17
| | | | Various stylistic cleanups. No functional changes.
* Use unboxed codebuffers in baseJosh Meredith2023-05-159-493/+597
| | | | | Metric Decrease: encodingAllocations
* Replace the implementation of CodeBuffers with unboxed typesJosh Meredith2023-05-151-11/+50
|
* Split DynFlags structure into own moduleOleg Grenrus2023-05-1527-1444/+1572
| | | | | This will allow to make command line parsing to depend on diagnostic system (which depends on dynflags)
* Fix GHCJS OS platform (fix #23346)Sylvain Henry2023-05-156-1/+25
|
* Improve "ambiguous occurrence" error messagessheaf2023-05-1537-171/+251
| | | | | | | | | This error was sometimes a bit confusing, especially when data families were involved. This commit improves the general presentation of the "ambiguous occurrence" error, and adds a bit of extra context in the case of data families. Fixes #23301
* Unbreak some tests with latest GNU grep, which now warns about stray '\'.M Farkas-Dyck2023-05-154-5/+5
| | | | | | | | Confusingly, the testsuite mangled the error to say "stray /". We also migrate some tests from grep to grep -E, as it seems the author actually wanted an "POSIX extended" (a.k.a. sane) regex. Background: POSIX specifies 2 "regex" syntaxen: "basic" and "extended". Of these, only "extended" syntax is actually a regular expression. Furthermore, "basic" syntax is inconsistent in its use of the '\' character — sometimes it escapes a regex metacharacter, but sometimes it unescapes it, i.e. it makes an otherwise normal character become a metacharacter. This baffles me and it seems also the authors of these tests. Also, the regex(7) man page (at least on Linux) says "basic" syntax is obsolete. Nearly all modern tools and libraries are consistent in this use of the '\' character (of which many use "extended" syntax by default).
* Turn "ambiguous import" error into a panicsheaf2023-05-151-23/+36
| | | | | | | | | | | | | | | | This error should never occur, as a lookup of a type or data constructor should never be ambiguous. This is because a single module cannot export multiple Names with the same OccName, as per item (1) of Note [Exporting duplicate declarations] in GHC.Tc.Gen.Export. This code path was intended to handle duplicate record fields, but the rest of the code had since been refactored to handle those in a different way. We also remove the AmbiguousImport constructor of IELookupError, as it is no longer used. Fixes #23302
* Fix bad multiplicity role in tyConAppFunCo_maybesheaf2023-05-133-4/+10
| | | | | | | | | | The function tyConAppFunCo_maybe produces a multiplicity coercion for the multiplicity argument of the function arrow, except that it could be at the wrong role if asked to produce a representational coercion. We fix this by using the 'funRole' function, which computes the right roles for arguments to the function arrow TyCon. Fixes #23386
* Make GHC.Types.Id.Make.shouldUnpackTy a bit more cleverSimon Peyton Jones2023-05-139-63/+318
| | | | | | | As #23307, GHC.Types.Id.Make.shouldUnpackTy was leaving money on the table, failing to unpack arguments that are perfectly unpackable. The fix is pretty easy; see Note [Recursive unboxing]
* Add more instances for Compose: Enum, Bounded, Num, Real, IntegralBodigrim2023-05-132-0/+12
| | | | See https://github.com/haskell/core-libraries-committee/issues/160 for discussion
* Use a uniform return convention in bytecode for unary resultsAlexis King2023-05-1315-218/+201
| | | | fixes #22958
* Cleanup of dynflags override in export renamingBartłomiej Cieślar2023-05-124-71/+73
| | | | The deprecation warnings are normally emitted whenever the name's GRE is being looked up, which calls the GHC.Rename.Env.addUsedGRE function. We do not want those warnings to be emitted when renaming export lists, so they are artificially turned off by removing all warning categories from DynFlags at the beginning of GHC.Tc.Gen.Export.rnExports. This commit removes that dependency by unifying the function used for GRE lookup in lookup_ie to lookupGreAvailRn and disabling the call to addUsedGRE in said function (the warnings are also disabled in a call to lookupSubBndrOcc_helper in lookupChildrenExport), as per #17957. This commit also changes the setting for whether to warn about deprecated names in addUsedGREs to be an explicit enum instead of a boolean.
* Use the eager unifier in the constraint solverSimon Peyton Jones2023-05-1266-1152/+1671
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues the refactoring of the constraint solver described in #23070. The Big Deal in this patch is to call the regular, eager unifier from the constraint solver, when we want to create new equalities. This replaces the existing, unifyWanted which amounted to yet-another-unifier, so it reduces duplication of a rather subtle piece of technology. See * Note [The eager unifier] in GHC.Tc.Utils.Unify * GHC.Tc.Solver.Monad.wrapUnifierTcS I did lots of other refactoring along the way * I simplified the treatment of right hand sides that contain CoercionHoles. Now, a constraint that contains a hetero-kind CoercionHole is non-canonical, and cannot be used for rewriting or unification alike. This required me to add the ch_hertero_kind flag to CoercionHole, with consequent knock-on effects. See wrinkle (2) of `Note [Equalities with incompatible kinds]` in GHC.Tc.Solver.Equality. * I refactored the StopOrContinue type to add StartAgain, so that after a fundep improvement (for example) we can simply start the pipeline again. * I got rid of the unpleasant (and inefficient) rewriterSetFromType/Co functions. With Richard I concluded that they are never needed. * I discovered Wrinkle (W1) in Note [Wanteds rewrite Wanteds] in GHC.Tc.Types.Constraint, and therefore now prioritise non-rewritten equalities. Quite a few error messages change, I think always for the better. Compiler runtime stays about the same, with one outlier: a 17% improvement in T17836 Metric Decrease: T17836 T18223
* Move checkAxInstCo to GHC.Core.LintAdam Gundry2023-05-122-57/+64
| | | | | | | | A consequence of the previous change is that checkAxInstCo is no longer called during coercion optimization, so it can be moved back where it belongs. Also includes some edits to Note [Conflict checking with AxiomInstCo] as suggested by @simonpj.
* Less coercion optimization for non-newtype axiomsAdam Gundry2023-05-121-5/+85
| | | | | | | | | | | | | | | | | | See Note [Push transitivity inside newtype axioms only] for an explanation of the change here. This change substantially improves the performance of coercion optimization for programs involving transitive type family reductions. ------------------------- Metric Decrease: CoOpt_Singletons LargeRecord T12227 T12545 T13386 T15703 T5030 T8095 -------------------------
* hadrian: Fix linker script flag for MergeObjects builderAlexis King2023-05-121-2/+2
| | | | | | | | | This fixes what appears to have been a typo in !9530. The `-t` flag just enables tracing on all versions of `ld` I’ve looked at, while `-T` is used to specify a linker script. It seems that this worked anyway for some reason on some `ld` implementations (perhaps because they automatically detect linker scripts), but the missing `-T` argument causes `gold` to complain.
* Fix coercion optimisation for SelCo (#23362)Krzysztof Gogolewski2023-05-123-3/+34
| | | | | | setNominalRole_maybe is supposed to output a nominal coercion. In the SelCo case, it was not updating the stored role to Nominal, causing #23362.
* rts: Teach listAllBlocks about nonmoving heapTeo Camarasu2023-05-121-2/+29
| | | | | | List all blocks on the non-moving heap. Resolves #22627
* rts: Ensure non-moving gc is not running when pausingTeo Camarasu2023-05-121-0/+15
|
* Mention new implementation of GHC.IORef.atomicSwapIORef in the changelogwip/T23333Bodigrim2023-05-121-0/+1
|
* hadrian: Fix mention of non-existent removeFiles functionBen Gamari2023-05-121-1/+1
| | | | | | | | | | | | Previously Hadrian's bindist Makefile referred to a `removeFiles` function that was previously defined by the `make` build system. Since the `make` build system is no longer around, this function is now undefined. Naturally, make being make, this appears to be silently ignored instead of producing an error. Fix this by rewriting it to `rm -f`. Closes #23373.
* Allow Core optimizations when interpreting bytecodeKrzysztof Gogolewski2023-05-1211-2/+61
| | | | | | | | | | Tracking ticket: #23056 MR: !10399 This adds the flag `-funoptimized-core-for-interpreter`, permitting use of the `-O` flag to enable optimizations when compiling with the interpreter backend, like in ghci.
* Don't panic in mkNewTyConRhssheaf2023-05-126-26/+133
| | | | | | | | | | | | | This function could come across invalid newtype constructors, as we only perform validity checking of newtypes once we are outside the knot-tied typechecking loop. This patch changes this function to fake up a stub type in the case of an invalid newtype, instead of panicking. This patch also changes "checkNewDataCon" so that it reports as many errors as possible at once. Fixes #23308
* Doc: Fix out-of-sync using-optimisation pagePierre Le Marre2023-05-111-37/+40
| | | | | | - Make explicit that default flag values correspond to their -O0 value. - Fix -fignore-interface-pragmas, -fstg-cse, -fdo-eta-reduction, -fcross-module-specialise, -fsolve-constant-dicts, -fworker-wrapper.
* JS: refactor jsSaturate to return a saturated JStat (#23328)Josh Meredith2023-05-119-103/+85
|
* hadrian: fix no_dynamic_libs flavour transformerCheng Shao2023-05-111-14/+6
| | | | | | | This patch fixes the no_dynamic_libs flavour transformer and make fully_static reuse it. Previously building with no_dynamic_libs fails since ghc program is still dynamic and transitively brings in dyn ways of rts which are produced by no rules.