summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Eta expand un-saturated primopsBen Gamari2020-05-298-51/+108
| | | | | | | | | | | Now since we no longer try to predict CAFfyness we have no need for the solution to #16846. Eta expanding unsaturated primop applications is conceptually simpler, especially in the presence of levity polymorphism. This essentially reverts cac8dc9f51e31e4c0a6cd9bc302f7e1bc7c03beb, as suggested in #18079. Closes #18079.
* Allow simplification through runRW#Ben Gamari2020-05-296-40/+231
| | | | | | | | | | | | | | | | | | | | | | | | Because runRW# inlines so late, we were previously able to do very little simplification across it. For instance, given even a simple program like case runRW# (\s -> let n = I# 42# in n) of I# n# -> f n# we previously had no way to avoid the allocation of the I#. This patch allows the simplifier to push strict contexts into the continuation of a runRW# application, as explained in in Note [Simplification of runRW#] in GHC.CoreToStg.Prep. Fixes #15127. Metric Increase: T9961 Metric Decrease: ManyConstructors Co-Authored-By: Simon Peyton-Jone <simonpj@microsoft.com>
* Do not float join points in exprIsConApp_maybeSimon Peyton Jones2020-05-291-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We hvae been making exprIsConApp_maybe cleverer in recent times: commit b78cc64e923716ac0512c299f42d4d0012306c05 Date: Thu Nov 15 17:14:31 2018 +0100 Make constructor wrappers inline only during the final phase commit 7833cf407d1f608bebb1d38bb99d3035d8d735e6 Date: Thu Jan 24 17:58:50 2019 +0100 Look through newtype wrappers (Trac #16254) commit c25b135ff5b9c69a90df0ccf51b04952c2dc6ee1 Date: Thu Feb 21 12:03:22 2019 +0000 Fix exprIsConApp_maybe But alas there was still a bug, now immortalised in Note [Don't float join points] in SimpleOpt. It's quite hard to trigger because it requires a dead join point, but it came up when compiling Cabal Cabal.Distribution.Fields.Lexer.hs, when working on !3113. Happily, the fix is extremly easy. Finding the bug was not so easy.
* Make Lint check return type of a join pointSimon Peyton Jones2020-05-291-7/+31
| | | | | | | | | Consider join x = rhs in body It's important that the type of 'rhs' is the same as the type of 'body', but Lint wasn't checking that invariant. Now it does! This was exposed by investigation into !3113.
* CoreToStg: Add Outputable ArgInfo instanceBen Gamari2020-05-291-1/+7
|
* Fix "build/elem" RULE.Andreas Klebinger2020-05-2911-67/+319
| | | | | | | | | | | | | | | | | | | | | | | | An redundant constraint prevented the rule from matching. Fixing this allows a call to elem on a known list to be translated into a series of equality checks, and eventually a simple case expression. Surprisingly this seems to regress elem for strings. To avoid this we now also allow foldrCString to inline and add an UTF8 variant. This results in elem being compiled to a tight non-allocating loop over the primitive string literal which performs a linear search. In the process this commit adds UTF8 variants for some of the functions in GHC.CString. This is required to make this work for both ASCII and UTF8 strings. There are also small tweaks to the CString related rules. We now allow ourselfes the luxury to compare the folding function via eqExpr, which helps to ensure the rule fires before we inline foldrCString*. Together with a few changes to allow matching on both the UTF8 and ASCII variants of the CString functions.
* Rip out CmmStackInfo(updfr_space)Ben Gamari2020-05-285-14/+6
| | | | | As noted in #18232, this field is currently completely unused and moreover doesn't have a clear meaning.
* hadrian: Don't track GHC's verbosity argumentBen Gamari2020-05-281-2/+4
| | | | | Teach hadrian to ignore GHC's -v argument in its recompilation check, thus fixing #18131.
* Ticky-ticky: Record DataCon name in ticker nameBen Gamari2020-05-282-4/+7
| | | | | This makes it significantly easier to spot the nature of allocations regressions and comes at a reasonably low cost.
* DmdAnal: Recognise precise exceptions from case alternatives (#18086)Sebastian Graf2020-05-284-8/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider ```hs m :: IO () m = do putStrLn "foo" error "bar" ``` `m` (from #18086) always throws a (precise or imprecise) exception or diverges. Yet demand analysis infers `<L,A>` as demand signature instead of `<L,A>x` for it. That's because the demand analyser sees `putStrLn` occuring in a case scrutinee and decides that it has to `deferAfterPreciseException`, because `putStrLn` throws a precise exception on some control flow paths. This will mask the `botDiv` `Divergence`of the single case alt containing `error` to `topDiv`. Since `putStrLn` has `topDiv` itself, the final `Divergence` is `topDiv`. This is easily fixed: `deferAfterPreciseException` works by `lub`ing with the demand type of a virtual case branch denoting the precise exceptional control flow. We used `nopDmdType` before, but we can be more precise and use `exnDmdType`, which is `nopDmdType` with `exnDiv`. Now the `Divergence` from the case alt will degrade `botDiv` to `exnDiv` instead of `topDiv`, which combines with the result from the scrutinee to `exnDiv`, and all is well. Fixes #18086.
* FloatOut: Only eta-expand dead-end RHS if arity will increase (#18231)Sebastian Graf2020-05-285-3/+59
| | | | | | | | Otherwise we risk turning trivial RHS into non-trivial RHS, introducing unnecessary bindings in the next Simplifier run, resulting in more churn. Fixes #18231.
* Fix #18071Xavier Denis2020-05-285-26/+95
| | | | | | | | Run the core linter on candidate instances to ensure they are well-kinded. Better handle quantified constraints by using a CtWanted to avoid having unsolved constraints thrown away at the end by the solver.
* Add Semigroup/Monoid for Q (#18123)Vladislav Zavialov2020-05-284-0/+25
|
* Avoid unnecessary allocations due to tracing utilitiesBen Gamari2020-05-287-22/+80
| | | | | | | | | | | | | | | | | | | | While ticky-profiling the typechecker I noticed that hundreds of millions of SDocs are being allocated just in case -ddump-*-trace is enabled. This is awful. We avoid this by ensuring that the dump flag check is inlined into the call site, ensuring that the tracing document needn't be allocated unless it's actually needed. See Note [INLINE conditional tracing utilities] for details. Fixes #18168. Metric Decrease: T9961 haddock.Cabal haddock.base haddock.compiler
* GHC.Core.Unfold: Refactor traceInlineBen Gamari2020-05-281-9/+10
| | | | | This reduces duplication as well as fixes a bug wherein -dinlining-check would override -ddump-inlinings. Moreover, the new variant
* Make `identifier` parse unparenthesized `->` (#18060)Joshua Price2020-05-274-0/+17
|
* eventlog: Fix racy flushingBen Gamari2020-05-273-1/+30
| | | | | | | | | | | Previously no attempt was made to avoid multiple threads writing their capability-local eventlog buffers to the eventlog writer simultaneously. This could result in multiple eventlog streams being interleaved. Fix this by documenting that the EventLogWriter's write() and flush() functions may be called reentrantly and fix the default writer to protect its FILE* by a mutex. Fixes #18210.
* core-spec: Modify file paths according to new module hierarchyTakenobu Tani2020-05-275-68/+68
| | | | | | | | | | | | | | | | | | | | | | | This patch updates file paths according to new module hierarchy [1]: * GHC/Core.hs <= coreSyn/CoreSyn.hs * GHC/Core/Coercion.hs <= types/Coercion.hs * GHC/Core/Coercion/Axiom.hs <= types/CoAxiom.hs * GHC/Core/Coercion/Opt.hs <= types/OptCoercion.hs * GHC/Core/DataCon.hs <= basicTypes/DataCon.hs * GHC/Core/FamInstEnv.hs <= types/FamInstEnv.hs * GHC/Core/Lint.hs <= coreSyn/CoreLint.hs * GHC/Core/Subst.hs <= coreSyn/CoreSubst.hs * GHC/Core/TyCo/Rep.hs <= types/TyCoRep.hs * GHC/Core/TyCon.hs <= types/TyCon.hs * GHC/Core/Type.hs <= types/Type.hs * GHC/Core/Unify.hs <= types/Unify.hs * GHC/Types/Literal.hs <= basicTypes/Literal.hs * GHC/Types/Var.hs <= basicTypes/Var.hs [1]: https://gitlab.haskell.org/ghc/ghc/-/wikis/Make-GHC-codebase-more-modular [skip ci]
* Enhance Note [About units] for BackpackSylvain Henry2020-05-261-234/+331
|
* Make WorkWrap.Lib.isWorkerSmallEnough aware of the old aritySebastian Graf2020-05-267-11/+108
| | | | | | | | | | We should allow a wrapper with up to 82 parameters when the original function had 82 parameters to begin with. I verified that this made no difference on NoFib, but then again it doesn't use huge records... Fixes #18122.
* Add info about typeclass evidence to .hie filesZubin Duggal2020-05-2611-230/+872
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See `testsuite/tests/hiefile/should_run/HieQueries.hs` and `testsuite/tests/hiefile/should_run/HieQueries.stdout` for an example of this We add two new fields, `EvidenceVarBind` and `EvidenceVarUse` to the `ContextInfo` associated with an Identifier. These are associated with the appropriate identifiers for the evidence variables collected when we come across `HsWrappers`, `TcEvBinds` and `IPBinds` while traversing the AST. Instance dictionary and superclass selector dictionaries from `tcg_insts` and classes defined in `tcg_tcs` are also recorded in the AST as originating from their definition span This allows us to save a complete picture of the evidence constructed by the constraint solver, and will let us report this to the user, enabling features like going to the instance definition from the invocation of a class method(or any other method taking a constraint) and finding all usages of a particular instance. Additionally, - Mark NodeInfo with an origin so we can differentiate between bindings origininating in the source vs those in ghc - Along with typeclass evidence info, also include information on Implicit Parameters - Add a few utility functions to HieUtils in order to query the new info Updates haddock submodule
* Coverage: Factor out addMixEntryBen Gamari2020-05-251-26/+20
|
* Coverage: Don't produce ModBreaks if not HscInterpretedBen Gamari2020-05-251-6/+10
| | | | | emptyModBreaks contains a bottom and consequently it's important that we don't use it unless necessary.
* Coverage: Make ccIndices strictBen Gamari2020-05-251-1/+1
| | | | This just seems like a good idea.
* Coverage: Make tickBoxCount strictBen Gamari2020-05-251-1/+1
| | | | This could otherwise easily cause a leak of (+) thunks.
* Coverage: Drop redundant ad-hoc boot module checkBen Gamari2020-05-251-2/+1
| | | | | | | | To determine whether the module is a boot module Coverage.addTicksToBinds was checking for a `boot` suffix in the module source filename. This is quite ad-hoc and shouldn't be necessary; the callsite in `deSugar` already checks that the module isn't a boot module.
* Revert "Specify kind variables for inferred kinds in base."Ben Gamari2020-05-2521-240/+140
| | | | | | | | As noted in !3132, this has rather severe knock-on consequences in user-code. We'll need to revisit this before merging something along these lines. This reverts commit 9749fe1223d182b1f8e7e4f7378df661c509f396.
* Make Unicode brackets opening/closing tokens (#18225)Joshua Price2020-05-245-4/+35
| | | | | | | The tokens `[|`, `|]`, `(|`, and `|)` are opening/closing tokens as described in GHC Proposal #229. This commit makes the unicode variants (`⟦`, `⟧`, `⦇`, and `⦈`) act the same as their ASCII counterparts.
* Hadrian: fix hp2ps error during cross-compilationSylvain Henry2020-05-241-0/+1
| | | | Fixed by @alp (see https://gitlab.haskell.org/ghc/ghc/issues/16051#note_274265)
* Hadrian: fix distDir per stageSylvain Henry2020-05-241-2/+5
|
* Hadrian: fix cross-compiler build (#16051)Sylvain Henry2020-05-241-14/+33
|
* Remove unused hs-boot fileMatthew Pickering2020-05-242-8/+1
|
* Add orderingTyCon to wiredInTyCons (#18185)Ryan Scott2020-05-244-6/+38
| | | | | | | | | | `Ordering` needs to be wired in for use in the built-in `CmpNat` and `CmpSymbol` type families, but somehow it was never added to the list of `wiredInTyCons`, leading to the various oddities observed in #18185. Easily fixed by moving `orderingTyCon` from `basicKnownKeyNames` to `wiredInTyCons`. Fixes #18185.
* Bump haddock submoduleSylvain Henry2020-05-241-0/+0
|
* Rename GHC.Hs.Types into GHC.Hs.TypeSylvain Henry2020-05-2429-42/+42
| | | | See discussion in https://gitlab.haskell.org/ghc/ghc/issues/13009#note_268610
* Rename GHC.Core.Arity into GHC.Core.Opt.AritySylvain Henry2020-05-2422-33/+33
|
* Move Config module into GHC.SettingsSylvain Henry2020-05-2416-22/+21
|
* Remove not needed hie-bios outputjneira2020-05-241-2/+0
|
* Add specific configuration for windows in hie.yamljneira2020-05-241-0/+3
|
* Honour previous values for CABAL and CABFLAGSjneira2020-05-241-2/+8
| | | | | | The immediate goal is let the hie-bios.bat script set CABFLAGS with `-v0` and remove all cabal output except the compiler arguments
* Add hie-bios script for windows systemsjneira2020-05-241-0/+5
| | | | It is a direct translation of the sh script
* git: Add ignored commits fileBen Gamari2020-05-231-0/+23
| | | | | | | This can be used to tell git to ignore bulk renaming commits like the recently-finished module hierarchy refactoring. Configured with, git config blame.ignoreRevsFile .git-ignore-revs
* users-guide: Clarify meaning of -haddock flagBen Gamari2020-05-231-2/+3
| | | | Fixes #18206.
* Bump process submoduleBen Gamari2020-05-231-0/+0
| | | | Fixes #17926.
* Fix #18145 and also avoid needless work with implicit varsJohn Ericson2020-05-235-78/+117
| | | | | | | | | | | | - `forAllOrNothing` now is monadic, so we can trace whether we bind an explicit `forall` or not. - #18145 arose because the free vars calculation was needlessly complex. It is now greatly simplified. - Replaced some other implicit var code with `filterFreeVarsToBind`. Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
* simplCore: Ignore ticks in rule templatesBen Gamari2020-05-232-2/+30
| | | | | | | | | | | | This fixes #17619, where a tick snuck in to the template of a rule, resulting in a panic during rule matching. The tick in question was introduced via post-inlining, as discussed in `Note [Simplifying rules]`. The solution we decided upon was to simply ignore ticks in the rule template, as discussed in `Note [Tick annotations in RULE matching]`. Fixes #18162. Fixes #17619.
* Implement cstringLength# and FinalPtrAndrew Martin2020-05-2319-28/+328
| | | | | | | | | | | | | | | | | | | | This function and its accompanying rule resolve issue #5218. A future PR to the bytestring library will make the internal Data.ByteString.Internal.unsafePackAddress compute string length with cstringLength#. This will improve the status quo because it is eligible for constant folding. Additionally, introduce a new data constructor to ForeignPtrContents named FinalPtr. This additional data constructor, when used in the IsString instance for ByteString, leads to more Core-to-Core optimization opportunities, fewer runtime allocations, and smaller binaries. Also, this commit re-exports all the functions from GHC.CString (including cstringLength#) in GHC.Exts. It also adds a new test driver. This test driver is used to perform substring matches on Core that is dumped after all the simplifier passes. In this commit, it is used to check that constant folding of cstringLength# works.
* docs: fix formatting and add some linksAdam Sandberg Ericsson2020-05-232-45/+51
| | | | [skip ci]
* Move isDynLinkName into GHC.Types.NameSylvain Henry2020-05-214-38/+36
| | | | It doesn't belong into GHC.Unit.State
* Sort deterministically metric outputKrzysztof Gogolewski2020-05-211-1/+1
| | | | | | Previously, we sorted according to the test name and way, but the metrics (max_bytes_used/peak_megabytes_allocated etc.) were appearing in nondeterministic order.