summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* testsuite: Normalise slasheswip/az/exactprintGHC GitLab CI2021-03-182-2/+3
| | | | In the `comments` and `literals` tests, since they contain file paths.
* check-ppr,check-exact: Write out result as binaryGHC GitLab CI2021-03-182-8/+19
| | | | | | | | | | | Previously we would use `writeFile` to write the intermediate files to check for round-tripping. However, this will open the output handle as a text handle, which on Windows will change line endings. Avoid this by opening as binary. Explicitly use utf8 encoding. This is for tests only, do not need to worry about user compatibility.
* GHC Exactprint main commitAlan Zimmerman2021-03-18369-10092/+23718
| | | | | | | | Metric Increase: T10370 parsing001 Updates haddock submodule
* Add the main types to be used for exactprint in the GHC ASTAlan Zimmerman2021-03-181-64/+964
| | | | | | | | | | | | | | | The MR introducing the API Annotations, !2418 is huge. Conceptually it is two parts, the one deals with introducing the new types to be used for annotations, and outlining how they will be used. This is a small change, localised to compiler/GHC/Parser/Annotation.hs and is contained in this commit. The follow-up, larger commit deals with mechanically working this through the entire AST and updating all the parts affected by it. It is being split so the part that needs good review feedback can be seen in isolation, prior to the rest coming in.
* Built-in type families: CharToNat, NatToChar (#19535)Vladislav Zavialov2021-03-178-31/+191
| | | | | Co-authored-by: Daniel Rogozin <daniel.rogozin@serokell.io> Co-authored-by: Rinat Stryungis <rinat.stryungis@serokell.io>
* Document how GADT patterns are matched from left-to-right, outside-inRyan Scott2021-03-171-1/+82
| | | | | | | | | | | | | | This adds some bullet points to the GHC User's Guide section on `GADTs` to explain some subtleties in how GHC typechecks GADT patterns. In particular, this adds examples of programs being rejected for matching on GADTs in a way that does not mesh with GHC's left-to-right, outside-in order for checking patterns, which can result in programs being rejected for seemingly counterintuitive reasons. (See #12018 for examples of confusion that arose from this.) In addition, now that we have visible type application in data constructor patterns, I mention a possible workaround of using `TypeApplications` to repair programs of this sort. Resolves #12018.
* Disable bogus assertion (#19489)Sylvain Henry2021-03-171-2/+15
|
* CmmtoAsm.Reg.Linear: Rewrite processBen Gamari2021-03-171-33/+29
| | | | | | CmmToAsm.Reg.Linear: More strictness More strictness
* CmmToAsm.Reg.Linear: Make linearRA body a join pointBen Gamari2021-03-171-19/+17
| | | | Avoid top-level recursion.
* Eliminate selector thunk allocationsBen Gamari2021-03-171-1/+1
|
* IfaceToType: Ensure that IfaceTyConInfo is sharedBen Gamari2021-03-173-9/+18
| | | | | | | | | | | | | | | | In #19194 mpickering detailed that there are a LOT of allocations of IfaceTyConInfo: There are just two main cases: IfaceTyConInfo IsPromoted IfaceNormalTyCon and IfaceTyConInfo NotPromoted IfaceNormalTyCon. These should be made into CAFs and shared. From my analysis, the most common case is IfaceTyConInfo NotPromoted IfaceNormalTyCon (53 000) then IfaceTyConInfo IsPromoted IfaceNormalTyCon (28 000). This patch makes it so these are properly shared by using a smart constructor. Fixes #19194.
* Enhance pass result forcingSylvain Henry2021-03-172-4/+13
| | | | | | | | When we use `withTiming` we need to force the results of each timed pass to better represent the time spent in each phase. This patch forces some results that weren't before. It also retrieve timings for the CoreToStg and WriteIface passes.
* llvmGen: Accept range of LLVM versionsBen Gamari2021-03-1710-36/+245
| | | | | | | Previously we would support only one LLVM major version. Here we generalize this to accept a range, taking this range to be LLVM 10 to 11, as 11 is necessary for Apple M1 support. We also accept 12, as that is what apple ships with BigSur on the M1.
* fromInteger :: Integer -> {Float,Double} now always round to nearest evenARATA Mizuki2021-03-175-32/+65
| | | | | | | | integerToFloat# and integerToDouble# were moved from ghc-bignum to base. GHC.Integer.floatFromInteger and doubleFromInteger were removed. Fixes #15926, #17231, #17782
* Add a test for fromInteger :: Integer -> Float/Double (#15926, #17231, #17782)ARATA Mizuki2021-03-173-0/+85
|
* [ci] don't make marge double build.wip/angerman/fix-18744Moritz Angermann2021-03-171-1/+0
| | | | This fixes !18744
* Make the CI jobs interruptibleHécate Moonlight2021-03-171-0/+2
| | | | closes #19362
* [ci] Skip test's on windows that often fail in CI.wip/angerman/stable-windowsMoritz Angermann2021-03-162-2/+10
|
* Test chained record construction/update/accessVladislav Zavialov2021-03-153-0/+18
| | | | | | | | | | | According to the proposal, we have the following equivalence: e{lbl1 = val1}.val2 == (e{lbl1 = val1}).val2 This is a matter of parsing. Record construction/update must have the same precedence as dot access. Add a test case to ensure this.
* Fix record dot precedence (#19521)Vladislav Zavialov2021-03-154-21/+20
| | | | | By moving the handling of TIGHT_INFIX_PROJ to the correct place, we can remove the isGetField hack and fix a bug at the same time.
* Document the interaction between ScopedTypeVariables and ↵Ryan Scott2021-03-151-0/+31
| | | | | | | | | StandaloneKindSignatures This documents a limitation of `StandaloneKindSignatures`—namely, that it does not bring type variables bound by an outermost `forall` into scope over a type-level declaration—in the GHC User's Guide. See #19498 for more discussion.
* Compute length only once in foldBalSylvain Henry2021-03-141-4/+11
|
* Write explicit IOEnv's Functor and MonadIO instances (#18202)Sylvain Henry2021-03-141-2/+8
|
* Make traceHeapEventInfo an init eventMatthew Pickering2021-03-141-6/+18
| | | | This means it will be reposted everytime the eventlog is started.
* Pmc: Consider Required Constraints when guessing PatSyn arg types (#19475)Sebastian Graf2021-03-148-130/+236
| | | | | | | | | | | | | | | | | | | | | | This patch makes `guessConLikeUnivTyArgsFromResTy` consider required Thetas of PatSynCons, by treating them as Wanted constraints to be discharged with the constraints from the Nabla's TyState and saying "does not match the match type" if the Wanted constraints are unsoluble. It calls out into a new function `GHC.Tc.Solver.tcCheckWanteds` to do so. In pushing the failure logic around call sites of `initTcDsForSolver` inside it by panicking, I realised that there was a bunch of dead code surrounding `pmTopMoraliseType`: I was successfully able to delete the `NoChange` data constructor of `TopNormaliseTypeResult`. The details are in `Note [Matching against a ConLike result type]` and `Note [Instantiating a ConLike]. The regression test is in `T19475`. It's pretty much a fork of `T14422` at the moment. Co-authored-by: Cale Gibbard <cgibbard@gmail.com>
* Correct module name in `-fprof-callers` documentationMatthew Pickering2021-03-141-1/+1
|
* Implement the UnliftedDatatypes extensionSebastian Graf2021-03-1439-163/+719
| | | | | | | | | | | | | | | | | | GHC Proposal: 0265-unlifted-datatypes.rst Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/265 Issues: https://gitlab.haskell.org/ghc/ghc/-/issues/19523 Implementation Details: Note [Implementation of UnliftedDatatypes] This patch introduces the `UnliftedDatatypes` extension. When this extension is enabled, GHC relaxes the restrictions around what result kinds are allowed in data declarations. This allows data types for which an unlifted or levity-polymorphic result kind is inferred. The most significant changes are in `GHC.Tc.TyCl`, where `Note [Implementation of UnliftedDatatypes]` describes the details of the implementation. Fixes #19523.
* Allow perf-nofib to failwip/angerman/fasterMoritz Angermann2021-03-141-0/+3
|
* Force eol=lf; to prevent windows breakage.Moritz Angermann2021-03-131-1/+1
|
* bump submodule nofibMoritz Angermann2021-03-131-0/+0
|
* Shorten the build pipelineMoritz Angermann2021-03-131-6/+3
|
* Update win32 submoduleTamar Christina2021-03-121-0/+0
|
* testsuite: Update Win32 test output for GHC2021GHC GitLab CI2021-03-115-28/+5
| | | | Fixes the Windows CI jobs. Requires update of the Win32 submodule.
* Ignore breakpoint for a specified number of iterations. (#19157)Roland Senn2021-03-1015-109/+281
| | | | | | | | | | | | | | | | * Implement new debugger command `:ignore` to set an `ignore count` for a specified breakpoint. * Allow new optional parameter on `:continue` command to set an `ignore count` for the current breakpoint. * In the Interpreter replace the current `Word8` BreakArray with an `Int` array. * Change semantics of values in `BreakArray` to: n < 0 : Breakpoint is disabled. n == 0 : Breakpoint is enabled. n > 0 : Breakpoint is enabled, but ignore next `n` iterations. * Rewrite `:enable`/`:disable` processing as a special case of `:ignore`. * Remove references to `BreakArray` from `ghc/UI.hs`.
* Use GHC2021 as default languageJoachim Breitner2021-03-10855-1246/+1774
|
* Introduce GHC2021 languageJoachim Breitner2021-03-106-25/+144
| | | | | | This adds support for -XGHC2021, as described in Proposal 0380 [1]. [1] https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0380-ghc2021.rst
* template-haskell: Add putDoc, getDoc, withDecDoc and friendsLuke Lau2021-03-1032-52/+968
| | | | | | | | | | | | | | | | | | | | | | | This adds two new methods to the Quasi class, putDoc and getDoc. They allow Haddock documentation to be added to declarations, module headers, function arguments and class/type family instances, as well as looked up. It works by building up a map of names to attach pieces of documentation to, which are then added in the extractDocs function in GHC.HsToCore.Docs. However because these template haskell names need to be resolved to GHC names at the time they are added, putDoc cannot directly add documentation to declarations that are currently being spliced. To remedy this, withDecDoc/withDecsDoc wraps the operation with addModFinalizer, and provides a more ergonomic interface for doing so. Similarly, the funD_doc, dataD_doc etc. combinators provide a more ergonomic interface for documenting functions and their arguments simultaneously. This also changes ArgDocMap to use an IntMap rather than an Map Int, for efficiency. Part of the work towards #5467
* Bump bytestring submodule to 0.11.1.0Ben Gamari2021-03-1018-16/+20
|
* FastString: Use FastMutInt instead of IORef IntBen Gamari2021-03-101-12/+13
| | | | This saves at least one I# allocation per FastString.
* FastMutInt: Introduce atomicFetchAddFastMutIntBen Gamari2021-03-101-7/+13
| | | | This will be needed by FastString.
* FastMutInt: Ensure that newFastMutInt initializes valueBen Gamari2021-03-107-38/+31
| | | | Updates haddock submodule.
* FastMutInt: Drop FastMutPtrBen Gamari2021-03-101-25/+1
| | | | This appears to be unused.
* Simplify shadowing of DuplicateRecordFields in GHCi (fixes #19314)Adam Gundry2021-03-108-40/+51
| | | | | | | Previously, defining fields with DuplicateRecordFields in GHCi lead to strange shadowing behaviour, whereby fields would (accidentally) not shadow other fields. This simplifies things so that fields are shadowed in the same way whether or not DuplicateRecordFields is enabled.
* Do not remove shadowed record selectors from interactive context (fixes #19322)Adam Gundry2021-03-104-1/+11
|
* rts: Gradually return retained memory to the OSMatthew Pickering2021-03-1010-20/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to #19381 #19359 #14702 After a spike in memory usage we have been conservative about returning allocated blocks to the OS in case we are still allocating a lot and would end up just reallocating them. The result of this was that up to 4 * live_bytes of blocks would be retained once they were allocated even if memory usage ended up a lot lower. For a heap of size ~1.5G, this would result in OS memory reporting 6G which is both misleading and worrying for users. In long-lived server applications this results in consistent high memory usage when the live data size is much more reasonable (for example ghcide) Therefore we have a new (2021) strategy which starts by retaining up to 4 * live_bytes of blocks before gradually returning uneeded memory back to the OS on subsequent major GCs which are NOT caused by a heap overflow. Each major GC which is NOT caused by heap overflow increases the consec_idle_gcs counter and the amount of memory which is retained is inversely proportional to this number. By default the excess memory retained is oldGenFactor (controlled by -F) / 2 ^ (consec_idle_gcs * returnDecayFactor) On a major GC caused by a heap overflow, the `consec_idle_gcs` variable is reset to 0 (as we could continue to allocate more, so retaining all the memory might make sense). Therefore setting bigger values for `-Fd` makes the rate at which memory is returned slower. Smaller values make it get returned faster. Setting `-Fd0` disables the memory return completely, which is the behaviour of older GHC versions. The default is `-Fd4` which results in the following scaling: > mapM print [(x, 1/ (2**(x / 4))) | x <- [1 :: Double ..20]] (1.0,0.8408964152537146) (2.0,0.7071067811865475) (3.0,0.5946035575013605) (4.0,0.5) (5.0,0.4204482076268573) (6.0,0.35355339059327373) (7.0,0.29730177875068026) (8.0,0.25) (9.0,0.21022410381342865) (10.0,0.17677669529663687) (11.0,0.14865088937534013) (12.0,0.125) (13.0,0.10511205190671433) (14.0,8.838834764831843e-2) (15.0,7.432544468767006e-2) (16.0,6.25e-2) (17.0,5.255602595335716e-2) (18.0,4.4194173824159216e-2) (19.0,3.716272234383503e-2) (20.0,3.125e-2) So after 13 consecutive GCs only 0.1 of the maximum memory used will be retained. Further to this decay factor, the amount of memory we attempt to retain is also influenced by the GC strategy for the oldest generation. If we are using a copying strategy then we will need at least 2 * live_bytes for copying to take place, so we always keep that much. If using compacting or nonmoving then we need a lower number, so we just retain at least `1.2 * live_bytes` for some protection. In future we might want to make this behaviour more aggressive, some relevant literature is > Ulan Degenbaev, Jochen Eisinger, Manfred Ernst, Ross McIlroy, and Hannes Payer. 2016. Idle time garbage collection scheduling. SIGPLAN Not. 51, 6 (June 2016), 570–583. DOI:https://doi.org/10.1145/2980983.2908106 which describes the "memory reducer" in the V8 javascript engine which on an idle collection immediately returns as much memory as possible.
* Location for tuple section pattern error (#19504)Vladislav Zavialov2021-03-094-1/+9
| | | | | This fixes a regression that led to loss of location information in error messages about the use of tuple sections in patterns.
* Fix some warnings when bootstrapping with GHC 9.0Ryan Scott2021-03-096-6/+6
| | | | | | | | | | | This fixes two classes of warnings that appear when bootstrapping with GHC 9.0: * `ghc-boot.cabal` was using `cabal-version: >=1.22`, which `cabal-install-3.4` now warns about, instead recommending the use of `cabal-version: 1.22`. * Several pattern matches were producing `Pattern match(es) are non-exhaustive` because of incorrect CPP. The pattern-match coverage checker _did_ become smarter in GHC 9.1, however, so I ended up needing to keep the CPP, adjusting them to use `#if __GLASGOW_HASKELL__ < 901` instead.
* Fixes to dealing with the export of mainSimon Peyton Jones2021-03-0947-399/+520
| | | | | | | | | | | | | | | | | | | | It's surprisingly tricky to deal with 'main' (#19397). This patch does quite bit of refactoring do to it right. Well, more-right anyway! The moving parts are documented in GHC.Tc.Module Note [Dealing with main] Some other oddments: * Rename tcRnExports to rnExports; no typechecking here! * rnExports now uses checkNoErrs rather than failIfErrsM; the former fails only if rnExports itself finds errors * Small improvements to tcTyThingCategory, which ultimately weren't important to the patch, but I've retained as a minor improvement.
* Replace Ord TyLit with nonDetCmpTyLit (#19441)Vladislav Zavialov2021-03-092-11/+21
| | | | | | The Ord instance was non-deterministic, but it's easy assume that it is deterministic. In fact, haddock-api used to do exactly that before haddock/7e8c7c3491f3e769368b8e6c767c62a33e996c80
* Add a distclean command to hadrian.Andreas Klebinger2021-03-092-3/+13
| | | | | | | | | Hadrian should behave well and not delete files created by configure with the clean command. With this patch hadrian now deletes the fs/mingw tarballs only with distclean. This fixes #19320. The main impact being that validate won't have to redownload the tarballs when re-run.