summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Run linear Lint on the desugarer output (part of #19165)Krzysztof Gogolewski2021-03-058-19/+82
| | | | | | | | | | | | | | This addresses points (1a) and (1b) of #19165. - Move mkFailExpr to HsToCore/Utils, as it can be shared - Desugar incomplete patterns and holes to an empty case, as in Note [Incompleteness and linearity] - Enable linear linting of desugarer output - Mark MultConstructor as broken. It fails Lint, but I'd like to fix this separately. Metric Decrease: T6048
* testsuite: Prevent T16318 from picking up .ghciBen Gamari2021-03-041-1/+1
| | | | | | Previously this test did nothing to prevent GHC from reading .ghci due to the `-e` arguments. Consequently it could fail due to multiple reloadings of DynFlags while evaluating .ghci.
* Bring back COMPLETE sets filtered by result TyCon (#14422)Cale Gibbard2021-03-0415-58/+220
| | | | | | | | | | | | | | | | | | | Commit 2a94228 dramatically simplified the implementation and improved the performance of COMPLETE sets while making them applicable in more scenarios at the same time. But it turned out that there was a change in semantics that (to me unexpectedly) broke users' expectations (see #14422): They relied on the "type signature" of a COMPLETE pragma to restrict the scrutinee types of a pattern match for which they are applicable. This patch brings back that filtering, so the semantics is the same as it was in GHC 9.0. See the updated Note [Implementation of COMPLETE pragmas]. There are a few testsuite output changes (`completesig13`, `T14422`) which assert this change. Co-authored-by: Sebastian Graf <sebastian.graf@kit.edu>
* gitlab-ci: Build releases with hyperlinked sourcesBen Gamari2021-03-041-6/+4
| | | | Fixes #19455.
* rts: Make markLiveObject thread-safeBen Gamari2021-03-042-3/+9
| | | | | | | | markLiveObject is called by GC worker threads and therefore must be thread-safe. This was a rather egregious oversight which the testsuite missed. (cherry picked from commit fe28a062e47bd914a6879f2d01ff268983c075ad)
* base: Add reference to #19413 to Note [unsafePerformIO and strictness]Ben Gamari2021-03-041-1/+1
|
* testsuite: Add test for #19413Ben Gamari2021-03-043-0/+20
| | | | This was fixed as a result of #19181.
* Hadrian: Enable -ticky-dyn-thunk in ticky_ghc transformerMatthew Pickering2021-03-041-0/+1
| | | | | | | | | This produces much more detailed ticky profiles which include names of constructors. Related !3340 !2098 Fixes #19403
* Add a Template Haskell warning flag -Wimplicit-liftKrzysztof Gogolewski2021-03-049-1/+72
| | | | Part of #17804.
* IPE: Give all constructor and function tables locationswip/con-infoMatthew Pickering2021-03-033-22/+17
| | | | | | | | | | During testing it was observed that quite a few info tables were not being given locations (due to not being assigned source locations, because they were not enclosed by a source note). We can at least give the module name and type for such closures even if no more accurate source information. Especially for constructors this helps find them in the STG dumps.
* Use a newtype for CHeader and CStub in ForeignStubsMatthew Pickering2021-03-0311-44/+71
|
* Don't use FastString to convert string to UTF8Matthew Pickering2021-03-034-25/+23
|
* Add release notes for -hi, -finfo-table-map and -fdistinct-constructor-tablesMatthew Pickering2021-03-031-0/+14
|
* Add test for whereFrom#Matthew Pickering2021-03-035-0/+51
|
* Add whereFrom and whereFrom# primopMatthew Pickering2021-03-036-0/+76
| | | | | | | | | | The `whereFrom` function provides a Haskell interface for using the information created by `-finfo-table-map`. Given a Haskell value, the info table address will be passed to the `lookupIPE` function in order to attempt to find the source location information for that particular closure. At the moment it's not possible to distinguish the absense of the map and a failed lookup.
* Add option to give each usage of a data constructor its own info tableMatthew Pickering2021-03-0325-187/+330
| | | | | | | | | | | | | The `-fdistinct-constructor-tables` flag will generate a fresh info table for the usage of any data constructor. This is useful for debugging as now by inspecting the info table, you can determine which usage of a constructor caused that allocation rather than the old situation where the info table always mapped to the definition site of the data constructor which is useless. In conjunction with `-hi` and `-finfo-table-map` this gives a more fine grained understanding of where constructor allocations arise from in a program.
* Add -finfo-table-map which maps info tables to source positionsMatthew Pickering2021-03-0340-79/+852
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new flag embeds a lookup table from the address of an info table to information about that info table. The main interface for consulting the map is the `lookupIPE` C function > InfoProvEnt * lookupIPE(StgInfoTable *info) The `InfoProvEnt` has the following structure: > typedef struct InfoProv_{ > char * table_name; > char * closure_desc; > char * ty_desc; > char * label; > char * module; > char * srcloc; > } InfoProv; > > typedef struct InfoProvEnt_ { > StgInfoTable * info; > InfoProv prov; > struct InfoProvEnt_ *link; > } InfoProvEnt; The source positions are approximated in a similar way to the source positions for DWARF debugging information. They are only approximate but in our experience provide a good enough hint about where the problem might be. It is therefore recommended to use this flag in conjunction with `-g<n>` for more accurate locations. The lookup table is also emitted into the eventlog when it is available as it is intended to be used with the `-hi` profiling mode. Using this flag will significantly increase the size of the resulting object file but only by a factor of 2-3x in our experience.
* Profiling by info table mode (-hi)Matthew Pickering2021-03-037-6/+35
| | | | | | | | This profiling mode creates bands by the address of the info table for each closure. This provides a much more fine-grained profiling output than any of the other profiling modes. The `-hi` profiling mode does not require a profiling build.
* Revert "Remove GHC.Types.Unique.Map module"Matthew Pickering2021-03-032-0/+207
| | | | This reverts commit 1c7c6f1afc8e7f7ba5d256780bc9d5bb5f3e7601.
* User's Guide: document DefaultSignatures' interaction with subsumptionRyan Scott2021-03-031-25/+118
| | | | | | | | | | As reported in #19432, the rules governing how `DefaultSignatures` are typechecked became stricter in GHC 9.0 due to simplified subsumption. However, this was far from obvious to me after reading the User's Guide section on `DefaultSignatures`. In this patch, I spruce up the documentation in that section so that it mentions these nuances. Resolves #19432.
* Build event logging rts in all flavours except GhcinGhci.Andreas Klebinger2021-03-032-2/+2
| | | | This applies the fix for #19033 to all the other flavours as well.
* Add a flag to dump the FastString tableSylvain Henry2021-03-034-1/+19
|
* DmdAnal: Better syntax for demand signatures (#19016)Sebastian Graf2021-03-0349-396/+384
| | | | | | | | | The update of the Outputable instance resulted in a slew of documentation changes within Notes that used the old syntax. The most important doc changes are to `Note [Demand notation]` and the user's guide. Fixes #19016.
* ghc-heap: Fix profiled buildBen Gamari2021-03-031-2/+2
| | | | | Previously a255b4e38918065ac028789872e53239ac30ae1a failed to update the non-profiling codepath.
* hadrian: Fix profiled flavour transformerBen Gamari2021-03-031-1/+9
| | | | | Previously the profiled flavour transformer failed to add the profiled ways to the library and RTS ways lists, resulting in link failures.
* Fix leaks of the HscEnv with quick flavour (#19356)Sylvain Henry2021-03-031-3/+5
| | | | Thanks @mpickering for finding them!
* Minor simplification for leak indicatorsSylvain Henry2021-03-031-15/+18
| | | | Avoid returning a lazy panic value when leak indicators are disabled.
* Always INLINE ($!)Sylvain Henry2021-03-031-0/+1
| | | | ($) is INLINE so there is no reason ($!) shouldn't.
* Profiling: Allow heap profiling to be controlled dynamically.Matthew Pickering2021-03-0317-13/+182
| | | | | | | | | | This patch exposes three new functions in `GHC.Profiling` which allow heap profiling to be enabled and disabled dynamically. 1. startHeapProfTimer - Starts heap profiling with the given RTS options 2. stopHeapProfTimer - Stops heap profiling 3. requestHeapCensus - Perform a heap census on the next context switch, regardless of whether the timer is enabled or not.
* Fix array and cleanup conversion primops (#19026)Sylvain Henry2021-03-0375-754/+821
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
* Add cmpNat, cmpSymbol, and cmpCharDaniel Winograd-Cort2021-03-0315-137/+317
| | | | | | | Add Data.Type.Ord Add and update tests Metric Increase: MultiLayerModules
* Fix typo in docs [skip ci]Sebastian Graf2021-03-031-1/+1
|
* gitlab-ci: Disable utimensat in Darwin buildsBen Gamari2021-03-021-0/+2
| | | Fixes #17895.
* Support auto-detection of MAX_REAL_FLOAT_REG and MAX_REAL_DOUBLE_REG up to 6ARATA Mizuki2021-03-021-2/+18
| | | | Fixes #17953
* Add a test for the calling convention of "foreign import prim" on x86_64 and ↵ARATA Mizuki2021-03-025-0/+96
| | | | AArch64
* Test start/endEventlogging: first header must be EVENT_HEADER_BEGINDavid Eichmann2021-03-024-0/+207
|
* eventlog: Fix various racesBen Gamari2021-03-025-20/+136
| | | | | | | | | | | | | | | Previously the eventlog infrastructure had a couple of races that could pop up when using the startEventLog/endEventLog interfaces. In particular, stopping and then later restarting logging could result in data preceding the eventlog header, breaking the integrity of the stream. To fix this we rework the invariants regarding the eventlog and generally tighten up the concurrency control surrounding starting and stopping of logging. We also fix an unrelated bug, wherein log events from disabled capabilities could end up never flushed.
* Define TRY_ACQUIRE_LOCK correctly when non-threadedMatthew Pickering2021-03-021-3/+5
|
* Pmc: Implement `considerAccessible` (#18610)Sebastian Graf2021-03-019-25/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | Consider (`T18610`): ```hs f :: Bool -> Int f x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) -> 3 -- Warning: Redundant ``` The third clause will be flagged as redundant. Nevertheless, the programmer might intend to keep the clause in order to avoid bitrot. After this patch, the programmer can write ```hs g :: Bool -> Int g x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) | GHC.Exts.considerAccessible -> 3 -- No warning ``` And won't be bothered any longer. See also `Note [considerAccessible]` and the updated entries in the user's guide. Fixes #18610 and #19228.
* Fix a bug causing loss of sharing in `UniqSDFM`Sebastian Graf2021-03-011-2/+2
| | | | | | | | | | | | | | | | | | | | While fixing #18610, I noticed that ```hs f :: Bool -> Int f x = case (x, x) of (True, True) -> 1 (False, False) -> 2 ``` was *not* detected as exhaustive. I tracked it down to `equateUSDFM`, where upon merging equality classes of `x` and `y`, we failed to atually indirect the *representative* `x'` of the equality class of `x` to the representative `y'` of `y`. The fixed code is much more naturally and would I should have written in the first place. I can confirm that the above example now is detected as exhaustive. The commit that fixes #18610 comes directly after and it has `f` above as a regression test, so I saw no need to open a ticket or commit a separate regression test.
* Wrap LHsContext in Maybe in the GHC ASTAlan Zimmerman2021-03-0127-159/+137
| | | | | | | If the context is missing it is captured as Nothing, rather than putting a noLoc in the ParsedSource. Updates haddock submodule
* Fix terrible occurrence-analysis bugSimon Peyton Jones2021-03-019-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.
* Infer multiplicity in case expressionsKrzysztof Gogolewski2021-03-013-8/+7
| | | | This is a first step towards #18738.
* Unify result type earlier to improve error messagesSimon Peyton Jones2021-03-0148-374/+445
| | | | | | | | | | | | | | | | | | | | | | Ticket #19364 helpfully points out that we do not currently take advantage of pushing the result type of an application into the arguments. This makes error messages notably less good. The fix is rather easy: move the result-type unification step earlier. It's even a bit more efficient; in the the checking case we now do one less zonk. See Note [Unify with expected type before typechecking arguments] in GHC.Tc.Gen.App This change generally improves error messages, but it made one worse: typecheck/should_fail/T16204c. That led me to the realisation that a good error can be replaced by a less-good one, which provoked me to change GHC.Tc.Solver.Interact.inertsCanDischarge. It's explained in the new Note [Combining equalities] One other refactoring: I discovered that KindEqOrigin didn't need a Maybe in its type -- a nice simplification.
* Widen acceptance window of `MultiLayerModules` (#19293) [skip ci]Sebastian Graf2021-03-011-1/+4
| | | | | | | As #19293 realises, this one keeps on flip flopping by 2.5% depending on how many modules there are within the GHC package. We should revert this once we figured out how to fix what's going on.
* testsuite: Accept allocations change in T10421Ben Gamari2021-03-010-0/+0
| | | | | Metric Decrease: T10421
* rts/eventlog: Flush MainCapability buffer in non-threaded RTSBen Gamari2021-03-011-0/+2
| | | | | | | Previously flushEventLog failed to flush anything but the global event buffer in the non-threaded RTS. Fixes #19436.
* rts/eventlog: Ensure that all capability buffers are flushedBen Gamari2021-03-012-1/+2
| | | | | | | | | | | The previous approach performed the flush in yieldCapability. However, as pointed out in #19435, this is wrong as it idle capabilities will not go through this codepath. The fix is simple: undo the optimisation, flushing in `flushEventLog` by calling `flushAllCapsEventsBufs` after acquiring all capabilities. Fixes #19435.
* 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.