summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* rts: TraverseHeap: Move "flip" bit into traverseState structDaniel Gröber2021-02-176-57/+67
|
* rts: TraverseHeap: Make trav. data macros into functionsDaniel Gröber2021-02-174-22/+30
| | | | | This allows the global 'flip' variable not to be exported. This allows a future commit to also make it part of the traversalState struct.
* rts: TraverseHeap: Simplify profiling headerDaniel Gröber2021-02-175-27/+18
| | | | | Having a union in the closure profiling header really just complicates things so get back to basics, we just have a single StgWord there for now.
* rts: TraverseHeap: Update some commentsDaniel Gröber2021-02-171-4/+4
| | | | data_out was renamed to child_data at some point
* rts: TraverseHeap: Introduce callback for subtree completionDaniel Gröber2021-02-173-77/+185
| | | | | | | | | | | | | | | The callback 'return_cb' allows users to be perform additional accounting when the traversal of a subtree is completed. This is needed for example to determine the number or total size of closures reachable from a given closure. This commit also makes the lifetime increase of stackElements from commit "rts: TraverseHeap: Increase lifetime of stackElements" optional based on 'return_cb' being set enabled or not. Note that our definition of "subtree" here includes leaf nodes. So the invariant is that return_cb is called for all nodes in the traversal exactly once.
* rts: TraverseHeap: Link parent stackElements on the stackDaniel Gröber2021-02-171-44/+56
| | | | | | | | | The new 'sep' field links a stackElement to it's "parent". That is the stackElement containing it's parent closure. Currently not all closure types create long lived elements on the stack so this does not cover all parents along the path to the root but that is about to change in a future commit.
* rts: TraverseHeap: Increase lifetime of stackElementsDaniel Gröber2021-02-171-16/+26
| | | | | | | | | | | | | | | This modifies the lifetime of stackElements such that they stay on the stack until processing of all child closures is complete. Currently the stackElement representing a set of child closures will be removed as soon as processing of the last closure _starts_. We will use this in a future commit to allow storing information on the stack which should be accumulated in a bottom-up manner along the closure parent-child relationship. Note that the lifetime increase does not apply to 'type == posTypeFresh' stack elements. This is because they will always be pushed right back onto the stack as regular stack elements anyways.
* rts: TraverseHeap: Rename traversePushClosure to traversePushRootDaniel Gröber2021-02-173-4/+10
|
* Parse symbolic names in ANN type correctly with otyconRyan Scott2021-02-168-1/+33
| | | | | | | | | | | | | | | | | This adds a new `otycon` production to the parser that allows for type constructor names that are either alphanumeric (`tycon`) or symbolic (`tyconsym`), where the latter must be parenthesized appropriately. `otycon` is much like the existing `oqtycon` production, except that it does not permit qualified names. The parser now uses `otycon` to parse type constructor names in `ANN type` declarations, which fixes #19374. To make sure that all of this works, I added three test cases: * `should_compile/T19374a`: the original test case from #19374 * `should_fail/T19374b`: a test that makes sure that an `ANN` with a qualified name fails to parse * `should_fail/T19374c`: a test that makes sure that an `ANN type` with a qualified name fails to parse
* Avoid false redundant import warning with DisambiguateRecordFieldsAdam Gundry2021-02-164-6/+30
| | | | | Fixes #17853. We mustn't discard the result of pickGREs, because doing so might lead to incorrect redundant import warnings.
* Add Generic tuple instances up to 15Andrzej Rybczak2021-02-161-0/+48
|
* Avoid useless w/w splitSimon Peyton Jones2021-02-162-96/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is just a tidy-up for the post-strictness-analysis worker wrapper split. Consider f x = x Strictnesss analysis does not lead to a w/w split, so the obvious thing is to leave it 100% alone. But actually, because the RHS is small, we ended up adding a StableUnfolding for it. There is some reason to do this if we choose /not/ do to w/w on the grounds that the function is small. See Note [Don't w/w inline small non-loop-breaker things] But there is no reason if we would not have done w/w anyway. This patch just moves the conditional to later. Easy. This does move some -ddump-simpl printouts around a bit. I also discovered that the previous code was overwritten an InlineCompulsory with InlineStable, which is utterly wrong. That in turn meant that some default methods (marked InlineCompulsory) were getting their InlineCompulsory squashed. This patch fixes that bug --- but of course that does mean a bit more inlining! Metric Decrease: T9233 T9675 Metric Increase: T12707 T11374 T3064 T4029 T9872b T9872d haddock.Cabal
* Use explicit import list for Data.ListOleg Grenrus2021-02-161-1/+1
|
* Replace more autotools obsolete macros (#19189)Sylvain Henry2021-02-165-18/+12
|
* Don't build extra object with -no-hs-mainSylvain Henry2021-02-162-12/+25
| | | | | | | | We don't need to compile/link an additional empty C file when it is not needed. This patch may also fix #18938 by avoiding trying to lookup the RTS unit when there is none (yet) in the unit database.
* Make sure HasField use counts for -Wunused-top-bindsAdam Gundry2021-02-166-2/+45
| | | | | | This is a small fix that depends on the previous commit, because it corrected the rnExpr free variable calculation for HsVars which refer to ambiguous fields. Fixes #19213.
* Implement NoFieldSelectors extension (ghc-proposals 160)Adam Gundry2021-02-1664-265/+1236
| | | | | | | | | | | | | | | | | | | | | Fixes #5972. This adds an extension NoFieldSelectors to disable the generation of selector functions corresponding to record fields. When this extension is enabled, record field selectors are not accessible as functions, but users are still able to use them for record construction, pattern matching and updates. See Note [NoFieldSelectors] in GHC.Rename.Env for details. Defining the same field multiple times requires the DuplicateRecordFields extension to be enabled, even when NoFieldSelectors is in use. Along the way, this fixes the use of non-imported DuplicateRecordFields in GHCi with -fimplicit-import-qualified (fixes #18729). Moreover, it extends DisambiguateRecordFields to ignore non-fields when looking up fields in record updates (fixes #18999), as described by Note [DisambiguateRecordFields for updates]. Co-authored-by: Simon Hafner <hafnersimon@gmail.com> Co-authored-by: Fumiaki Kinoshita <fumiexcel@gmail.com>
* Throw IOError when allocaBytesAligned gets non-power-of-two alignDaniel Gröber2021-02-142-2/+25
|
* Document word-size rounding of ByteArray# memory (Fix #14731)Daniel Gröber2021-02-141-1/+2
|
* Improve ByteArray# documentation regarding alignmentDaniel Gröber2021-02-143-3/+14
|
* Fix non power-of-two Storable.alignment in Capi_Ctype testsDaniel Gröber2021-02-143-3/+3
| | | | | | | Alignments passed to alloca and friends must be a power of two for the code in allocatePinned to work properly. Commit 41230e2601 ("Zero out pinned block alignment slop when profiling") introduced an ASSERT for this but this test was still violating it.
* validate: Fix copy-pastaBen Gamari2021-02-141-2/+2
| | | | | | | Previously the Hadrian codepath of `validate` inverted the logic which decides whether the test build of `xhtml` should be built with `--enable-shared`. This resulted in validate failures on Windows, which does not support dynamic linkage of Haskell code.
* Fix over-eager inlining in SimpleOptSimon Peyton Jones2021-02-149-40/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In GHC.Core.SimpleOpt, I found that its inlining could duplicate an arbitary redex inside a lambda! Consider (\xyz. x+y). The occurrence-analysis treats the lamdda as a group, and says that both x and y occur once, even though the occur under the lambda-z. See Note [Occurrence analysis for lambda binders] in OccurAnal. When the lambda is under-applied in a call, the Simplifier is careful to zap the occ-info on x,y, because they appear under the \z. (See the call to zapLamBndrs in simplExprF1.) But SimpleOpt missed this test, resulting in #19347. So this patch * commons up the binder-zapping in GHC.Core.Utils.zapLamBndrs. * Calls this new function from GHC.Core.Opt.Simplify * Adds a call to zapLamBndrs to GHC.Core.SimpleOpt.simple_app This change makes test T12990 regress somewhat, but it was always very delicate, so I'm going to put up with that. In this voyage I also discovered a small, rather unrelated infelicity in the Simplifier: * In GHC.Core.Opt.Simplify.simplNonRecX we should apply isStrictId to the OutId not the InId. See Note [Dark corner with levity polymorphism] It may never "bite", because SimpleOpt should have inlined all the levity-polymorphic compulsory inlnings already, but somehow it bit me at one point and it's generally a more solid thing to do. Fixing the main bug increases runtime allocation in test perf/should_run/T12990, for (acceptable) reasons explained in a comement on Metric Increase: T12990
* Drop GHC_LOADED_IN_GHCIBen Gamari2021-02-144-49/+0
| | | | | | | This previously supported the ghc-in-ghci script which has been since dropped. Hadrian's ghci support does not need this macro (which disabled uses of UnboxedTuples) since it uses `-fno-code` rather than produce bytecode.
* ghc-in-ghci: Drop itBen Gamari2021-02-145-115/+0
| | | | | isovector recently noticed that it is broken and regardless it is superceded by `hadrian/ghci`.
* ghc-compact: Use keepAlive# in GHC.Compact.SerializedBen Gamari2021-02-141-10/+2
|
* base: Use keepAlive# in Foreign.Marshal.AllocBen Gamari2021-02-141-25/+4
|
* base: Use keepAlive# in withForeignPtrBen Gamari2021-02-141-1/+3
|
* Introduce keepAlive primopBen Gamari2021-02-1410-18/+110
|
* genprimopcode: Add a second levity-polymorphic tyvarBen Gamari2021-02-141-0/+3
| | | | This will be needed shortly.
* StringBuffer: Use unsafeWithForeignPtrBen Gamari2021-02-141-12/+18
|
* Bump bytestring submoduleBen Gamari2021-02-141-0/+0
| | | | Teach it to use unsafeWithForeignPtr where appropriate.
* base: Use unsafeWithForeignPtr in GHC.IO.BufferBen Gamari2021-02-141-5/+6
|
* base: Eliminate allocating withForeignPtrs from GHC.Event.ArrayBen Gamari2021-02-141-15/+17
|
* GHC.Utils.Binary: Eliminate allocating withForeignPtr usesBen Gamari2021-02-141-7/+16
|
* base: Add unsafeWithForeignPtrBen Gamari2021-02-142-26/+38
|
* Bignum: fix bogus rewrite rule (#19345)Sylvain Henry2021-02-134-5/+31
| | | | | | | | Fix the following rule: "fromIntegral/Int->Natural" fromIntegral = naturalFromWord . fromIntegral Its type wasn't constrained to Int hence #19345.
* Fix example code in Deriving via. songzh2021-02-131-1/+1
|
* Fix a serious bug in roughMatchTcsSimon Peyton Jones2021-02-1311-71/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | The roughMatchTcs function enables a quick definitely-no-match test in lookupInstEnv. Unfortunately, it didn't account for type families. This didn't matter when type families were flattened away, but now they aren't flattened it matters a lot. The fix is very easy. See INVARIANT in GHC.Core.InstEnv Note [ClsInst laziness and the rough-match fields] Fixes #19336 The change makes compiler perf worse on two very-type-family-heavy benchmarks, T9872{a,d}: T9872a(normal) ghc/alloc 2172536442.7 2216337648.0 +2.0% T9872d(normal) ghc/alloc 614584024.0 621081384.0 +1.1% (Everything else is 0.0% or at most 0.1%.) I think we just have to put up with this. Some cases were being wrongly filtered out by roughMatchTcs that might actually match, which could lead to false apartness checks. And it only affects these very type-family-heavy cases. Metric Increase: T9872a T9872d
* Remove deprecated -XGenerics and -XMonoPatBindsKrzysztof Gogolewski2021-02-138-31/+4
| | | | | They have no effect since 2011 (GHC 7.2/7.4), commits cb698570b2b and 49dbe60558.
* Add tests for solved arrow tickets #5777 #15175Krzysztof Gogolewski2021-02-133-0/+79
| | | | | | | Merge requests !4464 and !4474 fixed the Lint problems. Closes #5777. Closes #15175.
* Remove Data.Semigroup.OptionSimon Jakobi2021-02-134-88/+2
| | | | | | Bumps the binary and deepseq submodules. Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/15028.
* closeFd: improve documentationMarcin Szamotulski2021-02-131-4/+5
| | | | | | | I think it is worth to say that closeFd is interruptible by asynchronous exceptions. And also fix indentation of closeFd_.
* Make closeFdWith uninterrupitbleMarcin Szamotulski2021-02-131-2/+5
| | | | | | | | | | | | | closeFdWith is accessing shared TMVar - the IO manager callbak table var. It might be concurrently used by different threads: either becuase it contains information about different file descriptors or a single file descriptor is accessed from different threads. For this reason `takeMVar` might block, although for a very short time as all the IO operations are using epoll (or its equivalent). This change makes hClose and Network.Socket.close safe in presence of asynchronous exceptions. This is especailly important in the context of `bracket` which expects uninterruptible close handler.
* GHCi :complete command for operators: Fix spaceless cases of #10576.Roland Senn2021-02-133-7/+14
| | | | | | | When separating operators from identifiers in a `:complete` command take advantage from the different character sets of the two items: * operators contain only specialSymbol characters. * Identifiers don't contain specialSymbol characters, with the exception of dots.
* Always set `safeInferred`, not only when it turns `False`Joachim Breitner2021-02-135-4/+17
| | | | | | | | | | | | | | | previously, `safeFlagCheck` would be happy to switch the `safeFlag` to `False`, but not the other way around. This meant that after :set -XGeneralizedNewtypeDeriving :set -XNoGeneralizedNewtypeDeriving in GHCi all loaded files would be still be infered as unsafe. This fixes #19243. This is a corner case, but somewhat relevant once ghci by default starts with `GeneralizedNewtypeDeriving` on (due to GHC2021).
* Apply 1 suggestion(s) to 1 file(s)Marcin Szamotulski2021-02-131-7/+15
|
* Improve bracket documentationMarcin Szamotulski2021-02-131-0/+8
|
* Refactor LoggerSylvain Henry2021-02-1388-1543/+1901
| | | | | | | | | | | | | | | | | | | | | Before this patch, the only way to override GHC's default logging behavior was to set `log_action`, `dump_action` and `trace_action` fields in DynFlags. This patch introduces a new Logger abstraction and stores it in HscEnv instead. This is part of #17957 (avoid storing state in DynFlags). DynFlags are duplicated and updated per-module (because of OPTIONS_GHC pragma), so we shouldn't store global state in them. This patch also fixes a race in parallel "--make" mode which updated the `generatedDumps` IORef concurrently. Bump haddock submodule The increase in MultilayerModules is tracked in #19293. Metric Increase: MultiLayerModules
* Add -Wsafe to flags not enabled by -WallFendor2021-02-101-0/+1
|