summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* RTS: Zero gc_cpu_start and gc_cpu_end after accountingMatthew Pickering2022-03-291-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | When passed a combination of `-N` and `-qn` options the cpu time for garbage collection was being vastly overcounted because the counters were not being zeroed appropiately. When -qn1 is passed, only 1 of the N avaiable GC threads is chosen to perform work, the rest are idle. At the end of the GC period, stat_endGC traverses all the GC threads and adds up the elapsed time from each of them. For threads which didn't participate in this GC, the value of the cpu time should be zero, but before this patch, the counters were not zeroed and hence we would count the same elapsed time on many subsequent iterations (until the thread participated in a GC again). The most direct way to zero these fields is to do so immediately after the value is added into the global counter, after which point they are never used again. We also tried another approach where we would zero the counter in yieldCapability but there are some (undiagnosed) siations where a capbility would not pass through yieldCapability before the GC ended and the same double counting problem would occur. Fixes #21082
* Hadrian: make DDEBUG separate from debugged RTSsheaf2022-03-298-36/+46
| | | | | | | | | | | This patchs separates whether -DDEBUG is enabled (i.e. whether debug assertions are enabled) from whether we are using the debugged RTS (i.e. GhcDebugged = YES). This means that we properly skip tests which have been marked with `when(compiler_debugged(), skip)`. Fixes #21113, #21153 and #21234
* hadrian: Build lib:GHC with -haddock and -Winvalid-haddock (#21273)Zubin Duggal2022-03-291-0/+3
|
* Fix all invalid haddock comments in the compilerZubin Duggal2022-03-2941-154/+154
| | | | Fixes #20935 and #20924
* Consistently attach SrcSpans to sub-expressions in TH splicesRyan Scott2022-03-281-139/+173
| | | | | | | | | | | Before, `GHC.ThToHs` was very inconsistent about where various sub-expressions would get the same `SrcSpan` from the original TH splice location or just a generic `noLoc` `SrcSpan`. I have ripped out all uses of `noLoc` in favor of the former instead, and I have added a `Note [Source locations within TH splices]` to officially enshrine this design choice. Fixes #21299.
* EPA: let stmt with semicolon has wrong anchorAlan Zimmerman2022-03-286-3/+25
| | | | | | | | | | | | | The code let ;x =1 Captures the semicolon annotation, but did not widen the anchor in the ValBinds. Fix that. Closes #20247
* hadrian: Add show target to bindist makefileMatthew Pickering2022-03-281-0/+4
| | | | | | | | | | | Some build systems use "make show" to query facts about the bindist, for example: ``` make show VALUE=ProjectVersion > version ``` to determine the ProjectVersion
* Hadrian: allow testsuite to run with cross-compilers (#21292)Sylvain Henry2022-03-281-1/+3
|
* users-guide: group ticky-ticky profiling under one headingAdam Sandberg Ericsson2022-03-281-5/+5
|
* Document typed splices inhibiting unused bind detection (#16524)jberryman2022-03-281-0/+3
|
* Add Red Herring to Note [What might equal later?]Richard Eisenberg2022-03-285-87/+149
| | | | Close #21208.
* Disable text's dependency on simdutf by defaultBen Gamari2022-03-282-0/+12
| | | | | | | Unfortunately we are simply not currently in a good position to robustly ship binary distributions which link against C++ code like simdutf. Fixes #20724.
* hadrian: Flag cabal flag handlingMatthew Pickering2022-03-281-10/+5
| | | | | | | | | | | | | | | This patch basically deletes some ad-hoc handling of Cabal Flags and replaces it with a correct query of the LocalBuildInfo. The flags in the local build info can be modified by users by passing hadrian options For example (!4331) ``` *.genapply.cabal.configure.opts += --flags=unregisterised ``` And all the flags specified by the `Cabal Flags` builder were already passed to configure properly using `--flags`.
* users-guide: Correct markdown for profilingTakenobu Tani2022-03-281-5/+6
| | | | | | This patch corrects some markdown. [skip ci]
* Modularize Tidy (#17957)Sylvain Henry2022-03-257-250/+328
| | | | | | | | - Factorize Tidy options into TidyOpts datatype. Initialize it in GHC.Driver.Config.Tidy - Same thing for StaticPtrOpts - Perform lookups of unpackCString[Utf8]# once in initStaticPtrOpts instead of for every use of mkStringExprWithFS
* Make -ddump-rn-ast and -ddump-tc-ast work in GHCiMatthew Pickering2022-03-254-1/+365
| | | | Fixes #17830
* Add instance Lift ByteArrayBodigrim2022-03-255-1/+72
|
* Add the OPAQUE pragmaChristiaan Baaij2022-03-2552-21/+1342
| | | | | | | | | | | | A new pragma, `OPAQUE`, that ensures that every call of a named function annotated with an `OPAQUE` pragma remains a call of that named function, not some name-mangled variant. Implements GHC proposal 0415: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0415-opaque-pragma.rst This commit also updates the haddock submodule to handle the newly introduced lexer tokens corresponding to the OPAQUE pragma.
* ci: Generate jobs for all normal builds and use hadrian for all buildsMatthew Pickering2022-03-245-878/+4601
| | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new script (.gitlab/gen_ci.hs) which generates a yaml file (.gitlab/jobs.yaml) which contains explicit descriptions for all the jobs we want to run. The jobs are separated into three categories: * validate - jobs run on every MR * nightly - jobs run once per day on the master branch * release - jobs for producing release artifacts The generation script is a Haskell program which includes a DSL for specifying the different jobs. The hope is that it's easier to reason about the different jobs and how the variables are merged together rather than the unclear and opaque yaml syntax. The goal is to fix issues like #21190 once and for all.. The `.gitlab/jobs.yaml` can be generated by running the `.gitlab/generate_jobs` script. You have to do this manually. Another consequence of this patch is that we use hadrian for all the validate, nightly and release builds on all platforms.
* testsuite: Remove library dependenices from T21119Matthew Pickering2022-03-243-13/+45
| | | | | | | These dependencies would affect the demand signature depending on various rules and so on. Fixes #21271
* hadrian: Correct generation of hsc2hs wrapperMatthew Pickering2022-03-241-1/+1
| | | | | | | | | | | | | | | | | If you inspect the inside of a wrapper script for hsc2hs you will see that the cflag and lflag values are concatenated incorrectly. ``` HSC2HS_EXTRA="--cflag=-U__i686--lflag=-fuse-ld=gold" ``` It should instead be ``` HSC2HS_EXTRA="--cflag=-U__i686 --lflag=-fuse-ld=gold" ``` Fixes #21221
* Add check to ensure we are not building validate jobs for releasesMatthew Pickering2022-03-241-0/+21
|
* Add test for T21035Matthew Pickering2022-03-247-0/+117
| | | | | | | | This test checks that you are allowed to explicitly supply object files for dependencies even if you haven't got the shared object for that library yet. Fixes #21035
* WorkWrap: Handle partial FUN apps in `isRecDataCon` (#21265)Sebastian Graf2022-03-244-93/+90
| | | | | | | | | | | | Partial FUN apps like `(->) Bool` aren't detected by `splitFunTy_maybe`. A silly oversight that is easily fixed by replacing `splitFunTy_maybe` with a guard in the `splitTyConApp_maybe` case. But fortunately, Simon nudged me into rewriting the whole `isRecDataCon` function in a way that makes it much shorter and hence clearer which DataCons are actually considered as recursive. Fixes #21265.
* Fix and simplify DeriveAnyClass's context inference using SubTypePredSpecRyan Scott2022-03-248-275/+511
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As explained in `Note [Gathering and simplifying constraints for DeriveAnyClass]` in `GHC.Tc.Deriv.Infer`, `DeriveAnyClass` infers instance contexts by emitting implication constraints. Previously, these implication constraints were constructed by hand. This is a terribly trick thing to get right, as it involves a delicate interplay of skolemisation, metavariable instantiation, and `TcLevel` bumping. Despite much effort, we discovered in #20719 that the implementation was subtly incorrect, leading to valid programs being rejected. While we could scrutinize the code that manually constructs implication constraints and repair it, there is a better, less error-prone way to do things. After all, the heart of `DeriveAnyClass` is generating code which fills in each class method with defaults, e.g., `foo = $gdm_foo`. Typechecking this sort of code is tantamount to calling `tcSubTypeSigma`, as we much ensure that the type of `$gdm_foo` is a subtype of (i.e., more polymorphic than) the type of `foo`. As an added bonus, `tcSubTypeSigma` is a battle-tested function that handles skolemisation, metvariable instantiation, `TcLevel` bumping, and all other means of tricky bookkeeping correctly. With this insight, the solution to the problems uncovered in #20719 is simple: use `tcSubTypeSigma` to check if `$gdm_foo`'s type is a subtype of `foo`'s type. As a side effect, `tcSubTypeSigma` will emit exactly the implication constraint that we were attempting to construct by hand previously. Moreover, it does so correctly, fixing #20719 as a consequence. This patch implements the solution thusly: * The `PredSpec` data type (previously named `PredOrigin`) is now split into `SimplePredSpec`, which directly stores a `PredType`, and `SubTypePredSpec`, which stores the actual and expected types in a subtype check. `SubTypePredSpec` is only used for `DeriveAnyClass`; all other deriving strategies use `SimplePredSpec`. * Because `tcSubTypeSigma` manages the finer details of type variable instantiation and constraint solving under the hood, there is no longer any need to delicately split apart the method type signatures in `inferConstraintsAnyclass`. This greatly simplifies the implementation of `inferConstraintsAnyclass` and obviates the need to store skolems, metavariables, or given constraints in a `ThetaSpec` (previously named `ThetaOrigin`). As a bonus, this means that `ThetaSpec` now simply becomes a synonym for a list of `PredSpec`s, which is conceptually much simpler than it was before. * In `simplifyDeriv`, each `SubTypePredSpec` results in a call to `tcSubTypeSigma`. This is only performed for its side effect of emitting an implication constraint, which is fed to the rest of the constraint solving machinery in `simplifyDeriv`. I have updated `Note [Gathering and simplifying constraints for DeriveAnyClass]` to explain this in more detail. To make the changes in `simplifyDeriv` more manageable, I also performed some auxiliary refactoring: * Previously, every iteration of `simplifyDeriv` was skolemising the type variables at the start, simplifying, and then performing a reverse substitution at the end to un-skolemise the type variables. This is not necessary, however, since we can just as well skolemise once at the beginning of the `deriving` pipeline and zonk the `TcTyVar`s after `simplifyDeriv` is finished. This patch does just that, having been made possible by prior work in !7613. I have updated `Note [Overlap and deriving]` in `GHC.Tc.Deriv.Infer` to explain this, and I have also left comments on the relevant data structures (e.g., `DerivEnv` and `DerivSpec`) to explain when things might be `TcTyVar`s or `TyVar`s. * All of the aforementioned cleanup allowed me to remove an ad hoc deriving-related in `checkImplicationInvariants`, as all of the skolems in a `tcSubTypeSigma`–produced implication constraint should now be `TcTyVar` at the time the implication is created. * Since `simplifyDeriv` now needs a `SkolemInfo` and `UserTypeCtxt`, I have added `ds_skol_info` and `ds_user_ctxt` fields to `DerivSpec` to store these. Similarly, I have also added a `denv_skol_info` field to `DerivEnv`, which ultimately gets used to initialize the `ds_skol_info` in a `DerivSpec`. Fixes #20719.
* Define filterOut with filterSylvain Henry2022-03-231-3/+1
| | | | filter has fusion rules that filterOut lacks
* Reverse dependency between StgToCmm and Runtime.Heap.LayoutSylvain Henry2022-03-233-43/+42
|
* Avoid redundant imports of GHC.Driver.SessionSylvain Henry2022-03-236-9/+2
| | | | | | Remove GHC.Driver.Session imports that weren't considered as redundant because of the reexport of PlatformConstants. Also remove this reexport as modules using this datatype should import GHC.Platform instead.
* rts: Don't mark object code in markCAFs unless necessaryBen Gamari2022-03-231-2/+4
| | | | | | | | Previously `markCAFs` would call `markObjectCode` even in non-major GCs. This is problematic since `prepareUnloadCheck` is not called in such GCs, meaning that the section index has not been updated. Fixes #21254
* rts: Untag function field in scavenge_PAP_payloadBen Gamari2022-03-231-1/+2
| | | | | | | | Previously we failed to untag the function closure when scavenging the payload of a PAP, resulting in an invalid closure pointer being passed to scavenge_large_bitmap and consequently #21254. Fix this. Fixes #21254
* Improve error message when warning about unsupported LLVM version (#20958)Zubin Duggal2022-03-231-1/+1
| | | | Change the wording to make it clear that the upper bound is non-inclusive.
* rts/adjustor: Place adjustor templates in data section on all OSsBen Gamari2022-03-231-2/+2
| | | | | | | | | | In !7604 we started placing adjustor templates in the data section on Linux as some toolchains there reject relocations in the text section. However, it turns out that OpenBSD also exhibits this restriction. Fix this by *always* placing adjustor templates in the data section. Fixes #21155.
* Fix behaviour of -Wunused-packages in ghciMatthew Pickering2022-03-239-41/+83
| | | | | | | | | | | | | | | | | Ticket #21110 points out that -Wunused-packages behaves a bit unusually in GHCi. Now we define the semantics for -Wunused-packages in interactive mode as follows: * If you use -Wunused-packages on an initial load then the warning is reported. * If you explicitly set -Wunused-packages on the command line then the warning is displayed (until it is disabled) * If you then subsequently modify the set of available targets by using :load or :cd (:cd unloads everything) then the warning is (silently) turned off. This means that every :r the warning is printed if it's turned on (but you did ask for it). Fixes #21110
* docs: clarify the eventlog format documentation a little bitAdam Sandberg Ericsson2022-03-231-14/+15
|
* configure: bump LlvmMaxVersion to 14Cheng Shao2022-03-231-1/+1
| | | | | LLVM 13.0.0 is released in Oct 2021, and latest head validates against LLVM 13 just fine if LlvmMaxVersion is bumped.
* hi haddock: Lex and store haddock docs in interface filesZubin Duggal2022-03-23139-1005/+8267
| | | | | | | | | | | | | | | | | | Names appearing in Haddock docstrings are lexed and renamed like any other names appearing in the AST. We currently rename names irrespective of the namespace, so both type and constructor names corresponding to an identifier will appear in the docstring. Haddock will select a given name as the link destination based on its own heuristics. This patch also restricts the limitation of `-haddock` being incompatible with `Opt_KeepRawTokenStream`. The export and documenation structure is now computed in GHC and serialised in .hi files. This can be used by haddock to directly generate doc pages without reparsing or renaming the source. At the moment the operation of haddock is not modified, that's left to a future patch. Updates the haddock submodule with the minimum changes needed.
* Avoid some SOURCE importsSylvain Henry2022-03-203-3/+2
|
* Revamp derived Eq instance code generation (#17240)nineonine2022-03-205-61/+132
| | | | | | | | | | | | | This patch improves code generation for derived Eq instances. The idea is to use 'dataToTag' to evaluate both arguments. This allows to 'short-circuit' when tags do not match. Unfortunately, inner evals are still present when we branch on tags. This is due to the way 'dataToTag#' primop evaluates its argument in the code generator. #21207 was created to explore further optimizations. Metric Decrease: LargeRecord
* Remove dead code HsDoRnromes2022-03-192-6/+0
|
* Compact regions: Maintain tags properlyAndreas Klebinger2022-03-191-2/+2
| | | | Fixes #21251
* List GHC.Event.Internal in base.cabal on Windowssheaf2022-03-191-13/+7
| | | | | | | GHC.Event.Internal was not listed in base.cabal on Windows. This caused undefined reference errors. This patch adds it back, by moving it out of the OS-specific logic in base.cabal. Fixes #21245.
* TH: Fix pretty printing of newtypes with operators and GADT syntax (#20868)Zubin Duggal2022-03-196-29/+43
| | | | | | | | The pretty printer for regular data types already accounted for these, and had some duplication with the newtype pretty printer. Factoring the logic out into a common function and using it for both newtypes and data declarations is enough to fix the bug.
* testsuite: Add test for #21186wip/T19503Ben Gamari2022-03-183-0/+16
|
* codeGen: Fix signedness of jump table indexingBen Gamari2022-03-182-11/+47
| | | | | | | | | | Previously while constructing the jump table index we would zero-extend the discriminant before subtracting the start of the jump-table. This goes subtly wrong in the case of a sub-word, signed discriminant, as described in the included Note. Fix this in both the PPC and X86 NCGs. Fixes #21186.
* TTG: TH brackets finishing touchesromes2022-03-1813-248/+186
| | | | | | | | | | | | | | | | | | | | | | Rewrite the critical notes and fix outdated ones, use `HsQuote GhcRn` (in `HsBracketTc`) for desugaring regardless of the bracket being typed or untyped, remove unused `EpAnn` from `Hs*Bracket GhcRn`, zonkExpr factor out common brackets code, ppr_expr factor out common brackets code, and fix tests, to finish MR https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782. ------------------------- Metric Decrease: hard_hole_fits -------------------------
* TTG: Make HsQuote GhcTc isomorphic to NoExtFieldromes2022-03-183-21/+63
| | | | | | | | | | | | | | | | An untyped bracket `HsQuote p` can never be constructed with `p ~ GhcTc`. This is because we don't typecheck `HsQuote` at all. That's OK, because we also never use `HsQuote GhcTc`. To enforce this at the type level we make `HsQuote GhcTc` isomorphic to `NoExtField` and impossible to construct otherwise, by using TTG field extensions to make all constructors, except for `XQuote` (which takes `NoExtField`), unconstructable, with `DataConCantHappen` This is explained more in detail in Note [The life cycle of a TH quotation] Related discussion: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782
* TTG: Refactor bracket for desugaring during tcromes2022-03-1814-157/+151
| | | | | | | | | | | | | When desugaring a bracket we want to desugar /renamed/ rather than /typechecked/ code; So in (HsExpr GhcTc) tree, we must have a (HsExpr GhcRn) for the quotation itself. This commit reworks the TTG refactor on typed and untyped brackets by storing the /renamed/ code in the bracket field extension rather than in the constructor extension in `HsQuote` (previously called `HsUntypedBracket`) See Note [The life cycle of a TH quotation] and https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782
* Separate constructors for typed and untyped bracketsromes2022-03-1819-207/+299
| | | | | | | | | | | Split HsBracket into HsTypedBracket and HsUntypedBracket. Unfortunately, we still cannot get rid of instance XXTypedBracket GhcTc = HsTypedBracket GhcRn despite no longer requiring it for typechecking, but rather because the TH desugarer works on GhcRn rather than GhcTc (See GHC.HsToCore.Quote)
* Type-checking untyped bracketsromes2022-03-185-22/+47
| | | | | | | | | | When HsExpr GhcTc, the HsBracket constructor should hold a HsBracket GhcRn, rather than an HsBracket GhcTc. We make use of the HsBracket p extension constructor (XBracket (XXBracket p)) to hold an HsBracket GhcRn when the pass is GhcTc See !4782 https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782
* TTG: Refactor HsBracketromes2022-03-1814-79/+74
|