summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fixes to rubbish literalswip/minor-rubbish-litKrzysztof Gogolewski2022-04-214-4/+10
| | | | | | | | | | | | | | | | | * In CoreToStg, the application 'RUBBISH[rep] x' was simplified to 'RUBBISH[rep]'. But it is possible that the result of the function is represented differently than the function. * In Unarise, 'LitRubbish (primRepToType prep)' is incorrect: LitRubbish takes a RuntimeRep such as IntRep, while primRepToType returns a type such as Any @(TYPE IntRep). Use primRepToRuntimeRep instead. This code is never run in the testsuite. * In StgToByteCode, all rubbish literals were assumed to be boxed. This code predates representation-polymorphic RubbishLit and I think it was not updated. I don't have a testcase for any of those issues, but the code looks wrong.
* Fix substitution in bindAuxiliaryDictSimon Peyton Jones2022-04-209-44/+74
| | | | | | | | | | | | | | | | | | | | | In GHC.Core.Opt.Specialise.bindAuxiliaryDict we were unnecessarily calling `extendInScope` to bring into scope variables that were /already/ in scope. Worse, GHC.Core.Subst.extendInScope strangely deleted the newly-in-scope variables from the substitution -- and that was fatal in #21391. I removed the redundant calls to extendInScope. More ambitiously, I changed GHC.Core.Subst.extendInScope (and cousins) to stop deleting variables from the substitution. I even changed the names of the function to extendSubstInScope (and cousins) and audited all the calls to check that deleting from the substitution was wrong. In fact there are very few such calls, and they are all about introducing a fresh non-in-scope variable. These are "OutIds"; it is utterly wrong to mess with the "InId" substitution. I have not added a Note, because I'm deleting wrong code, and it'd be distracting to document a bug.
* Fix a shadowing issue in StgUnarise.Andreas Klebinger2022-04-201-1/+23
| | | | | | | | | | | | | | | | | For I assume performance reasons we don't record no-op replacements during unarise. This lead to problems with code like this: f = \(Eta_B0 :: VoidType) x1 x2 -> ... let foo = \(Eta_B0 :: LiftedType) -> g x y Eta_B0 in ... Here we would record the outer Eta_B0 as void rep, but would not shadow Eta_B0 inside `foo` because this arg is single-rep and so doesn't need to replaced. But this means when looking at occurence sites we would check the env and assume it's void rep based on the entry we made for the (no longer in scope) outer `Eta_B0`. Fixes #21396 and the ticket has a few more details.
* Remove LevityInfoKrzysztof Gogolewski2022-04-2011-129/+14
| | | | | | Every Id was storing a boolean whether it could be levity-polymorphic. This information is no longer needed since representation-checking has been moved to the typechecker.
* Add -dkeep-comments flag to keep comments in the parserAlan Zimmerman2022-04-205-0/+306
| | | | | | | | | This provides a way to set the Opt_KeepRawTokenStream from the command line, allowing exact print annotation users to see exactly what is produced for a given parsed file, when used in conjunction with -ddump-parsed-ast Discussed in #19706, but this commit does not close the issue.
* rts: Ensure that the interpreter doesn't disregard tagsBen Gamari2022-04-151-4/+4
| | | | | Previously the interpreter's handling of `RET_BCO` stack frames would throw away the tag of the returned closure. This resulted in #21390.
* testsuite: Add test for #21390Ben Gamari2022-04-156-0/+44
|
* Only enable PROF_SPIN in DEBUGDylan Yudaken2022-04-152-1/+3
|
* Hadrian: use a set to keep track of wayssheaf2022-04-1418-33/+68
| | | | | | | | The order in which ways are provided doesn't matter, so we use a data structure with the appropriate semantics to represent ways. Fixes #21378
* StgLint: Lint constructor applications and strict workers for arity.Andreas Klebinger2022-04-143-8/+35
| | | | | | | This will mean T9208 when run with lint will return a lint error instead of resulting in a panic. Fixes #21117
* Refine warning about defining rules in SAFE modulesMatthew Pickering2022-04-136-6/+7
| | | | | | | | This change makes it clear that it's the definition rather than any usage which is a problem, and that rules defined in other modules will still be used to do rewrites. Fixes #20923
* Specialise: Check `typeDeterminesValue` before specialising on an ↵wip/T19644Sebastian Graf2022-04-121-4/+10
| | | | | | | | interesting dictionary I extracted the checks from `Note [Type determines value]` into its own function, so that we share the logic properly. Then I made sure that we actually call `typeDeterminesValue` everywhere we check for `interestingDict`.
* Specialising through specialised method calls (#19644)Sebastian Graf2022-04-1215-90/+1184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #19644, we discovered that the ClassOp/DFun rules from Note [ClassOp/DFun selection] inhibit transitive specialisation in a scenario like ``` class C a where m :: Show b => a -> b -> ...; n :: ... instance C Int where m = ... -- $cm :: Show b => Int -> b -> ... f :: forall a b. (C a, Show b) => ... f $dC $dShow = ... m @a $dC @b $dShow ... main = ... f @Int @Bool ... ``` After we specialise `f` for `Int`, we'll see `m @a $dC @b $dShow` in the body of `$sf`. But before this patch, Specialise doesn't apply the ClassOp/DFun rule to rewrite to a call of the instance method for `C Int`, e.g., `$cm @Bool $dShow`. As a result, Specialise couldn't further specialise `$cm` for `Bool`. There's a better example in `Note [Specialisation modulo dictionary selectors]`. This patch enables proper Specialisation, as follows: 1. In the App case of `specExpr`, try to apply the CalssOp/DictSel rule on the head of the application 2. Attach an unfolding to freshly-bound dictionary ids such as `$dC` and `$dShow` in `bindAuxiliaryDict` NB: Without (2), (1) would be pointless, because `lookupRule` wouldn't be able to look into the RHS of `$dC` to see the DFun. (2) triggered #21332, because the Specialiser floats around dictionaries without accounting for them in the `SpecEnv`'s `InScopeSet`, triggering a panic when rewriting dictionary unfoldings. Fixes #19644 and #21332.
* Eta reduction based on evaluation context (#21261)Sebastian Graf2022-04-1211-135/+478
| | | | | | | | | | | | | | | | | | | I completely rewrote our Notes surrounding eta-reduction. The new entry point is `Note [Eta reduction makes sense]`. Then I went on to extend the Simplifier to maintain an evaluation context in the form of a `SubDemand` inside a `SimplCont`. That `SubDemand` is useful for doing eta reduction according to `Note [Eta reduction based on evaluation context]`, which describes how Demand analysis, Simplifier and `tryEtaReduce` interact to facilitate eta reduction in more scenarios. Thus we fix #21261. ghc/alloc perf marginally improves (-0.0%). A medium-sized win is when compiling T3064 (-3%). It seems that haddock improves by 0.6% to 1.0%, too. Metric Decrease: T3064
* Document that DuplicateRecordFields doesn't tolerates ambiguous fieldsHécate Moonlight2022-04-123-106/+70
| | | | Fix #19891
* Refactor: simplify lexing of the dotVladislav Zavialov2022-04-092-17/+9
| | | | | | | | | | | | Before this patch, the lexer did a truly roundabout thing with the dot: 1. look up the varsym in reservedSymsFM and turn it into ITdot 2. under OverloadedRecordDot, turn it into ITvarsym 3. in varsym_(prefix|suffix|...) turn it into ITvarsym, ITdot, or ITproj, depending on extensions and whitespace Turns out, the last step is sufficient to handle the dot correctly. This patch removes the first two steps.
* Fix missing SymCo in pushCoercionIntoLambdasheaf2022-04-091-1/+5
| | | | | | | There was a missing SymCo in pushCoercionIntoLambda. Currently this codepath is only used with rewrite rules, so this bug managed to slip by, but trying to use pushCoercionIntoLambda in other contexts revealed the bug.
* Add regression test for #19569Andreas Klebinger2022-04-093-0/+53
|
* Update changelog.Philip Hazelden2022-04-091-0/+3
|
* Add tests for several trace functions.Philip Hazelden2022-04-096-0/+31
|
* Add functions traceWith, traceShowWith, traceEventWith.Philip Hazelden2022-04-091-0/+35
| | | | | As discussed at https://github.com/haskell/core-libraries-committee/issues/36
* Drop the app invariantghc-9.5-startJoachim Breitner2022-04-0923-271/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | previously, GHC had the "let/app-invariant" which said that the RHS of a let or the argument of an application must be of lifted type or ok for speculation. We want this on let to freely float them around, and we wanted that on app to freely convert between the two (e.g. in beta-reduction or inlining). However, the app invariant meant that simple code didn't stay simple and this got in the way of rules matching. By removing the app invariant, this thus fixes #20554. The new invariant is now called "let-can-float invariant", which is hopefully easier to guess its meaning correctly. Dropping the app invariant means that everywhere where we effectively do beta-reduction (in the two simplifiers, but also in `exprIsConApp_maybe` and other innocent looking places) we now have to check if the argument must be evaluated (unlifted and side-effecting), and analyses have to be adjusted to the new semantics of `App`. Also, `LetFloats` in the simplifier can now also carry such non-floating bindings. The fix for DmdAnal, refine by Sebastian, makes functions with unlifted arguments strict in these arguments, which changes some signatures. This causes some extra calls to `exprType` and `exprOkForSpeculation`, so some perf benchmarks regress a bit (while others improve). Metric Decrease: T9020 Metric Increase: LargeRecord T12545 T15164 T16577 T18223 T5642 T9961 Co-authored-by: Sebastian Graf <sebastian.graf@kit.edu>
* Bump deepseq to 1.4.7.0Matthew Pickering2022-04-091-0/+0
| | | | | | Updates deepseq submodule Fixes #20653
* ci: Remove doc-tarball dependency from perf and perf-nofib jobsMatthew Pickering2022-04-091-5/+0
| | | | | These don't depend on the contents of the tarball so we can run them straight after the fedora33 job finishes.
* ci: Fix nightly head.hackage pipelinesMatthew Pickering2022-04-091-1/+15
| | | | | | This also needs a corresponding commit to head.hackage, I also made the job explicitly depend on the fedora33 job so that it isn't blocked by a failing windows job, which causes docs-tarball to fail.
* Tiny documentation wibbleSimon Peyton Jones2022-04-081-2/+2
| | | | | | | | | | | | This commit commit 83363c8b04837ee871a304cf85207cf79b299fb0 Author: Simon Peyton Jones <simon.peytonjones@gmail.com> Date: Fri Mar 11 16:55:38 2022 +0000 Use prepareBinding in tryCastWorkerWrapper refactored completeNonRecX away, but left a Note referring to it. This MR fixes that Note.
* Disallow (->) as a data constructor name (#16999)Vladislav Zavialov2022-04-084-3/+11
| | | | | | | | | | | | | | The code was misusing isLexCon, which was never meant for validation. In fact, its documentation states the following: Use these functions to figure what kind of name a 'FastString' represents; these functions do /not/ check that the identifier is valid. Ha! This sign can't stop me because I can't read. The fix is to use okConOcc instead. The other checks (isTcOcc or isDataOcc) seem superfluous, so I also removed those.
* ci: Replace "always" with "on_success" to stop build jobs running before ↵Matthew Pickering2022-04-082-64/+64
| | | | | | | | | hadrian-ghci has finished See https://docs.gitlab.com/ee/ci/yaml/#when * always means, always run not matter what * on_success means, run if the dependencies have built successfully
* Docs: datacon eta-expansion, rep-poly checkssheaf2022-04-088-37/+111
| | | | | | | | | | | | | | | | | | | The existing notes weren't very clear on how the eta-expansion of data constructors that occurs in tcInferDataCon/dsConLike interacts with the representation polymorphism invariants. So we explain with a few more details how we ensure that the representation-polymorphic lambdas introduced by tcInferDataCon/dsConLike don't end up causing problems, by checking they are properly instantiated and then relying on the simple optimiser to perform beta reduction. A few additional changes: - ConLikeTc just take type variables instead of binders, as we never actually used the binders. - Removed the FRRApp constructor of FRROrigin; it was no longer used now that we use ExpectedFunTyOrigin. - Adds a bit of documentation to the constructors of ExpectedFunTyOrigin.
* HsUniToken for :: in GADT constructors (#19623)Vladislav Zavialov2022-04-0814-18/+74
| | | | | | One more step towards the new design of EPA. Updates the haddock submodule.
* Add flag -fprof-manual which controls if GHC should honour manual cost centres.Andreas Klebinger2022-04-088-1/+61
| | | | | | | This allows disabling of manual control centres in code a user doesn't control like libraries. Fixes #18867
* driver: Introduce HomeModInfoCache abstractionMatthew Pickering2022-04-084-35/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HomeModInfoCache is a mutable cache which is updated incrementally as the driver completes, this makes it robust to exceptions including (SIGINT) The interface for the cache is described by the `HomeMOdInfoCache` data type: ``` data HomeModInfoCache = HomeModInfoCache { hmi_clearCache :: IO [HomeModInfo] , hmi_addToCache :: HomeModInfo -> IO () } ``` The first operation clears the cache and returns its contents. This is designed so it's harder to end up in situations where the cache is retained throughout the execution of upsweep. The second operation allows a module to be added to the cache. The one slightly nasty part is in `interpretBuildPlan` where we have to be careful to ensure that the cache writes happen: 1. In parralel 2. Before the executation continues after upsweep. This requires some simple, localised MVar wrangling. Fixes #20780
* Merge remote-tracking branch 'origin/master'Ben Gamari2022-04-0857-323/+1174
|\
| * Reject illegal quote mark in data con declarations (#17865)Vladislav Zavialov2022-04-085-4/+42
| | | | | | | | | | | | * Non-fatal (i.e. recoverable) parse error * Checking infix constructors * Extended the regression test
| * Correctly report SrcLoc of redundant constraintssheaf2022-04-086-9/+32
| | | | | | | | | | | | | | | | | | We were accidentally dropping the source location information in certain circumstances when reporting redundant constraints. This patch makes sure that we set the TcLclEnv correctly before reporting the warning. Fixes #21315
| * Fixes to 9.4 release notesKrzysztof Gogolewski2022-04-084-11/+23
| | | | | | | | | | | | - Mention -Wforall-identifier - Improve description of withDict - Fix formatting
| * testsuite: Lint RTS #includesBen Gamari2022-04-083-1/+99
| | | | | | | | | | | | | | | | | | | | | | Verifies two important properties of #includes in the RTS: * That system headers don't appear inside of a `<BeginPrivate.h>` block as this can hide system library symbols, resulting in very hard-to-diagnose linker errors * That no headers precede `Rts.h`, ensuring that __USE_MINGW_ANSI_STDIO is set correctly before system headers are included.
| * rts: Fix various #include issuesBen Gamari2022-04-0816-30/+28
| | | | | | | | This fixes various violations of the newly-added RTS includes linter.
| * rts: Move __USE_MINGW_ANSI_STDIO definition to PosixSource.hBen Gamari2022-04-082-12/+12
| | | | | | | | It's easier to ensure that this is included first than Rts.h
| * Add test for #21338sheaf2022-04-083-0/+74
| | | | | | | | | | | | | | | | This no-skolem-info bug was fixed by the no-skolem-info patch that will be part of GHC 9.4. This patch adds a regression test for the issue reported in issue #21338. Fixes #21338.
| * Improve seq[D]VarSetSimon Jakobi2022-04-081-2/+2
| | | | | | | | | | | | Previously, the use of size[D]VarSet would involve a traversal of the entire underlying IntMap. Since IntMaps are already spine-strict, this is unnecessary.
| * Properly explain where INLINE pragmas can appear.Andreas Klebinger2022-04-071-6/+41
| | | | | | | | Fixes #20676
| * Fix the free-var test in validDerivPredSimon Peyton Jones2022-04-074-57/+74
| | | | | | | | | | | | | | | | | | | | The free-var test (now documented as (VD3)) was too narrow, affecting only class predicates. #21302 demonstrated that this wasn't enough! Fixes #21302. Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
| * Rename [] to List (#21294)Vladislav Zavialov2022-04-0722-46/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a small part of GHC Proposal #475. The key change is in GHC.Types: - data [] a = [] | a : [a] + data List a = [] | a : List a And the rest of the patch makes sure that List is pretty-printed as [] in various contexts. Updates the haddock submodule.
| * Use prepareBinding in tryCastWorkerWrapperSimon Peyton Jones2022-04-076-164/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As #21144 showed, tryCastWorkerWrapper was calling prepareRhs, and then unconditionally floating the bindings, without the checks of doFloatFromRhs. That led to floating an unlifted binding into a Rec group. This patch refactors prepareBinding to make these checks, and do them uniformly across all calls. A nice improvement. Other changes * Instead of passing around a RecFlag and a TopLevelFlag; and sometimes a (Maybe SimplCont) for join points, define a new Simplifier-specific data type BindContext: data BindContext = BC_Let TopLevelFlag RecFlag | BC_Join SimplCont and use it consistently. * Kill off completeNonRecX by inlining it. It was only called in one place. * Add a wrapper simplImpRules for simplRules. Compile time on T9630 drops by 4.7%; little else changes. Metric Decrease: T9630
| * EPA: handling of con_bndrs in mkGadtDeclAlan Zimmerman2022-04-073-21/+571
| | | | | | | | | | | | Get rid of unnnecessary case clause that always matched. Closes #20558
| * Remove Fun pattern from Typeable COMPLETE setsheaf2022-04-073-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GHC merge request !963 improved warnings in the presence of COMPLETE annotations. This allows the removal of the Fun pattern from the complete set. Doing so expectedly causes some redundant pattern match warnings, in particular in GHC.Utils.Binary.Typeable and Data.Binary.Class from the binary library; this commit addresses that. Updates binary submodule Fixes #20230
* | rts: Fix off-by-one in snwprintf usagewip/windows-finalwip/windows-clang-joinBen Gamari2022-04-071-2/+5
| |
* | Accept spurious perf test shifts on WindowsBen Gamari2022-04-070-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Metric Decrease: T16875 Metric Increase: T12707 T13379 T3294 T4801 T5321FD T5321Fun T783
* | rts: Fallback to ucrtbase not msvcrtBen Gamari2022-04-071-3/+4
| | | | | | | | | | Since we have switched to Clang the toolchain now links against ucrt rather than msvcrt.