summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Parse symbolic names in ANN type correctly with otyconwip/T19374Ryan Scott2021-02-158-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
* 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
|
* Fix example code of "Making a Haskell library that can be called from ↵Masahiro Sakai2021-02-101-2/+2
| | | | | | | foreign code" section "+RTS" in argv[0] is interpreted as a program name and does not work as an indicator of RTS options.
* Fix a long standing bug in constraint solvingSimon Peyton Jones2021-02-095-20/+121
| | | | | | | | | | | | | | | | When combining Inert: [W] C ty1 ty2 Work item: [D] C ty1 ty2 we were simply discarding the Derived one. Not good! We should turn the inert back into [WD] or keep both. E.g. fundeps work only on Derived (see isImprovable). This little patch fixes it. The bug is hard to tickle, but #19315 did so. The fix is a little messy (see Note [KeepBoth] plus the change in addDictCt), but I am disinclined to refine it further because it'll all be swept away when we Kill Deriveds.
* Fix pretty-printing of invisible arguments for FUN 'Many (#19310)Krzysztof Gogolewski2021-02-094-2/+12
|
* Reduce inlining in deeply-nested casesSimon Peyton Jones2021-02-0915-45/+399
| | | | | | | | | | | | This adds a new heuristic, controllable via two new flags to better tune inlining behaviour. The new flags are -funfolding-case-threshold and -funfolding-case-scaling which are document both in the user guide and in Note [Avoid inlining into deeply nested cases]. Co-authored-by: Andreas Klebinger <klebinger.andreas@gmx.at>
* Bump Haddock submodulewip/bump-haddockBen Gamari2021-02-061-0/+0
| | | | Merged ghc-8.10 into ghc-head.
* Fix typosBrian Wignall2021-02-0685-113/+113
|
* base: Fix since-annotation for Data.List.singletonSimon Jakobi2021-02-061-1/+1
|
* Add a test for #18736Krzysztof Gogolewski2021-02-062-0/+8
| | | | | | | Commit 65721691ce9c (Improve inference with linear types, !4632) fixed the bug. Closes #18736.
* Make pattern synonyms play with CallStackSimon Peyton Jones2021-02-064-2/+63
| | | | | | | | This small patch makes pattern synonyms play nicely with CallStack constraints, using logic explained in GHC.Tc.Gen.Pat Note [Call-stack tracing of pattern synonyms] Fixes #19289
* Make unsafeDupablePerformIO have a lazy demandAndreas Klebinger2021-02-062-35/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | When a user writes code like: unsafePerformIO $ do let x = f x writeIORef ref x return x We might expect that the write happens before we evaluate `f x`. Sadly this wasn't to case for reasons detailed in #19181. We fix this by avoiding the strict demand by turning: unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a into unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> lazy a This makes the above code lazy in x. And ensures the side effect of the write happens before the evaluation of `f x`. If a user *wants* the code to be strict on the returned value he can simply use `return $! x`. This fixes #19181
* Fix buglet in expandSynTyCon_maybeSimon Peyton Jones2021-02-064-5/+13
| | | | | | | | | | The fix for #17958, implemented in MR !2952, introduced a small bug in GHC.Core.TyCon.expandSynTyCon_maybe, in the case of under-saturated type synonyms. This MR fixes the bug, very easy. Fixes #19279
* The Char kind (#11342)Daniel Rogozin2021-02-0649-131/+666
| | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Rinat Stryungis <rinat.stryungis@serokell.io> Implement GHC Proposal #387 * Parse char literals 'x' at the type level * New built-in type families CmpChar, ConsSymbol, UnconsSymbol * New KnownChar class (cf. KnownSymbol and KnownNat) * New SomeChar type (cf. SomeSymbol and SomeNat) * CharTyLit support in template-haskell Updated submodules: binary, haddock. Metric Decrease: T5205 haddock.base Metric Increase: Naperian T13035
* Fix typo in qualified_do.rstBasile Henry2021-02-051-1/+1
|
* validate: Enable tarball autodownload by default.Andreas Klebinger2021-02-051-1/+1
| | | | Fixes #19307
* rts: Fix arguments for foreign calls of interpreterStefan Schulze Frielinghaus2021-02-051-2/+24
| | | | | | | | | | | Function arguments passed to the interpreter are extended to whole words. However, foreign function interface expects correctly typed argument pointers. Accordingly, we have to adjust argument pointers in case of a big-endian architecture. In contrast to function arguments where subwords are passed in the low bytes of a word, the return value is expected to reside in the high bytes of a word.
* Mark both parameters of SimplM one-shot (#19302)Sebastian Graf2021-02-051-2/+7
| | | | | | | Just marking the `SimplTopEnv` parameter as one-shot was not enough to eta-expand `simplExpr`. Fixes #19302.
* FFI: Revisit fix pass small ints in foreign call wrappersStefan Schulze Frielinghaus2021-02-051-26/+5
| | | | | | | Since commit be5d74ca small ints/words are passed according to their natural size which obsoletes fix from commit 01f7052cc1. Reverted 01f7052cc1 but kept the introduced test case.
* IntVar: fix allocation sizeSylvain Henry2021-02-052-3/+6
| | | | | | As found by @phadej in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4740/diffs#note_327510 Also fix FastMutInt which allocating the size in bits instead of bytes.
* rts: Use properly sized pointers in e.g. rts_mkInt8Stefan Schulze Frielinghaus2021-02-051-26/+20
| | | | | | | Since commit be5d74caab the payload of a closure of Int<N> or Word<N> is not extended anymore to the machines word size. Instead, only the first N bits of a payload are written. This patch ensures that only those bits are read/written independent of the machines endianness.
* Try eta expanding FCode (See #18202)Andreas Klebinger2021-02-052-2/+33
| | | | | | | | | Also updates the note with the case of multi-argument lambdas. Seems slightly beneficial based on the Cabal test: -O0: -1MB allocations (out of 50GB) -O : -1MB allocations (out of ~200GB)