summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Make ms_ghc_prim_import field strictwip/other-space-fixesMatthew Pickering2021-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | If you don't promptly force this field then it ends up retaining a lot of data structures related to parsing. For example, the following retaining chain can be observed when using GHCi. ``` PState 0x4289365ca0 0x4289385d68 0x4289385db0 0x7f81b37a7838 0x7f81b3832fd8 0x4289365cc8 0x4289365cd8 0x4289365cf0 0x4289365cd8 0x4289365d08 0x4289385e48 0x7f81b4e4c290 0x7f818f63f440 0x7f818f63f440 0x7f81925ccd18 0x7f81b4e41230 0x7f818f63f440 0x7f81925ccd18 0x7f818f63f4a8 0x7f81b3832fd8 0x7f81b3832fd8 0x4289365d20 0x7f81b38233b8 0 19 <PState:GHC.Parser.Lexer:_build-ipe/stage1/compiler/build/GHC/Parser/Lexer.hs:3779:46> _thunk( ) 0x4289384230 0x4289384160 <([LEpaComment], [LEpaComment]):GHC.Parser.Lexer:> _thunk( ) 0x4289383250 <EpAnnComments:GHC.Parser.Lexer:compiler/GHC/Parser/Lexer.x:2306:19-40> _thunk( ) 0x4289399850 0x7f818f63f440 0x4289399868 <SrcSpanAnnA:GHC.Parser:_build-ipe/stage1/compiler/build/GHC/Parser.hs:12527:13-30> L 0x4289397600 0x42893975a8 <GenLocated:GHC.Parser:_build-ipe/stage1/compiler/build/GHC/Parser.hs:12527:32> 0x4289c4e8c8 : 0x4289c4e8b0 <[]:GHC.Parser.Header:compiler/GHC/Parser/Header.hs:104:36-54> (0x4289c4da70,0x7f818f63f440) <(,):GHC.Parser.Header:compiler/GHC/Parser/Header.hs:104:36-54> _thunk( ) 0x4289c4d030 <Bool:GHC.Parser.Header:compiler/GHC/Parser/Header.hs:(112,22)-(115,27)> ExtendedModSummary 0x422e9c8998 0x7f81b617be78 0x422e9c89b0 0x4289c4c0c0 0x7f81925ccd18 0x7f81925ccd18 0x7f81925ccd18 0x7f81925ccd18 0x7f818f63f440 0x4289c4c0d8 0x4289c4c0f0 0x7f81925ccd18 0x422e9c8a20 0x4289c4c108 0x4289c4c730 0x7f818f63f440 <ExtendedModSummary:GHC.Driver.Make:compiler/GHC/Driver/Make.hs:2041:30-38> ModuleNode 0x4289c4b850 <ModuleGraphNode:GHC.Unit.Module.Graph:compiler/GHC/Unit/Module/Graph.hs:139:14-36> 0x4289c4b590 : 0x4289c4b578 <[]:GHC.Unit.Module.Graph:compiler/GHC/Unit/Module/Graph.hs:139:31-36> ModuleGraph 0x4289c4b2f8 0x4289c4b310 0x4289c4b340 0x7f818f63f4a0 <ModuleGraph:GHC.Driver.Make:compiler/GHC/Driver/Make.hs:(242,19)-(244,40)> HscEnv 0x4289d9a4a8 0x4289d9aad0 0x4289d9aae8 0x4217062a88 0x4217060b38 0x4217060b58 0x4217060b68 0x7f81b38a7ce0 0x4217060b78 0x7f818f63f440 0x7f818f63f440 0x4217062af8 0x4289d9ab10 0x7f81b3907b60 0x4217060c00 114 <HscEnv:GHC.Runtime.Eval:compiler/GHC/Runtime/Eval.hs:790:31-44> ```
* CprAnal: Two regression testsSebastian Graf2021-10-065-0/+70
| | | | For #16040 and #2387.
* Add a regression test for #13233sheaf2021-10-063-0/+62
| | | | | | | | | | This test fails on GHC 8.0.1, only when profiling is enabled, with the error: ghc: panic! (the 'impossible' happened) kindPrimRep.go a_12 This was fixed by commit b460d6c9.
* Remove the Maybe in primRepName's typeRyan Scott2021-10-061-8/+9
| | | | | | | There's no need for this `Maybe`, as it will always be instantiated to `Just` in practice. Fixes #20482.
* EPA: Remove duplicate AnnOpenP/AnnCloseP in DataDeclAlan Zimmerman2021-10-065-27/+618
| | | | | | | The parens EPAs were added in the tyvars where they belong, but also at the top level of the declaration. Closes #20452
* Corrected types of thread ids obtained from the RTSMann mit Hut2021-10-0612-48/+55
| | | | | | | | | | | | | | While the thread ids had been changed to 64 bit words in e57b7cc6d8b1222e0939d19c265b51d2c3c2b4c0 the return type of the foreign import function used to retrieve these ids - namely 'GHC.Conc.Sync.getThreadId' - was never updated accordingly. In order to fix that this function returns now a 'CUULong'. In addition to that the types used in the thread labeling subsystem were adjusted as well and several format strings were modified throughout the whole RTS to display thread ids in a consistent and correct way. Fixes #16761
* docs: Clarify documentation of `getFileSystemEncoding` (#20344)Zubin Duggal2021-10-051-1/+3
| | | | It may not always be a Unicode encoding
* Constant folding for (.&.) maxBound (#20448)Sylvain Henry2021-10-054-0/+70
|
* Ensure top-level binders in scope in SetLevelsSimon Peyton Jones2021-10-055-30/+66
| | | | | | | | | | | | | | | | | Ticket #20200 (the Agda failure) showed another case in which lookupIdSubst would fail to find a local Id in the InScopeSet. This time it was because SetLevels was given a program in which the top-level bindings were not in dependency order. The Simplifier (see Note [Glomming] in GHC.Core.Opt.Occuranal) and the specialiser (see Note [Top level scope] in GHC.Core.Opt.Specialise) may both produce top-level bindings where an early binding refers to a later one. One solution would be to run the occurrence analyser again to put them all in the right order. But a simpler one is to make SetLevels OK with this input by bringing all top-level binders into scope at the start. That's what this patch does.
* Eradicate TcRnUnknownMessage from GHC.Tc.DerivAlfredo Di Napoli2021-10-0539-351/+1002
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This (big) commit finishes porting the GHC.Tc.Deriv module to support the new diagnostic infrastructure (#18516) by getting rid of the legacy calls to `TcRnUnknownMessage`. This work ended up being quite pervasive and touched not only the Tc.Deriv module but also the Tc.Deriv.Utils and Tc.Deriv.Generics module, which needed to be adapted to use the new infrastructure. This also required generalising `Validity`. More specifically, this is a breakdown of the work done: * Add and use the TcRnUselessTypeable data constructor * Add and use TcRnDerivingDefaults data constructor * Add and use the TcRnNonUnaryTypeclassConstraint data constructor * Add and use TcRnPartialTypeSignatures * Add T13324_compile2 test to test another part of the TcRnPartialTypeSignatures diagnostic * Add and use TcRnCannotDeriveInstance data constructor, which introduces a new data constructor to TcRnMessage called TcRnCannotDeriveInstance, which is further sub-divided to carry a `DeriveInstanceErrReason` which explains the reason why we couldn't derive a typeclass instance. * Add DerivErrSafeHaskellGenericInst data constructor to DeriveInstanceErrReason * Add DerivErrDerivingViaWrongKind and DerivErrNoEtaReduce * Introduce the SuggestExtensionInOrderTo Hint, which adds (and use) a new constructor to the hint type `LanguageExtensionHint` called `SuggestExtensionInOrderTo`, which can be used to give a bit more "firm" recommendations when it's obvious what the required extension is, like in the case for the `DerivingStrategies`, which automatically follows from having enabled both `DeriveAnyClass` and `GeneralizedNewtypeDeriving`. * Wildcard-free pattern matching in mk_eqn_stock, which removes `_` in favour of pattern matching explicitly on `CanDeriveAnyClass` and `NonDerivableClass`, because that determine whether or not we can suggest to the user `DeriveAnyClass` or not.
* Make GHC.Utils.Error.Validity type polymorphicAlfredo Di Napoli2021-10-054-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes the `Validity` type polymorphic: ``` data Validity' a = IsValid -- ^ Everything is fine | NotValid a -- ^ A problem, and some indication of why -- | Monomorphic version of @Validity'@ specialised for 'SDoc's. type Validity = Validity' SDoc ``` The type has been (provisionally) renamed to Validity' to not break existing code, as the monomorphic `Validity` type is quite pervasive in a lot of signatures in GHC. Why having a polymorphic Validity? Because it carries the evidence of "what went wrong", but the old type carried an `SDoc`, which clashed with the new GHC diagnostic infrastructure (#18516). Having it polymorphic it means we can carry an arbitrary, richer diagnostic type, and this is very important for things like the `checkOriginativeSideConditions` function, which needs to report the actual diagnostic error back to `GHC.Tc.Deriv`. It also generalises Validity-related functions to be polymorphic in @a@.
* Explain Endo, Dual, ... in lawsViktor Dukhovni2021-10-051-2/+40
|
* Adopt David Feuer's explantion of foldl' via foldrViktor Dukhovni2021-10-051-22/+31
|
* Minor wording tweaks/fixesViktor Dukhovni2021-10-052-24/+22
|
* Note elem ticket 20421Viktor Dukhovni2021-10-051-0/+4
|
* Note linear `elem` costViktor Dukhovni2021-10-051-10/+55
| | | | | This is a writeup of the state of play for better than linear `elem` via a helper type class.
* Add laws link and tweak Traversable class textViktor Dukhovni2021-10-051-4/+8
|
* Address some Foldable documentation nitsViktor Dukhovni2021-10-051-14/+18
| | | | | | - Add link to laws from the class head - Simplify wording of left/right associativity intro paragraph - Avoid needless mention of "endomorphisms"
* CprAnal: Activate Sum CPR for local bindingsSebastian Graf2021-10-053-74/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've had Sum CPR (#5075) for top-level bindings for a couple of years now. That begs the question why we didn't also activate it for local bindings, and the reasons for that are described in `Note [CPR for sum types]`. Only that it didn't make sense! The Note said that Sum CPR would destroy let-no-escapes, but that should be a non-issue since we have syntactic join points in Core now and we don't WW for them (`Note [Don't w/w join points for CPR]`). So I simply activated CPR for all bindings of sum type, thus fixing #5075 and \#16570. NoFib approves: ``` -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- comp_lab_zift -0.0% +0.7% fluid +1.7% +0.7% reptile +0.1% +0.1% -------------------------------------------------------------------------------- Min -0.0% -0.2% Max +1.7% +0.7% Geometric Mean +0.0% +0.0% ``` There were quite a few metric decreases on the order of 1-4%, but T6048 seems to regress significantly, by 26.1%. WW'ing for a `Just` constructor and the nested data type meant additional Simplifier iterations and a 30% increase in term sizes as well as a 200-300% in type sizes due to unboxed 9-tuples. There's not much we can do about it, I'm afraid: We're just doing much more work there. Metric Decrease: T12425 T18698a T18698b T20049 T9020 WWRec Metric Increase: T6048
* Simplifier: Get rid of demand zapping based on Note [Arity decrease]Sebastian Graf2021-10-051-32/+3
| | | | | | | | The examples in the Note were inaccurate (`$s$dm` has arity 1 and that seems OK) and the code didn't actually nuke the demand *signature* anyway. Specialise has to nuke it, but it starts from a clean IdInfo anyway (in `newSpecIdM`). So I just deleted the code. Fixes #20450.
* WorkWrap: Nuke CPR signatures of join points (#18824)Sebastian Graf2021-10-054-24/+79
| | | | | | | | | | | | In #18824 we saw that the Simplifier didn't nuke a CPR signature of a join point when it pushed a continuation into it when it better should have. But join points are local, mostly non-exported bindings. We don't use their CPR signature anyway and would discard it at the end of the Core pipeline. Their main purpose is to propagate CPR info during CPR analysis and by the time worker/wrapper runs the signature will have served its purpose. So we zap it! Fixes #18824.
* Reject type family equation with wrong name (#20260)Krzysztof Gogolewski2021-10-054-25/+39
| | | | | | We should reject "type family Foo where Bar = ()". This check was done in kcTyFamInstEqn but not in tcTyFamInstEqn. I factored out arity checking, which was duplicated.
* Speed up valid hole-fits by adding early abort and checks.Matthías Páll Gissurarson2021-10-0510-61/+889
| | | | | | | | | | | | | | By adding an early abort flag in `TcSEnv`, we can fail fast in the presence of insoluble constraints. This helps us avoid a lot of work in valid hole-fits, and we geta massive speed-up by avoiding a lot of useless work solving constraints that never come into play. Additionally, we add a simple check for degenerate hole types, such as when the type of the hole is an immutable type variable (as is the case when the hole is completely unconstrained). Then the only valid fits are the locals, so we can ignore the global candidates. This fixes #16875
* Add a regression test for #17723sheaf2021-10-044-0/+32
| | | | The underlying bug was fixed by b8d98827, see MR !2477
* Bump TcLevel of failing kind equality implicationsheaf2021-10-044-8/+56
| | | | | | | | Not bumping the TcLevel meant that we could end up trying to add evidence terms for the implication constraint created to wrap failing kind equalities (to avoid their deferral). fixes #20043
* Bespoke TokenLocation data typeVladislav Zavialov2021-10-0413-173/+104
| | | | | | | | | | | | The EpaAnnCO we were using contained an Anchor instead of EpaLocation, making it harder to work with. At the same time, using EpaLocation by itself isn't possible either, as we may have tokens without location information. Hence the new data type: data TokenLocation = NoTokenLoc | TokenLoc !EpaLocation
* compiler: Fix racy ticker counter registrationBen Gamari2021-10-043-25/+47
| | | | | | | | | Previously registration of ticky entry counters was racy, performing a read-modify-write to add the new counter to the ticky_entry_ctrs list. This could result in the list becoming cyclic if multiple threads entered the same closure simultaneously. Fixes #20451.
* compiler: Improve Haddocks of atomic MachOpsBen Gamari2021-10-041-2/+4
|
* ci: Run hadrian builds verbosely, but not testsMatthew Pickering2021-10-041-2/+1
| | | | | | This reduces the output from the testsuite to a more manageable level. Fixes #20432
* Clean up HiePass constraintsVladislav Zavialov2021-10-042-54/+26
|
* Constant folding for negate (#20347)Sylvain Henry2021-10-044-16/+79
| | | | Only for small integral types for now.
* configure: Fix redundant-argument warning from -no-pie checkBen Gamari2021-10-031-2/+2
| | | | | | | | | | | | | | | Modern clang versions are quite picky when it comes to reporting redundant arguments. In particular, they will warn when -no-pie is passed when no linking is necessary. Previously the configure script used a `$CC -Werror -no-pie -E` invocation to test whether `-no-pie` is necessary. Unfortunately, this meant that clang would throw a redundant argument warning, causing configure to conclude that `-no-pie` was not supported. We now rather use `$CC -Werror -no-pie`, ensuring that linking is necessary and avoiding this failure mode. Fixes #20463.
* base: Update Unicode database to 14.0Ben Gamari2021-10-035-112/+208
| | | | Closes #20404.
* ci/test-metrics: Clean up various bash quoting issuesBen Gamari2021-10-031-6/+6
|
* ci: Use https:// transport and access token to push perf notesBen Gamari2021-10-032-36/+10
| | | | | | Previously we would push perf notes using a standard user and SSH key-based authentication. However, configuring SSH is unnecessarily fiddling. We now rather use HTTPS and a project access token.
* Don't use FastString for UTF-8 encoding onlySylvain Henry2021-10-023-4/+14
|
* Add (++)/literal ruleSylvain Henry2021-10-021-0/+5
| | | | | | | | | | When we derive the Show instance of the big record in #16577, I get the following compilation times (with -O): Before: 0.91s After: 0.77s Metric Decrease: T19695
* rts: Unify stack dirtiness checkBen Gamari2021-10-022-6/+6
| | | | | | This fixes an inconsistency where one dirtiness check would not mask out the STACK_DIRTY flag, meaning it may also be affected by the STACK_SANE flag.
* rts: Add missing write barriers in MVar wake-up pathsBen Gamari2021-10-022-12/+37
| | | | | | | | | | | Previously PerformPut failed to respect the non-moving collector's snapshot invariant, hiding references to an MVar and its new value by overwriting a stack frame without dirtying the stack. Fix this. PerformTake exhibited a similar bug, failing to dirty (and therefore mark) the blocked stack before mutating it. Closes #20399.
* Use eqType, not tcEqType, in metavar kind checkRichard Eisenberg2021-10-028-41/+61
| | | | | | | | | | | | Close #20356. See addendum to Note [coreView vs tcView] in GHC.Core.Type for the details. Also killed old Note about metaTyVarUpdateOK, which has been gone for some time. test case: typecheck/should_fail/T20356
* CmmToLlvm: Sign/Zero extend parameters for foreign calls on RISC-VAndreas Schwab2021-10-021-0/+1
| | | | | Like S390 and PPC64, RISC-V requires parameters for foreign calls to be extended to full words.
* Bump terminfo submodule to 0.4.1.5Ben Gamari2021-10-021-0/+0
| | | | Closes #20307.
* gitlab-ci: Bump docker imagesBen Gamari2021-10-021-1/+1
| | | | To install libncurses-dev on Debian targets.
* ci: Unset CI_* variables before run_hadrian and test_makeMatthew Pickering2021-10-011-12/+16
| | | | | | | | | | | | | | | | | | | | | | The goal here is to somewhat sanitize the environment so that performance tests don't fluctuate as much as they have been doing. In particular the length of the commit message was causing benchmarks to increase because gitlab stored the whole commit message twice in environment variables. Therefore when we used `getEnvironment` it would cause more allocation because more string would be created. See #20431 ------------------------- Metric Decrease: T10421 T13035 T18140 T18923 T9198 T12234 T12425 -------------------------
* code gen: Improve efficiency of findPrefRealRegMatthew Pickering2021-10-014-19/+54
| | | | | | | | | | | | | | | | | | Old strategy: For each variable linearly scan through all the blocks and check to see if the variable is any of the block register mappings. This is very slow when you have a lot of blocks. New strategy: Maintain a map from virtual registers to the first real register the virtual register was assigned to. Consult this map in findPrefRealReg. The map is updated when the register mapping is updated and is hidden behind the BlockAssigment abstraction. On the mmark package this reduces compilation time from about 44s to 32s. Ticket: #19471
* Convert Diagnostics GHC.Tc.Gen.* (Part 3)Aaron Allen2021-10-013-107/+266
| | | | | | Converts all diagnostics in the `GHC.Tc.Gen.Expr` module. (#20116)
* NCG: Linear-reg-alloc: A few small implemenation tweaks.Andreas Klebinger2021-09-303-25/+40
| | | | | | Removed an intermediate list via a fold. realRegsAlias: Manually inlined the list functions to get better code. Linear.hs added a bang somewhere.
* Recompilation: Handle -plugin-package correctlyMatthew Pickering2021-09-304-5/+25
| | | | | | | | | | | | | | | If a plugins was specified using the -plugin-package-(id) flag then the module it applied to was always recompiled. The recompilation checker was previously using `findImportedModule`, which looked for packages in the HPT and then in the package database but only for modules specified using `-package`. The correct lookup function for plugins is `findPluginModule`, therefore we check normal imports with `findImportedModule` and plugins with `findPluginModule`. Fixes #20417
* driver: Fix -E -XCPP, copy output from CPP ouput rather than .hs outputMatthew Pickering2021-09-301-2/+2
| | | | | | | | | Fixes #20416 I thought about adding a test for this case but I struggled to think of something robust. Grepping -v3 will include different paths on different systems and the structure of the result file depends on which preprocessor you are using.
* Rules for sized conversion primops (#19769)Sylvain Henry2021-09-3011-28/+337
| | | | | Metric Decrease: T12545