summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add some utility functions to GHC.Types.SrcLocwip/az/srclocAlan Zimmerman2021-02-271-5/+26
| | | | pprUserSpan, isZeroWidthSpan, pprLocated, combineRealSrcSpans
* 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 '#-}'.
* Make CmmType field of LocalReg strictMatthew Pickering2021-02-221-1/+1
| | | | | This was observed to build up thunks which were forced by using a `-hi` profile and T3294 as a test.
* Make Width field in CmmType strictMatthew Pickering2021-02-221-1/+1
| | | | | This value is eventually forced so don't build up thunks. Observed with T3294 and -hi profile.
* Force gcp in assignArgumentsPosMatthew Pickering2021-02-221-2/+2
| | | | | | I observed this accumulating in the T3294 test only to be eventually forced (by a -hi profile). As it is only word big, forcing it saves quite a bit of allocation.
* Do not cas on slowpath of SpinLock unnecessarilyDylan Yudaken2021-02-221-3/+35
| | | | This is a well known technique to reduce inter-CPU bus traffic while waiting for the lock by reducing the number of writes.
* Move Hooks into HscEnvSylvain Henry2021-02-2217-86/+143
|
* Add the docspec:base rule to HadrianHécate2021-02-224-0/+63
|
* GHCi: Always show fixityLeif Metcalf2021-02-223-10/+22
| | | | | | | | | | | | | | | | | | | We used to only show the fixity of an operator if it wasn't the default fixity. Usually this was when the fixity was undeclared, but it could also arise if one declared the fixity of an operator as infixl 9, the default fixity. This commit makes it so that :i always shows the fixity of an operator, even if it is unset. We may want in the future to keep track of whether an operator's fixity is defined, so that we can print a comment like infixl 9 # -- Assumed, since no fixity is declared. for operators with no specified fixity, and so that we can print fixity of a term with a non-symbolic term when its fixity has been manually specified as infixl 9. Implements #19200.
* Ensure tcg_env is up-to-date when running typechecker pluginsalexbiehl2021-02-221-4/+8
|
* Prefer -Wmissing-signatures over -Wmissing-exported-signatures (#14794)Michiel de Bruijne2021-02-2219-21/+298
|
* Make openFile exception safeDavid Feuer2021-02-229-118/+432
| | | | | | | | | | | | | | | | | | | * `openFile` could sometimes leak file descriptors if it received an asynchronous exception (#19114, #19115). Fix this on POSIX. * `openFile` and more importantly `openFileBlocking` could not be interrupted effectively during the `open` system call (#17912). Fix this on POSIX. * Implement `readFile'` using `withFile` to ensure the file is closed promptly on exception. * Avoid `bracket` in `withFile`, reducing the duration of masking. Closes #19130. Addresses #17912, #19114, and #19115 on POSIX systems, but not on Windows.
* Improve handling of overloaded labels, literals, lists etcwip/T19154Simon Peyton Jones2021-02-1959-1027/+1449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When implementing Quick Look I'd failed to remember that overloaded labels, like #foo, should be treated as a "head", so that they can be instantiated with Visible Type Application. This caused #19154. A very similar ticket covers overloaded literals: #19167. This patch fixes both problems, but (annoyingly, albeit temporarily) in two different ways. Overloaded labels I dealt with overloaded labels by buying fully into the Rebindable Syntax approach described in GHC.Hs.Expr Note [Rebindable syntax and HsExpansion]. There is a good overview in GHC.Rename.Expr Note [Handling overloaded and rebindable constructs]. That module contains much of the payload for this patch. Specifically: * Overloaded labels are expanded in the renamer, fixing #19154. See Note [Overloaded labels] in GHC.Rename.Expr. * Left and right sections used to have special code paths in the typechecker and desugarer. Now we just expand them in the renamer. This is harder than it sounds. See GHC.Rename.Expr Note [Left and right sections]. * Infix operator applications are expanded in the typechecker, specifically in GHC.Tc.Gen.App.splitHsApps. See Note [Desugar OpApp in the typechecker] in that module * ExplicitLists are expanded in the renamer, when (and only when) OverloadedLists is on. * HsIf is expanded in the renamer when (and only when) RebindableSyntax is on. Reason: the coverage checker treats HsIf specially. Maybe we could instead expand it unconditionally, and fix up the coverage checker, but I did not attempt that. Overloaded literals Overloaded literals, like numbers (3, 4.2) and strings with OverloadedStrings, were not working correctly with explicit type applications (see #19167). Ideally I'd also expand them in the renamer, like the stuff above, but I drew back on that because they can occur in HsPat as well, and I did not want to to do the HsExpanded thing for patterns. But they *can* now be the "head" of an application in the typechecker, and hence something like ("foo" @T) works now. See GHC.Tc.Gen.Head.tcInferOverLit. It's also done a bit more elegantly, rather than by constructing a new HsExpr and re-invoking the typechecker. There is some refactoring around tcShortCutLit. Ultimately there is more to do here, following the Rebindable Syntax story. There are a lot of knock-on effects: * HsOverLabel and ExplicitList no longer need funny (Maybe SyntaxExpr) fields to support rebindable syntax -- good! * HsOverLabel, OpApp, SectionL, SectionR all become impossible in the output of the typecheker, GhcTc; so we set their extension fields to Void. See GHC.Hs.Expr Note [Constructor cannot occur] * Template Haskell quotes for HsExpanded is a bit tricky. See Note [Quotation and rebindable syntax] in GHC.HsToCore.Quote. * In GHC.HsToCore.Match.viewLExprEq, which groups equal HsExprs for the purpose of pattern-match overlap checking, I found that dictionary evidence for the same type could have two different names. Easily fixed by comparing types not names. * I did quite a bit of annoying fiddling around in GHC.Tc.Gen.Head and GHC.Tc.Gen.App to get error message locations and contexts right, esp in splitHsApps, and the HsExprArg type. Tiresome and not very illuminating. But at least the tricky, higher order, Rebuilder function is gone. * Some refactoring in GHC.Tc.Utils.Monad around contexts and locations for rebindable syntax. * Incidentally fixes #19346, because we now print renamed, rather than typechecked, syntax in error mesages about applications. The commit removes the vestigial module GHC.Builtin.RebindableNames, and thus triggers a 2.4% metric decrease for test MultiLayerModules (#19293). Metric Decrease: MultiLayerModules T12545
* Test Driver: Tweak interval of test reportingMatthew Pickering2021-02-181-5/+12
| | | | | | | | | | | Rather than just display every 100 tests, work out how many to display based on the total number of tests. This improves the experience when running a small number of tests. For [0..100] - Report every test [100..1000] - Report every 10 tests [1000..10000] - Report every 100 tests and so on..
* users guide: Mention that -e can be given multiple timesBen Gamari2021-02-181-2/+3
| | | | Fixes #19122.
* base: Fix order of infix declarations in Data.FunctorBen Gamari2021-02-181-2/+2
| | | | | | | As pointed in #19284, previously the order was a bit confusing. This didn't affect the meaning but nevertheless it's much clearer now. Closes #19284.
* Rectify the haddock markup surrounding symbols for foldl' and foldMap'Hécate Moonlight2021-02-181-23/+23
| | | | closes #19365
* Remove leftover trace messages from the keepAlive# work.Andreas Klebinger2021-02-181-4/+2
|
* Use target Int/Word when detecting literal overflows (#17336)Sylvain Henry2021-02-181-54/+76
| | | | And also for empty enumeration detection.
* Improve specialisation for imported functionsSimon Peyton Jones2021-02-185-9/+52
| | | | | | | | | | | | | At a SPECIALSE pragma for an imported Id, we used to check that it was marked INLINABLE. But that turns out to interact badly with worker/wrapper: see Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap. So this small patch instead simply tests that we have an unfolding for the function; see Note [SPECIALISE pragmas for imported Ids] in GHC.Tc.Gen.Sig. Fixes #19246
* TypeMap: Use mkTyConTy instead of TyConApp constructorBen Gamari2021-02-181-1/+1
| | | | | | This allows TypeMap to benefit from the nullary TyConApp sharing optimisation described in Note [Sharing nullary TyConApps] in GHC.Core.TyCon.
* Extend nullary TyConApp optimisation to all TyConsBen Gamari2021-02-188-174/+218
| | | | | | | | | | | See Note [Sharing nullary TyConApps] in GHC.Core.TyCon. Closes #19367. Metric Decrease: T9872a T9872b T9872c
* rts: Add generic block traversal function, listAllBlocksMatthew Pickering2021-02-182-0/+39
| | | | | | | | | This function is exposed in the RtsAPI.h so that external users have a blessed way to traverse all the different `bdescr`s which are known by the RTS. The main motivation is to use this function in ghc-debug but avoid having to expose the internal structure of a Capability in the API.
* directory: ensure xdg compliance (Fix #6077)Gauvain 'GovanifY' Roussel-Tarbouriech2021-02-186-15/+33
|
* Document how bottom CPR and dead-ending Divergence are related [skip ci]Sebastian Graf2021-02-181-0/+24
| | | | | | In a new `Note [Bottom CPR iff Dead-Ending Divergence]`. Fixes #18086.
* Fix #19377 by using lookupLOcc when desugaring TH-quoted ANNsRyan Scott2021-02-173-4/+18
| | | | | | | | | | Previously, the desugarer was looking up names referenced in TH-quoted `ANN`s by using `globalVar`, which would allocate a fresh TH `Name`. In effect, this would prevent quoted `ANN`s from ever referencing the correct identifier `Name`, leading to #19377. The fix is simple: instead of `globalVar`, use `lookupLOcc`, which properly looks up the name of the in-scope identifier. Fixes #19377.
* UnVarGraph: Improve asymptoticsBen Gamari2021-02-171-30/+66
| | | | | | | | | | | | | | | | | | This is a redesign of the UnVarGraph data structure used by the call arity analysis to avoid the pathologically-poor performance observed in issue #18789. Specifically, deletions were previously O(n) in the case of graphs consisting of many complete (bipartite) sub-graphs. Together with the nature of call arity this would produce quadratic behavior. We now encode deletions specifically, taking care to do some light normalization of empty structures. In the case of the `Network.AWS.EC2.Types.Sum` module from #19203, this brings the runtime of the call-arity analysis from over 50 seconds down to less than 2 seconds. Metric Decrease: T15164 WWRec
* CallArity: Small optimisations and strictnessBen Gamari2021-02-171-2/+4
|
* PPC NCG: print procedure end label for debugPeter Trommler2021-02-171-5/+11
| | | | Fixes #19118
* rts: TraverseHeap: Update resetStaticObjectForProfiling docsDaniel Gröber2021-02-171-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | Simon's concern in the old comment, specifically: So all of the calls to traverseMaybeInitClosureData() here are initialising retainer sets with the wrong flip. Is actually exactly what the code was intended to do. It makes the closure data valid, then at the beginning of the traversal the flip bit is flipped resetting all closures across the heap to invalid. Now it used to be that the profiling code using the traversal has it's own sense of valid vs. invalid beyond what the traversal code does and indeed the retainer profiler still does this, there a getClosureData of NULL is considered an invalid retainer set. So in effect there wasn't any difference in invalidating closure data rather than just resetting it to a valid zero, which might be what confused Simon at the time. As the code is now it actually uses the value of the valid/invalid bit in the form of the 'first_visit' argument to the 'visit' callback so there is a difference.