summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix LintSimon Peyton Jones2020-03-143-56/+147
| | | | | | | | | | | | | | Ticket #17590 pointed out a bug in the way the linter dealt with type lets, exposed by the new uniqAway story. The fix is described in Note [Linting type lets]. I ended up putting the in-scope Ids in a different env field, le_ids, rather than (as before) sneaking them into the TCvSubst. Surprisingly tiresome, but done. Metric Decrease: hie002
* gitlab-ci: Distinguish integer-simple test envsBen Gamari2020-03-131-1/+1
| | | Previously two integer-simple jobs declared the same test environment. One (the nightly job) was built in the perf way, the other in the validate way. Consequently they had appreciably different performance characteristics, causing in the nightly job to spuriously fail with performance changes.
* gitlab-ci: Rework triggering of release buildsBen Gamari2020-03-131-1/+2
| | | | Use a push option instead of tagging.
* Update documentation for closureSizePaavo2020-03-131-1/+2
|
* Rename isDllNameSylvain Henry2020-03-133-12/+9
| | | | | | I wanted to fix the dangling comment in `isDllName` ("This is the cause of #", #8696 is already mentioned earlier). I took the opportunity to change the function name to better reflect what it does.
* hadrian: improve dependency tracking for the check-* programsAlp Mestanogullari2020-03-133-34/+36
| | | | | | | | | | | | | | | | | | | | | | | The code in Rules.Register responsible for finding all the build artifacts that Cabal installs when registering a library (static/shared libs, .hi files, ...) was looking in the wrong place. This patch fixes that logic and makes sure we gather all those artifacts in a list to declare that the rule for a given `.conf` file, our proxy for "Hadrian, please install this package in the package db for this stage", also produces those artifacts under the said package database. We also were completely missing some logic to declare that the check-* programs have dependencies besides their source code, at least when testing an in-tree compiler. Finally, this patch also removes redundant packages from 'testsuitePackages', since they should already be covered by the stage<N>Packages lists from Settings.Default. With this patch, after a complete build and freezing stage 1, a change to `compiler/parser/Parser.y` results in rebuilding the ghc lib, reinstalling it, and rebuilding the few programs that depend on it, _including_ `check-ppr` and `check-api-annotations` (therefore fixing #17273).
* Expose compulsory unfoldings alwaysSimon Peyton Jones2020-03-126-33/+68
| | | | | | | | | | | | The unsafeCoerce# patch requires that unsafeCoerce# has a compulsory unfolding that is always available. So we have to be careful to expose compulsory unfoldings unconditionally and consistently. We didn't get this quite right: #17871. This patch fixes it. No real surprises here. See Note [Always expose compulsory unfoldings] in GHC.Iface.Tidy
* pretty-printer: Do not print ApplicativeDo joinKirill Elagin2020-03-124-4/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Do not print `join` in ApplictiveStmt, unless ppr-debug * Print parens around multiple parallel binds When ApplicativeDo is enabled, the renamer analyses the statements of a `do` block and in certain cases marks them as needing to be rewritten using `join`. For example, if you have: ``` foo = do a <- e1 b <- e2 doSomething a b ``` it will be desugared into: ``` foo = join (doSomething <$> e1 <*> e2) ``` After renaming but before desugaring the expression is stored essentially as: ``` foo = do [will need join] (a <- e1 | b <- e2) [no return] doSomething a b ``` Before this change, the pretty printer would print a call to `join`, even though it is not needed at this stage at all. The expression will be actually rewritten into one using join only at desugaring, at which point a literal call to join will be inserted.
* pretty-printer: Properly parenthesise LastStmtKirill Elagin2020-03-127-14/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | After ApplicatveDo strips the last `return` during renaming, the pretty printer has to restore it. However, if the return was followed by `$`, the dollar was stripped too and not restored. For example, the last stamement in: ``` foo = do x <- ... ... return $ f x ``` would be printed as: ``` return f x ``` This commit preserved the dolar, so it becomes: ``` return $ f x ```
* Make DeriveFunctor-generated code require fewer beta reductionsRyan Scott2020-03-119-125/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #17880 demonstrates that `DeriveFunctor`-generated code is surprisingly fragile when rank-_n_ types are involved. The culprit is that `$fmap` (the algorithm used to generate `fmap` implementations) was too keen on applying arguments with rank-_n_ types to lambdas, which fail to typecheck more often than not. In this patch, I change `$fmap` (both the specification and the implementation) to produce code that avoids creating as many lambdas, avoiding problems when rank-_n_ field types arise. See the comments titled "Functor instances" in `TcGenFunctor` for a more detailed description. Not only does this fix #17880, but it also ensures that the code that `DeriveFunctor` generates will continue to work after simplified subsumption is implemented (see #17775). What is truly amazing is that #17880 is actually a regression (introduced in GHC 7.6.3) caused by commit 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e, the fix #7436. Prior to that commit, the version of `$fmap` that was used was almost identical to the one used in this patch! Why did that commit change `$fmap` then? It was to avoid severe performance issues that would arise for recursive `fmap` implementations, such as in the example below: ```hs data List a = Nil | Cons a (List a) deriving Functor -- ===> instance Functor List where fmap f Nil = Nil fmap f (Cons x xs) = Cons (f x) (fmap (\y -> f y) xs) ``` The fact that `\y -> f y` was eta expanded caused significant performance overheads. Commit 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e fixed this performance issue, but it went too far. As a result, this patch partially reverts 49ca2a37bef18aa57235ff1dbbf1cc0434979b1e. To ensure that the performance issues pre-#7436 do not resurface, I have taken some precautionary measures: * I have added a special case to `$fmap` for situations where the last type variable in an application of some type occurs directly. If this special case fires, we avoid creating a lambda expression. This ensures that we generate `fmap f (Cons x xs) = Cons (f x) (fmap f xs)` in the derived `Functor List` instance above. For more details, see `Note [Avoid unnecessary eta expansion in derived fmap implementations]` in `TcGenFunctor`. * I have added a `T7436b` test case to ensure that the performance of this derived `Functor List`-style code does not regress. When implementing this, I discovered that `$replace`, the algorithm which generates implementations of `(<$)`, has a special case that is very similar to the `$fmap` special case described above. `$replace` marked this special case with a custom `Replacer` data type, which was a bit overkill. In order to use the same machinery for both `Functor` methods, I ripped out `Replacer` and instead implemented a simple way to detect the special case. See the updated commentary in `Note [Deriving <$]` for more details.
* Use a Set to represent WaysSylvain Henry2020-03-1112-52/+61
| | | | | | | | Should make `member` queries faster and avoid messing up with missing `nubSort`. Metric Increase: hie002
* Refactor interpreterDynamic and interpreterProfiledSylvain Henry2020-03-1110-80/+95
| | | | | | | | * `interpreterDynamic` and `interpreterProfiled` now take `Interp` parameters instead of DynFlags * slight refactoring of `ExternalInterp` so that we can read the iserv configuration (which is pure) without reading an MVar.
* Refactor GHC.Driver.Session (Ways and Flags)Sylvain Henry2020-03-1112-710/+759
| | | | | | | | | | | | | * extract flags and ways into their own modules (with some renaming) * remove one SOURCE import of GHC.Driver.Session from GHC.Driver.Phases * when GHC uses dynamic linking (WayDyn), `interpWays` was only reporting WayDyn even if the host was profiled (WayProf). Now it returns both as expected (might fix #16803). * `mkBuildTag :: [Way] -> String` wasn't reporting a canonical tag for differently ordered lists. Now we sort and nub the list to fix this.
* Zero any slop after compaction in compacting GCÖmer Sinan Ağacan2020-03-111-4/+21
| | | | | | | | | | | | | In copying GC, with the relevant debug flags enabled, we release the old blocks after a GC, and the block allocator zeroes the space before releasing a block. This effectively zeros the old heap. In compacting GC we reuse the blocks and previously we didn't zero the unused space in a compacting generation after compaction. With this patch we zero the slop between the free pointer and the end of the block when we're done with compaction and when switching to a new block (because the current block doesn't have enough space for the next object we're shifting).
* Deepen call stack for isInSimon Peyton Jones2020-03-111-2/+2
| | | | | | | | | | I see quite a few warnings like: WARNING: file compiler/utils/Util.hs, line 593 Over-long elem in unionLists But the call stack is uninformative. Better to add HasDebugCallStack to isIn. Ditto isn'tIn.
* testsuite: Mark ghci056 and ghcilink004 as fragile in unregBen Gamari2020-03-113-1/+3
| | | | | | | As noted in #17018. Also fix fragile declaration of T13786, which only runs in the normal way.
* Re-quantify when generalising over rewrite rule typesRyan Scott2020-03-115-24/+67
| | | | | | | | | | | | | | | | | | | | | | Previously, `tcRules` would check for naughty quantification candidates (see `Note [Naughty quantification candidates]` in `TcMType`) when generalising over the type of a rewrite rule. This caused sensible-looking rewrite rules (like those in #17710) to be rejected. A more permissing (and easier-to-implement) approach is to do what is described in `Note [Generalising in tcTyFamInstEqnGuts]` in `TcTyClsDecls`: just re-quantify all the type variable binders, regardless of the order in which the user specified them. After all, the notion of type variable specificity has no real meaning in rewrite rules, since one cannot "visibly apply" a rewrite rule. I have written up this wisdom in `Note [Re-quantify type variables in rules]` in `TcRules`. As a result of this patch, compiling the `ExplicitForAllRules1` test case now generates one fewer warning than it used to. As far as I can tell, this is benign, since the thing that the disappearing warning talked about was also mentioned in an entirely separate warning. Fixes #17710.
* Fixed a minor typo in codegen.rstGreg Steuck2020-03-111-1/+1
|
* Split GHC.Iface.Utils moduleSylvain Henry2020-03-1117-1408/+1429
| | | | | | | | * GHC.Iface.Recomp: recompilation avoidance stuff * GHC.Iface.Make: mkIface* Moved `writeIfaceFile` into GHC.Iface.Load alongside `readIface` and renamed it `writeIface` for consistency.
* rts: Prefer darwin-specific getCurrentThreadCPUTimeBen Gamari2020-03-111-15/+25
| | | | | | | macOS Catalina now supports a non-POSIX-compliant version of clock_gettime which cannot use the clock_gettime codepath. Fixes #17906.
* Typos in comments [skip ci]Krzysztof Gogolewski2020-03-1023-37/+37
|
* Misc cleanupKrzysztof Gogolewski2020-03-106-58/+9
| | | | | | | | | - Remove Note [Existentials in shift_con_pat]. The function shift_con_pat has been removed 15 years ago in 23f40f0e9be6d4. - Remove kcLookupTcTyCon - it's the same as tcLookupTcTyCon - Remove ASSERT in tyConAppArgN. It's already done by getNth, and it's the only reason getNth exists. - Remove unused function nextRole
* Comments onlySimon Peyton Jones2020-03-101-0/+6
| | | | Clarify code added in #17852 and MR !2724
* Clarify a Lint messageBen Price2020-03-101-3/+2
| | | | | | | | | | | | | | | | | When developing a plugin I had a shadowing problem, where I generated code app = \f{v r7B} x{v r7B} -> f{v r7B} x{v r7B} This is obviously wrong, since the occurrence of `f` to the right of the arrow refers to the `x` binder (they share a Unique). However, it is rather confusing when Lint reports Mismatch in type between binder and occurrence Var: x{v rB7} since it is printing the binder, rather than the occurrence. It is rather easy to read this as claiming there is something wrong with the `x` occurrence! We change the report to explicitly print both the binder and the occurrence variables.
* anyRewritableTyVar now looks in RuntimeRepsRichard Eisenberg2020-03-104-1/+36
| | | | | | | | | | Previously, anyRewritableTyVar looked only at the arg and res of `arg -> res`, but their RuntimeReps are also subject to rewriting. Easy to fix. Test case: typecheck/should_compile/T17024 Fixes #17024.
* Add regression test for T17904Ömer Sinan Ağacan2020-03-102-0/+64
| | | | Closes #17904
* Hadrian: track missing configure resultsSylvain Henry2020-03-101-2/+21
|
* testsuite: Add test for #17786Ben Gamari2020-03-103-0/+11
| | | | This isn't pretty but it's perhaps better than nothing.
* SysTools: Ensure that error parser can handle absolute paths on WindowsBen Gamari2020-03-101-3/+14
| | | | | | | This fixes #17786, where the error parser fails to correctly handle the drive name in absolute Windows paths. Unfortunately I couldn't find a satisfactory way to test this.
* Use InstanceSigs in GND/DerivingVia-generated code (#17899)Ryan Scott2020-03-099-132/+157
| | | | | | | | Aside from making the generated code easier to read when `-ddump-deriv` is enabled, this makes the error message in `T15073` substantially simpler (see the updated `T15073` expected stderr). Fixes #17899.
* rts: refactor and comment profile localesJean-Baptiste Mazon2020-03-091-15/+52
|
* rts: ensure C numerics in heap profiles using Windows locales if neededJean-Baptiste Mazon2020-03-091-19/+32
|
* Fix Windows breakage by not touching locales on WindowsJean-Baptiste Mazon2020-03-091-0/+19
|
* gitlab-ci: Disable Sphinx documentation in Alpine buildBen Gamari2020-03-091-1/+1
|
* nonmoving: Fix collection of sparksBen Gamari2020-03-094-6/+53
| | | | | | | | | | Previously sparks living in the non-moving heap would be promptly GC'd by the minor collector since pruneSparkQueue uses the BF_EVACUATED flag, which non-moving heap blocks do not have set. Fix this by implementing proper support in pruneSparkQueue for determining reachability in the non-moving heap. The story is told in Note [Spark management in the nonmoving heap].
* rts: Report nonmoving collector statistics in machine-readable outputBen Gamari2020-03-051-0/+20
|
* Stats: Add sync pauses to +RTS -S outputBen Gamari2020-03-051-0/+3
|
* nonmoving-gc: Track time usage of nonmoving markingBen Gamari2020-03-0510-24/+286
|
* rts: Add getCurrentThreadCPUTime helperBen Gamari2020-03-053-21/+71
|
* Be explicit about how stack usage of mvar primops are covered.Andreas Klebinger2020-03-041-0/+1
| | | | | | This fixes #17893 [skip-ci]
* Use configure script to detect that we should use in-tree GMP on WindowsSylvain Henry2020-03-024-15/+11
|
* Set `ImpredicativeTypes` during :print command. (#14828)Roland Senn2020-03-023-15/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If ImpredicativeTypes is not enabled, then `:print <term>` will fail if the type of <term> has nested `forall`s or `=>`s. This is because the GHCi debugger's internals will attempt to unify a metavariable with the type of <term> and then display the result, but if the type has nested `forall`s or `=>`s, then unification will fail. As a result, `:print` will bail out and the unhelpful result will be `<term> = (_t1::t1)` (where `t1` is a metavariable). Beware: <term> can have nested `forall`s even if its definition doesn't use RankNTypes! Here is an example from #14828: class Functor f where fmap :: (a -> b) -> f a -> f b Somewhat surprisingly, `:print fmap` considers the type of fmap to have nested foralls. This is because the GHCi debugger sees the type `fmap :: forall f. Functor f => forall a b. (a -> b) -> f a -> f b`. We could envision deeply instantiating this type to get the type `forall f a b. Functor f => (a -> b) -> f a -> f b`, but this trick wouldn't work for higher-rank types. Instead, we adopt a simpler fix: enable `ImpredicativeTypes` when using `:print` and friends in the GHCi debugger. This is allows metavariables to unify with types that have nested (or higher-rank) `forall`s/`=>`s, which makes `:print fmap` display as `fmap = (_t1::forall a b. Functor f => (a -> b) -> f a -> f b)`, as expected. Although ImpredicativeTypes is a somewhat unpredictable from a type inference perspective, there is no danger in using it in the GHCi debugger, since all of the terms that the GHCi debugger deals with have already been typechecked.
* Do not define hs_atomic{read,write}64() on non-64bitIlias Tsitsimpis2020-03-021-0/+5
| | | | | | | | | | | | | | | Do not define hs_atomicread64() and hs_atomicwrite64() on machines where WORD_SIZE_IN_BITS is less than 64, just like we do with the rest of the atomic functions which work on 64-bit values. Without this, compilation fails on MIPSel and PowerPC with the following error: /usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicread64': atomic.c:(.text.hs_atomicread64+0x8): undefined reference to `__sync_add_and_fetch_8' /usr/bin/ld: /<<PKGBUILDDIR>>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicwrite64': atomic.c:(.text.hs_atomicwrite64+0x38): undefined reference to `__sync_bool_compare_and_swap_8' Fixes #17886.
* Remove dead codeKrzysztof Gogolewski2020-03-023-52/+4
| | | | | | | * The names in PrelName and THNames are no longer used since TH merged types and kinds, Typeable is kind-polymorphic, .net support was removed * unqualQuasiQuote no longer used since 6f8ff0bbad3b9fa3
* Show breakpoint locations of breakpoints which were ignored during :force ↵Roland Senn2020-02-2912-21/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#2950) GHCi is split up into 2 major parts: The user-interface (UI) and the byte-code interpreter. With `-fexternal-interpreter` they even run in different processes. Communication between the UI and the Interpreter (called `iserv`) is done using messages over a pipe. This is called `Remote GHCI` and explained in the Note [Remote GHCi] in `compiler/ghci/GHCi.hs`. To process a `:force` command the UI sends a `Seq` message to the `iserv` process. Then `iserv` does the effective evaluation of the value. When during this process a breakpoint is hit, the `iserv` process has no additional information to enhance the `Ignoring breakpoint` output with the breakpoint location. To be able to print additional breakpoint information, there are 2 possible implementation choices: 1. Store the needed information in the `iserv` process. 2. Print the `Ignoring breakpoint` from the UI process. For option 1 we need to store the breakpoint info redundantely in 2 places and this is bad. Therfore option 2 was implemented in this MR: - The user enters a `force` command - The UI sends a `Seq` message to the `iserv` process. - If processing of the `Seq` message hits a breakpoint, the `iserv` process returns control to the UI process. - The UI looks up the source location of the breakpoint, and prints the enhanced `Ignoring breakpoint` output. - The UI sends a `ResumeSeq` message to the `iserv` process, to continue forcing.
* Simplify IfaceIdInfo typeÖmer Sinan Ağacan2020-02-297-48/+16
| | | | | | | | | | | | | | | IfaceIdInfo type is confusing: there's practically no difference between `NoInfo` and `HasInfo []`. The comments say NoInfo is used when -fomit-interface-pragmas is enabled, but we don't need to distinguish `NoInfo` from `HasInfo []` in when reading the interface so the distinction is not important. This patch simplifies the type by removing NoInfo. When we have no info we use an empty list. With this change we no longer read the info list lazily when reading an IfaceInfoItem, but when reading an IfaceId the ifIdInfo field is read lazily, so I doubt this is going to be a problem.
* Fix Hadrian's ``--configure`` (fix #17883)Sylvain Henry2020-02-291-8/+9
|
* rts: enforce POSIX numeric locale for heap profilesJean-Baptiste Mazon2020-02-291-0/+30
|
* docs: correct link to th haddocks from users guideAdam Sandberg Ericsson2020-02-291-1/+1
|
* docs: correct relative links to haddocks from users guide (fixes #17866)Adam Sandberg Ericsson2020-02-291-2/+29
|