summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* FFI: Fix pass small ints in foreign call wrapperswip/T15933Peter Trommler2020-06-138-6/+62
| | | | | | | | | | The Haskell calling convention requires integer parameters smaller than wordsize to be promoted to wordsize (where the upper bits are don't care). To access such small integer parameter read a word from the parameter array and then cast that word to the small integer target type. Fixes #15933
* gitlab-ci: Always push perf notesBen Gamari2020-06-131-2/+11
| | | | | | | | | | Previously we ci.sh would run with `set -e` implying that we wouldn't push perf notes if the testsuite were to fail, even if it *only* failed due to perf notes. This rendered the whole performance testing story quite fragile as a single regressing commit would cause every successive commit to fail since a new baseline would not be uploaded. Fix this by ensuring that we always push performance notes.
* testsuite: Increase size of T12150Ben Gamari2020-06-131-0/+410
| | | | | | | | | As noted in #18319, this test was previously very fragile. Increase its size to make it more likely that its fails with its newly-increased acceptance threshold. Metric Increase: T12150
* Fix #12073: Add MonadFix Q instanceOleg Grenrus2020-06-136-1/+64
|
* Add introductory prose for Data.TraversableViktor Dukhovni2020-06-131-92/+419
|
* Trim the demand for recursive product typesSimon Peyton Jones2020-06-135-213/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ticket #18304 showed that we need to be very careful when exploring the demand (esp usage demand) on recursive product types. This patch solves the problem by trimming the demand on such types -- in effect, a form of "widening". See the Note [Trimming a demand to a type] in DmdAnal, which explains how I did this by piggy-backing on an existing mechansim for trimming demands becuase of GADTs. The significant payload of this patch is very small indeed: * Make GHC.Core.Opt.WorkWrap.Utils.typeShape use RecTcChecker to avoid looking through recursive types. But on the way * I found that ae_rec_tc was entirely inoperative and did nothing. So I removed it altogether from DmdAnal. * I moved some code around in DmdAnal and Demand. (There are no actual changes in dmdFix.) * I changed the API of DmsAnal.dmdAnalRhsLetDown to return a StrictSig rather than a decorated Id * I removed the dead function peelTsFuns from Demand Performance effects: Nofib: 0.0% changes. Not surprising, because they don't use recursive products Perf tests T12227: 1% increase in compiler allocation, becuase $cto gets w/w'd. It did not w/w before because it takes a deeply nested argument, so the worker gets too many args, so we abandon w/w altogether (see GHC.Core.Opt.WorkWrap.Utils.isWorkerSmallEnough) With this patch we trim the demands. That is not strictly necessary (since these Generic type constructors are like tuples -- they can't cause a loop) but the net result is that we now w/w $cto which is fine. UniqLoop: 16% decrease in /runtime/ allocation. The UniqSupply is a recursive product, so currently we abandon all strictness on 'churn'. With this patch 'churn' gets useful strictness, and we w/w it. Hooray Metric Decrease: UniqLoop Metric Increase: T12227
* Bump haddock submodule and allow metric decreaseSylvain Henry2020-06-131-0/+0
| | | | | | | | | | Metric Decrease: T12150 T12234 T5837 Metric Increase: T16190
* Doc: fix some commentsSylvain Henry2020-06-131-58/+52
|
* NCGConfig: remove useless ncgUnitId fieldSylvain Henry2020-06-132-3/+0
|
* Don't return preload units when we set DyNFlagsSylvain Henry2020-06-137-23/+26
| | | | Preload units can be retrieved in UnitState when needed (i.e. in GHCi)
* Put database cache in UnitConfigSylvain Henry2020-06-131-43/+34
|
* Create helper upd_wired_in_home_instantiationsSylvain Henry2020-06-131-9/+17
|
* Move distrustAll into mkUnitStateSylvain Henry2020-06-131-13/+12
|
* DynFlags: add UnitConfig datatypeSylvain Henry2020-06-133-120/+182
| | | | | | Avoid directly querying flags from DynFlags to build the UnitState. Instead go via UnitConfig so that we could reuse this to make another UnitState for plugins.
* DynFlags: merge_databasesSylvain Henry2020-06-131-9/+11
|
* DynFlags: reportCycles, reportUnusableSylvain Henry2020-06-131-8/+8
|
* DynFlags: findWiredInUnitsSylvain Henry2020-06-131-6/+6
|
* Refactor and document closeUnitDepsSylvain Henry2020-06-131-30/+26
|
* Refactor and document add_packageSylvain Henry2020-06-131-25/+26
|
* DynFlags: make listVisibleModuleNames take a UnitStateSylvain Henry2020-06-133-6/+8
|
* DynFlags: remove useless add_package parameterSylvain Henry2020-06-131-9/+7
|
* Document getPreloadUnitsAndSylvain Henry2020-06-131-4/+5
|
* DynFlags: refactor unwireUnitSylvain Henry2020-06-133-11/+12
|
* Remove preload parameter of mkUnitStateSylvain Henry2020-06-131-12/+8
| | | | | | * Remove preload parameter (unused) * Don't explicitly return preloaded units: redundant because already returned as "preloadUnits" field of UnitState
* Avoid timing module map dump in initUnitsSylvain Henry2020-06-131-18/+24
|
* Move wiring of homeUnitInstantiations outside of mkUnitStateSylvain Henry2020-06-131-8/+16
|
* Move dump_mod_map into initUnitsSylvain Henry2020-06-131-8/+8
|
* Rename Package into Unit (2)Sylvain Henry2020-06-1316-118/+118
| | | | | | | * rename PackageState into UnitState * rename findWiredInPackages into findWiredInUnits * rename lookupModuleInAll[Packages,Units] * etc.
* Remove ClosureUnitInfoMapSylvain Henry2020-06-138-185/+168
|
* Make ClosureUnitInfoMap uses UnitInfoMapSylvain Henry2020-06-132-18/+37
|
* Rename Package into UnitSylvain Henry2020-06-1325-267/+262
| | | | | | | | | | | | | | | | | | | | | | | | | The terminology changed over time and now package databases contain "units" (there can be several units compiled from a single Cabal package: one per-component, one for each option set, one per instantiation, etc.). We should try to be consistent internally and use "units": that's what this renaming does. Maybe one day we'll fix the UI too (e.g. replace -package-id with -unit-id, we already have -this-unit-id and ghc-pkg has -unit-id...) but it's not done in this patch. * rename getPkgFrameworkOpts into getUnitFrameworkOpts * rename UnitInfoMap into ClosureUnitInfoMap * rename InstalledPackageIndex into UnitInfoMap * rename UnusablePackages into UnusableUnits * rename PackagePrecedenceIndex into UnitPrecedenceMap * rename PackageDatabase into UnitDatabase * rename pkgDatabase into unitDatabases * rename pkgState into unitState * rename initPackages into initUnits * rename renamePackage into renameUnitInfo * rename UnusablePackageReason into UnusableUnitReason * rename getPackage* into getUnit* * etc.
* Rename listUnitInfoMap into listUnitInfoSylvain Henry2020-06-131-5/+5
| | | | There is no Map involved
* Remove PreloadUnitId type aliasSylvain Henry2020-06-131-17/+15
|
* Document and refactor `mkUnit` and `mkUnitInfoMap`Sylvain Henry2020-06-132-15/+31
|
* Refactor WiredMapSylvain Henry2020-06-132-48/+33
| | | | * Remove WiredInUnitId and WiredUnitId type aliases
* Remove LinkerUnitId type aliasSylvain Henry2020-06-132-9/+5
|
* Enhance UnitId useSylvain Henry2020-06-1329-133/+156
| | | | | | | | * use UnitId instead of String to identify wired-in units * use UnitId instead of Unit in the backend (Unit are only use by Backpack to produce type-checked interfaces, not real code) * rename lookup functions for consistency * documentation
* Add allowVirtualUnits field in PackageStateSylvain Henry2020-06-1311-73/+90
| | | | | | | | | | Instead of always querying DynFlags to know whether we are allowed to use virtual units (i.e. instantiated on-the-fly, cf Note [About units] in GHC.Unit), we store it once for all in `PackageState.allowVirtualUnits`. This avoids using DynFlags too much (cf #17957) and is preliminary work for #14335.
* Rename unsafeGetUnitInfo into unsafeLookupUnitSylvain Henry2020-06-136-11/+11
|
* Refactor homeUnitSylvain Henry2020-06-1330-161/+165
| | | | | * rename thisPackage into homeUnit * document and refactor several Backpack things
* Remove unused codeSylvain Henry2020-06-131-23/+0
|
* DynFlags refactoring VIII (#17957)Sylvain Henry2020-06-1310-322/+356
| | | | | | | | | | | * Remove several uses of `sdocWithDynFlags`, especially in GHC.Llvm.* * Add LlvmOpts datatype to store Llvm backend options * Remove Outputable instances (for LlvmVar, LlvmLit, LlvmStatic and Llvm.MetaExpr) which require LlvmOpts. * Rename ppMetaExpr into ppMetaAnnotExpr (pprMetaExpr is now used in place of `ppr :: MetaExpr -> SDoc`)
* Only test T16190 with the NCGSylvain Henry2020-06-131-1/+4
| | | | | T16190 is meant to test a NCG feature. It has already caused spurious failures in other MRs (e.g. !2165) when LLVM is used.
* Release Notes: Add news from the pattern-match checker [skip ci]wip/pmcheck-release-notes-8.12Sebastian Graf2020-06-111-0/+13
|
* test: fix conc038Sylvain Henry2020-06-102-3/+3
| | | | | | | | | | | | | | | | We had spurious failures of conc038 test on CI with stdout: ``` newThread started -mainThread -Haskell: 2 newThread back again +mainThread 1 sec later shutting down +Haskell: 2 ```
* Initialize the allocation counter in GHCi to 0 (Fixes #16012)Roland Senn2020-06-104-2/+6
| | | | | | According to the documentation for the function `getAllocationCounter` in [System.Mem](http://hackage.haskell.org/package/base-4.14.0.0/docs/System-Mem.html) initialize the allocationCounter also in GHCi to 0.
* Fix lookupGlobalOccRn_maybe sometimes reporting an errorLuke Lau2020-06-106-62/+136
| | | | | | | | | | | | | | | | | In some cases it was possible for lookupGlobalOccRn_maybe to return an error, when it should be returning a Nothing. If it called lookupExactOcc_either when there were no matching GlobalRdrElts in the otherwise case, it would return an error message. This could be caused when lookupThName_maybe in Template Haskell was looking in different namespaces (thRdrNameGuesses), guessing different namespaces that the name wasn't guaranteed to be found in. However, by addressing this some more accurate errors were being lost in the conversion to Maybes. So some of the lookup* functions have been shuffled about so that errors should always be ignored in lookup*_maybes, and propagated otherwise. This fixes #18263
* Implement cast worker/wrapper properlySimon Peyton Jones2020-06-1032-416/+910
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cast worker/wrapper transformation transforms x = e |> co into y = e x = y |> co This is done by the simplifier, but we were being careless about transferring IdInfo from x to y, and about what to do if x is a NOINLNE function. This resulted in a series of bugs: #17673, #18093, #18078. This patch fixes all that: * Main change is in GHC.Core.Opt.Simplify, and the new prepareBinding function, which does this cast worker/wrapper transform. See Note [Cast worker/wrappers]. * There is quite a bit of refactoring around prepareRhs, makeTrivial etc. It's nicer now. * Some wrappers from strictness and cast w/w, notably those for a function with a NOINLINE, should inline very late. There wasn't really a mechanism for that, which was an existing bug really; so I invented a new finalPhase = Phase (-1). It's used for all simplifier runs after the user-visible phase 2,1,0 have run. (No new runs of the simplifier are introduced thereby.) See new Note [Compiler phases] in GHC.Types.Basic; the main changes are in GHC.Core.Opt.Driver * Doing this made me trip over two places where the AnonArgFlag on a FunTy was being lost so we could end up with (Num a -> ty) rather than (Num a => ty) - In coercionLKind/coercionRKind - In contHoleType in the Simplifier I fixed the former by defining mkFunctionType and using it in coercionLKind/RKind. I could have done the same for the latter, but the information is almost to hand. So I fixed the latter by - adding sc_hole_ty to ApplyToVal (like ApplyToTy), - adding as_hole_ty to ValArg (like TyArg) - adding sc_fun_ty to StrictArg Turned out I could then remove ai_type from ArgInfo. This is just moving the deck chairs around, but it worked out nicely. See the new Note [AnonArgFlag] in GHC.Types.Var * When looking at the 'arity decrease' thing (#18093) I discovered that stable unfoldings had a much lower arity than the actual optimised function. That's what led to the arity-decrease message. Simple solution: eta-expand. It's described in Note [Eta-expand stable unfoldings] in GHC.Core.Opt.Simplify * I also discovered that unsafeCoerce wasn't being inlined if the context was boring. So (\x. f (unsafeCoerce x)) would create a thunk -- yikes! I fixed that by making inlineBoringOK a bit cleverer: see Note [Inline unsafeCoerce] in GHC.Core.Unfold. I also found that unsafeCoerceName was unused, so I removed it. I made a test case for #18078, and a very similar one for #17673. The net effect of all this on nofib is very modest, but positive: -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- anna -0.4% -0.1% -3.1% -3.1% 0.0% fannkuch-redux -0.4% -0.3% -0.1% -0.1% 0.0% maillist -0.4% -0.1% -7.8% -1.0% -14.3% primetest -0.4% -15.6% -7.1% -6.6% 0.0% -------------------------------------------------------------------------------- Min -0.9% -15.6% -13.3% -14.2% -14.3% Max -0.3% 0.0% +12.1% +12.4% 0.0% Geometric Mean -0.4% -0.2% -2.3% -2.2% -0.1% All following metric decreases are compile-time allocation decreases between -1% and -3%: Metric Decrease: T5631 T13701 T14697 T15164
* Optimisation in Unique.SupplySimon Peyton Jones2020-06-101-25/+120
| | | | | | | | | | | | | | | | | | | | | | | This patch switches on -fno-state-hack in GHC.Types.Unique.Supply. It turned out that my fixes for #18078 (coercion floating) changed the optimisation pathway for mkSplitUniqSupply in such a way that we had an extra allocation inside the inner loop. Adding -fno-state-hack fixed that -- and indeed the loop in mkSplitUniqSupply is a classic example of the way in which -fno-state-hack can be bad; see #18238. Moreover, the new code is better than the old. They allocate the same, but the old code ends up with a partial application. The net effect is that the test perf/should_run/UniqLoop runs 20% faster! From 2.5s down to 2.0s. The allocation numbers are the same -- but elapsed time falls. Good! The bad thing about this is that it's terribly delicate. But at least it's a good example of such delicacy in action. There is a long Note [Optimising the unique supply] which now explains all this.
* Give Language a Bounded instanceShayne Fletcher2020-06-101-2/+1
|