summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix terrible occurrence-analysis bugwip/T19360Simon Peyton Jones2021-02-289-225/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ticket #19360 showed up a terrible bug in the occurrence analyser, in a situation like this Rec { f = g ; g = ..f... {-# RULE g .. = ...f... #-} } Then f was postInlineUnconditionally, but not in the RULE (which is simplified first), so we had a RULE mentioning a variable that was not in scope. This led me to review (again) the subtle loop-breaker stuff in the occurrence analyser. The actual changes are few, and are largely simplifications. I did a /lot/ of comment re-organising though. There was an unexpected amount of fallout. * Validation failed when compiling the stage2 compiler with profiling on. That turned to tickle a second latent bug in the same OccAnal code (at least I think it was always there), which led me to simplify still further; see Note [inl_fvs] in GHC.Core.Opt.OccurAnal. * But that in turn let me to some strange behaviour in CSE when ticks are in the picture, which I duly fixed. See Note [Dealing with ticks] in GHC.Core.Opt.CSE. * Then I got an ASSERT failure in CoreToStg, which again seems to be a latent bug. See Note [Ticks in applications] in GHC.CoreToStg * I also made one unforced change: I now simplify the RHS of a RULE in the same way as the RHS of a stable unfolding. This can allow a trivial binding to disappear sooner than otherwise, and I don't think it has any downsides. The change is in GHC.Core.Opt.Simplify.simplRules.
* Reduce code bloat in `Ord Literal` instance (#19443)Sebastian Graf2021-02-281-14/+5
| | | | | | | | | | | Reduce code bloat by replacing a call to `(==)` (which is defined in terms of `compare`) and to `compare` by a single call to `compare`, utilising the `Semigroup Ordering` instance. The compiler was eliminate the code bloat before, so this is a rather cosmetical improvement. Fixes #19443.
* Make `Ord Literal` deterministic (#19438)Sebastian Graf2021-02-281-1/+1
| | | | | | | | | | Previously, non-determinism arising from a use of `uniqCompareFS` in `cmpLit` potentially crept into `CoreMap`, which we expect to behave deterministically. So we simply use `lexicalCompareFS` now. Fixes #19438.
* Make known names simple ConApps (#19386)Sylvain Henry2021-02-282-13/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While fixing #17336 we noticed that code like this: = if | tc == intTyConName -> ... | tc == int8TyConName -> ... | tc == int16TyConName -> ... | tc == int32TyConName -> ... | tc == int64TyConName -> ... | tc == wordTyConName -> ... | tc == word8TyConName -> ... | tc == word16TyConName -> ... | tc == word32TyConName -> ... | tc == word64TyConName -> ... | tc == naturalTyConName -> ... was not transformed into a single case expression on the Name's unique as I would have expected but as a linear search. Bindings for known names are not simple constructor applications because of their strict `n_occ :: !OccName` field that needs to allocate a `FastString`: this field needs to be forced before using the `n_unique` field. This patch partially reverses ccaf7b66fc79e464b4e26f4ae62cb92ef7ba4b0f by making `n_occ` lazy and by ensuring that helper functions used to declare known names are fully inlined. The code above is then optimised as expected. Baseline Test Metric value New value Change --------------------------------------------------------------------------- ManyAlternatives(normal) ghc/alloc 822810880.0 822104032.0 -0.1% ManyConstructors(normal) ghc/alloc 4551734924.0 4480621808.0 -1.6% MultiLayerModules(normal) ghc/alloc 6029108292.0 6016024464.0 -0.2% Naperian(optasm) ghc/alloc 57396600.0 56826184.0 -1.0% PmSeriesG(normal) ghc/alloc 55666656.0 54521840.0 -2.1% PmSeriesS(normal) ghc/alloc 70204344.0 69047328.0 -1.6% PmSeriesT(normal) ghc/alloc 102273172.0 101070016.0 -1.2% PmSeriesV(normal) ghc/alloc 69157156.0 68002176.0 -1.7% T10421(normal) ghc/alloc 129875476.0 128881544.0 -0.8% T10421a(normal) ghc/alloc 92031552.0 90982800.0 -1.1% T10547(normal) ghc/alloc 34399800.0 33016760.0 -4.0% GOOD T10858(normal) ghc/alloc 208316964.0 207318616.0 -0.5% T11195(normal) ghc/alloc 304100548.0 302797040.0 -0.4% T11276(normal) ghc/alloc 140586764.0 139469832.0 -0.8% T11303b(normal) ghc/alloc 52118960.0 51120248.0 -1.9% T11374(normal) ghc/alloc 241325868.0 240692752.0 -0.3% T11822(normal) ghc/alloc 150612036.0 149582736.0 -0.7% T12150(optasm) ghc/alloc 92738452.0 91897224.0 -0.9% T12227(normal) ghc/alloc 494236296.0 493086728.0 -0.2% T12234(optasm) ghc/alloc 66786816.0 65966096.0 -1.2% T12425(optasm) ghc/alloc 112396704.0 111471016.0 -0.8% T12545(normal) ghc/alloc 1832733768.0 1828021072.0 -0.3% T12707(normal) ghc/alloc 1054991144.0 1053359696.0 -0.2% T13035(normal) ghc/alloc 116173180.0 115112072.0 -0.9% T13056(optasm) ghc/alloc 391749192.0 390687864.0 -0.3% T13253(normal) ghc/alloc 382785700.0 381550592.0 -0.3% T13253-spj(normal) ghc/alloc 168806064.0 167987192.0 -0.5% T13379(normal) ghc/alloc 403890296.0 402447920.0 -0.4% T13701(normal) ghc/alloc 2542828108.0 2534392736.0 -0.3% T13719(normal) ghc/alloc 4666717708.0 4659489416.0 -0.2% T14052(ghci) ghc/alloc 2181268580.0 2175320640.0 -0.3% T14683(normal) ghc/alloc 3094166824.0 3094524216.0 +0.0% T14697(normal) ghc/alloc 376323432.0 374024184.0 -0.6% T15164(normal) ghc/alloc 1896324828.0 1893236528.0 -0.2% T15630(normal) ghc/alloc 198932800.0 197783656.0 -0.6% T16190(normal) ghc/alloc 288186840.0 287250024.0 -0.3% T16577(normal) ghc/alloc 8324100940.0 8321580600.0 -0.0% T17096(normal) ghc/alloc 318264420.0 316961792.0 -0.4% T17516(normal) ghc/alloc 1332680768.0 1331635504.0 -0.1% T17836(normal) ghc/alloc 1296308168.0 1291098504.0 -0.4% T17836b(normal) ghc/alloc 62008340.0 60745256.0 -2.0% T17977(normal) ghc/alloc 52954564.0 51890248.0 -2.0% T17977b(normal) ghc/alloc 47824016.0 46683936.0 -2.4% T18140(normal) ghc/alloc 117408932.0 116353672.0 -0.9% T18223(normal) ghc/alloc 5603767896.0 5602037104.0 -0.0% T18282(normal) ghc/alloc 166456808.0 165396320.0 -0.6% T18304(normal) ghc/alloc 103694052.0 103513136.0 -0.2% T18478(normal) ghc/alloc 816819336.0 814459560.0 -0.3% T18698a(normal) ghc/alloc 438652404.0 437041784.0 -0.4% T18698b(normal) ghc/alloc 529448324.0 527666608.0 -0.3% T18923(normal) ghc/alloc 78360824.0 77315560.0 -1.3% T1969(normal) ghc/alloc 854223208.0 851303488.0 -0.3% T3064(normal) ghc/alloc 200655808.0 199368872.0 -0.6% T3294(normal) ghc/alloc 1791121792.0 1790033888.0 -0.1% T4801(normal) ghc/alloc 343749816.0 341760680.0 -0.6% T5030(normal) ghc/alloc 377520872.0 376492360.0 -0.3% T5321FD(normal) ghc/alloc 312680408.0 311618536.0 -0.3% T5321Fun(normal) ghc/alloc 355635656.0 354536264.0 -0.3% T5631(normal) ghc/alloc 629667068.0 629562192.0 -0.0% T5642(normal) ghc/alloc 540913864.0 539569952.0 -0.2% T5837(normal) ghc/alloc 43183652.0 42177928.0 -2.3% T6048(optasm) ghc/alloc 96395616.0 95397032.0 -1.0% T783(normal) ghc/alloc 427778908.0 426307760.0 -0.3% T9020(optasm) ghc/alloc 279523960.0 277010040.0 -0.9% T9233(normal) ghc/alloc 966717488.0 964594096.0 -0.2% T9630(normal) ghc/alloc 1585228636.0 1581428672.0 -0.2% T9675(optasm) ghc/alloc 594817892.0 591703040.0 -0.5% T9872a(normal) ghc/alloc 2216955420.0 2215648024.0 -0.1% T9872b(normal) ghc/alloc 2747814924.0 2746515472.0 -0.0% T9872c(normal) ghc/alloc 2271878772.0 2270554344.0 -0.1% T9872d(normal) ghc/alloc 623661168.0 621434064.0 -0.4% T9961(normal) ghc/alloc 409059124.0 406811120.0 -0.5% WWRec(normal) ghc/alloc 940563924.0 938008112.0 -0.3% hie002(normal) ghc/alloc 9801941116.0 9787675736.0 -0.1% parsing001(normal) ghc/alloc 494756632.0 493828512.0 -0.2% Metric Decrease: T10547 T13035 T12425
* CODEOWNERS: Add @DanielG as maintainer for RTS heap profiling codeDaniel Gröber2021-02-281-0/+13
|
* CODEOWNERS: Use sections to allow multiple matching entriesDaniel Gröber2021-02-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CODEOWNERS documentation has this to say on the current matching behaviour: > The path definition order is significant: the last pattern matching a > given path is used to find the code owners. Take this as an example: /rts/ bgamari [...] /rts/win32/ Phyx (I'm omitting the '@' so as to not notification spam everyone) This means a change in a file under win23 would only have Phyx but not bgamari as approver. I don't think that's the behaviour we want. Using "sections" we can get additive behaviour instead, from the docs: > Additionally, the usual guidance that only the last pattern matching the > file is applied is expanded such that the last pattern matching for each > section is applied. [RTS] /rts/ bgamari [...] [WinIO] /rts/win32/ Phyx So now since those entries are in different sections both would be added to the approvers list. The sections feature was introduced in Gitlab 13.2, see "Version history" on [1] we're currently running 18.8 on gitlab.haskell.org, see [2]. [1]: https://docs.gitlab.com/13.8/ee/user/project/code_owners.html#code-owners-sections [2]: https://gitlab.haskell.org/help
* CPR analysis: Use CPR of scrutinee for Case Binder CPR (#19232)Sebastian Graf2021-02-289-126/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For years we have lived in a supposedly sweet spot that gave case binders the CPR property, unconditionally. Which is an optimistic hack that is now described in `Historical Note [Optimistic case binder CPR]`. In #19232 the concern was raised that this might do more harm than good and that might be better off simply by taking the CPR property of the scrutinee for the CPR type of the case binder. And indeed that's what we do now. Since `Note [CPR in a DataAlt case alternative]` is now only about field binders, I renamed and garbage collected it into `Note [Optimistic field binder CPR]`. NoFib approves: ``` NoFib Results -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- anna +0.1% +0.1% nucleic2 -1.2% -0.6% sched 0.0% +0.9% transform -0.0% -0.1% -------------------------------------------------------------------------------- Min -1.2% -0.6% Max +0.1% +0.9% Geometric Mean -0.0% +0.0% ``` Fixes #19232.
* Mark divModInt and friends as INLINE (#19267)Sebastian Graf2021-02-281-0/+16
| | | | | | | | | | | | | | | | | | So that we don't get a silly worker `$wdivModInt` and risk inlining `divModInt#` into `divModInt` or `$wdivModInt`, making both unlikely to inline at call sites. Fixes #19267. There's a spurious metric decrease (was an *increase*) in T12545. That seems entirely due to shifts in Unique distribution (+5% more `IntMap.$winsert` calls). The inappropriateness of the acceptance window is tracked in #19414. Metric Decrease: T12545 Metric Increase: T12545
* Fix two places where TcGblEnv was retainedMatthew Pickering2021-02-282-4/+7
| | | | Found with ghc-debug on the ManyConstructors test
* Widen acceptance window of T12545 (#19414)Sebastian Graf2021-02-281-1/+4
| | | | | | | | | This test flip-flops by +-1% in arbitrary changes in CI. While playing around with `-dunique-increment`, I could reproduce variations of 3% in compiler allocations, so I set the acceptance window accordingly. Fixes #19414.
* Add some utility functions to GHC.Types.SrcLocAlan Zimmerman2021-02-281-5/+26
| | | | pprUserSpan, isZeroWidthSpan, pprLocated, combineRealSrcSpans
* configure: avoid empty lines in AC_CONFIG_FILESSylvain Henry2021-02-281-4/+2
| | | | | | | Should fix failures on Windows: configure.ac:1511: error: ` ' is already registered with AC_CONFIG_FILES.
* users guide: Update mathjax CDN URLBen Gamari2021-02-281-2/+2
| | | | | | Fixes #19423. [skip ci]
* Fix assertion error with linear types, #19400Krzysztof Gogolewski2021-02-273-13/+23
| | | | | The previous code using TyCoMapper could promote the same metavar twice. Use a set instead.
* Rewrite.split: Fix reboxingBen Gamari2021-02-271-2/+5
| | | | | | | | As noted in #19102, we would previously ended up reboxing the tuple result of `split`'s worker and then immediately take apart the boxed tuple to again unpack it into an unboxed result. Fixes #19102.
* GHC.Tc.Solver.Rewrite: oneShot-ifyBen Gamari2021-02-271-7/+14
| | | | | Following the example of Note [The one-shot state monad trick]. c.f. #18202.
* TcS: oneShot-ifyBen Gamari2021-02-271-8/+16
| | | | | | | | | | | | | | Following the example of Note [The one-shot state monad trick]. c.f. #18202. Metric Decrease: T17836 T3064 T5321FD T9872a T9872b T9872c T9872d
* gitlab-ci: Fix TEST_ARGS/RUNTEST_ARGS inconsistencyBen Gamari2021-02-272-3/+3
| | | | Finally fixes #19025.
* Include time.h in conc059_c (#19431)Sebastian Graf2021-02-271-0/+2
| | | | | | | The test probably could have used `usleep` from `unistd.h` instead, but this seemed like the simplest solution. Fixes #19431.
* CI: reduce xz compression for non release/nightly jobsSylvain Henry2021-02-271-0/+21
| | | | | | | | | | | | | | | | | | Reduce XZ compression level for regular jobs (it is bumped to 9 for releases and nightly jobs). In my experiments I've got the following bindist size in the given time for each compression level (with the quick flavour): XZ_OPT Time Size -9 4m06s 112 MB -8 4m00s 114 MB -7 3m50s 116 MB -6 (default) 3m40s 118 MB -5 2m47s 123 MB -4 1m57s 134 MB -3 1m03s 129 MB -2 49.73s 136 MB -1 37.72s 142 MB -0 34.40s 156 MB
* Fix Windows build with autoconf >=2.70 (#19189)Sylvain Henry2021-02-278-6898/+2
|
* touchy: use a valid cabal-versionSylvain Henry2021-02-271-1/+1
|
* Explain uninterruptibleMaskZubin Duggal2021-02-271-0/+1
|
* Remove unnecessary killThreadZubin Duggal2021-02-271-9/+6
|
* switch to using forkIO to detect async exceptionsZubin Duggal2021-02-271-16/+17
|
* Don't catch async exceptions when evaluating Template HaskellZubin Duggal2021-02-271-3/+20
|
* Fix typechecking time bug for large rationals (#15646)Andreas Klebinger2021-02-2719-101/+573
| | | | | | | | | When desugaring large overloaded literals we now avoid computing the `Rational` value. Instead prefering to store the significant and exponent as given where reasonable and possible. See Note [FractionalLit representation] for details.
* Remove the -xt heap profiling optionMatthew Pickering2021-02-279-60/+7
| | | | | | | It should be left to tooling to perform the filtering to remove these specific closure types from the profile if desired. Fixes #16795
* rts: Introduce --eventlog-flush-interval flagBen Gamari2021-02-274-0/+43
| | | | | | | This introduces a flag, --eventlog-flush-interval, which can be used to set an upper bound on the amount of time for which an eventlog event will remain enqueued. This can be useful in real-time monitoring settings.
* Move absentError into ghc-prim.Andreas Klebinger2021-02-268-6/+78
| | | | | | | | | | | | When using -fdicts-strict we generate references to absentError while compiling ghc-prim. However we always load ghc-prim before base so this caused linker errors. We simply solve this by moving absentError into ghc-prim. This does mean it's now a panic instead of an exception which can no longer be caught. But given that it should only be thrown if there is a compiler error that seems acceptable, and in fact we already do this for absentSumFieldError which has similar constraints.
* Reimplement Stream in "yoneda" style for efficiencyMatthew Pickering2021-02-266-111/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'Stream' is implemented in the "yoneda" style for efficiency. By representing a stream in this manner 'fmap' and '>>=' operations are accumulated in the function parameters before being applied once when the stream is destroyed. In the old implementation each usage of 'mapM' and '>>=' would traverse the entire stream in order to apply the substitution at the leaves. It is well-known for free monads that this representation can improve performance, and the test results demonstrate this for GHC as well. The operation mapAccumL is not used in the compiler and can't be implemented efficiently because it requires destroying and rebuilding the stream. I removed one use of mapAccumL_ which has similar problems but the other use was difficult to remove. In the future it may be worth exploring whether the 'Stream' encoding could be modified further to capture the mapAccumL pattern, and likewise defer the passing of accumulation parameter until the stream is finally consumed. The >>= operation for 'Stream' was a hot-spot in the ticky profile for the "ManyConstructors" test which called the 'cg' function many times in "StgToCmm.hs" Metric Decrease: ManyConstructors
* Fix #19363 by using pprName' {Applied,Infix} in the right placesRyan Scott2021-02-265-27/+83
| | | | | | | | | | | | It was revealed in #19363 that the Template Haskell pretty-printer implemented in `Language.Haskell.TH.Ppr` did not pretty-print infix names or symbolic names correctly in certain situations, such as in data constructor declarations or fixity declarations. Easily fixed by using `pprName' Applied` (which always parenthesizes symbolic names in prefix position) or `pprName' Infix` (which always surrounds alphanumeric names with backticks in infix position) in the right spots. Fixes #19363.
* Implement -Wambiguous-fieldsAdam Gundry2021-02-2613-9/+140
| | | | | | Fixes #18966. Adds a new warning -Wambiguous-fields for uses of field selectors or record updates that will be rejected in the future, when the DuplicateRecordFields extension is simplified per https://github.com/ghc-proposals/ghc-proposals/pull/366.
* Update MonoLocalBinds documentationSimon Peyton Jones2021-02-262-11/+28
| | | | | | | | | Update the documentation to specify that MonoLocalBinds is lifted by a partial type signature. This came up in #19396. [skip ci]
* hadrian: ticky_ghc should build all things with -ticky (#19405) [skip ci]Sebastian Graf2021-02-261-3/+2
| | | | | | | With this patch, everything built by the stage1 compiler (in a `ticky_ghc`-transformed flavour) will be built with `-ticky`. Fixes #19405.
* Minor fix to QualifiedDo docs about the ApplicativeDo desugaringUtku Demir2021-02-251-3/+3
| | | | | | | | | When desugaring ApplicativeDo, GHC looks up the name `fmap`, not `<$>` (see 'GHC.Builtin.Names.fmapName'). This commit fixes the misleading documentation; since exporting the name `<$>` instead of `fmap` causes a "not in scope" error when `QualifiedDo` and `ApplicativeDo` is combined. [skip ci]
* gitlab-ci: Ignore performance test failures on DarwinBen Gamari2021-02-242-2/+9
| | | | Due to #19025.
* hadrian: Throw error on unknown key-value setting nameBen Gamari2021-02-241-2/+5
|
* hadrian: Introduce runtest.opts key-value settingBen Gamari2021-02-242-13/+26
|
* testsuite: Introduce flag to ignore performance failuresBen Gamari2021-02-243-1/+6
| | | | Needed by #19025.
* Revert "testsuite: Mark tests affected by #19025"Ben Gamari2021-02-241-14/+2
| | | | This reverts commit 4a9d856d21c67b3328e26aa68a071ec9a824a7bb.
* testsuite: Mark tests affected byBen Gamari2021-02-231-2/+14
|
* linker: Fix atexit handlers on PETamar Christina2021-02-222-3/+5
|
* Don't pass homeUnitId at ExternalPackageState creation time (#10827)Sylvain Henry2021-02-225-25/+23
| | | | | It makes the external package state independent of the home unit which is needed to make several home units share the EPS.
* Fix Storeable instances for the windows timeout executable.Andreas Klebinger2021-02-221-2/+2
| | | | | | alignment clearly should be a power of two. This patch makes it so. We do so by using the #alignment directive instead of using the size of the type.
* testsuite: Add broken tests for #19244Ben Gamari2021-02-223-0/+58
|
* testsuite: Mark foreignInterruptible as fragile in GHCiBen Gamari2021-02-221-0/+1
| | | | | As noted in #18391, foreignInterruptible fails pretty regularly under GHCi.
* ModuleOrigin: print details of module conflictSergei Trofimovich2021-02-221-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Before the change the error did not show details of involved module: ``` haddock: panic! (the 'impossible' happened) (GHC version 8.10.3: ModOrigin: hidden module redefined ``` After the change modile details are shown: ``` ghc-stage1: panic! (the 'impossible' happened) (GHC version 9.1.20210206: ModOrigin: package both exposed/hidden x: exposed package y: reexport by ghc-boot-9.1 ``` Fixes #19330 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Add test case for CompleteP pretty-printer (#19270)Ole Krüger2021-02-223-0/+9
|
* Fix TemplateHaskell pretty printer for CompleteP (#19270)Ole Krüger2021-02-221-1/+1
| | | | The COMPLETE pragma was not properly terminated with a '#-}'.