summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Unfortunate dirty hack to overcome #18998.Richard Eisenberg2020-12-174-1/+77
| | | | | | | | See commentary in tcCheckUsage. Close #18998. Test case: typecheck/should_compile/T18998
* submodule update: containers and stmTom Ellis2020-12-172-0/+0
| | | | | | Needed for https://gitlab.haskell.org/ghc/ghc/-/issues/15656 as it stops the packages triggering incomplete-uni-patterns and incomplete-record-updates
* Reject dodgy scoping in associated family instance RHSesRyan Scott2020-12-178-93/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e63518f5d6a93be111f9108c0990a1162f88d615 tried to push all of the logic of detecting out-of-scope type variables on the RHSes of associated type family instances to `GHC.Tc.Validity` by deleting a similar check in the renamer. Unfortunately, this commit went a little too far, as there are some corner cases that `GHC.Tc.Validity` doesn't detect. Consider this example: ```hs class C a where data D a instance forall a. C Int where data instance D Int = MkD a ``` If this program isn't rejected by the time it reaches the typechecker, then GHC will believe the `a` in `MkD a` is existentially quantified and accept it. This is almost surely not what the user wants! The simplest way to reject programs like this is to restore the old validity check in the renamer (search for `improperly_scoped` in `rnFamEqn`). Note that this is technically a breaking change, since the program in the `polykinds/T9574` test case (which previously compiled) will now be rejected: ```hs instance Funct ('KProxy :: KProxy o) where type Codomain 'KProxy = NatTr (Proxy :: o -> *) ``` This is because the `o` on the RHS will now be rejected for being out of scope. Luckily, this is simple to repair: ```hs instance Funct ('KProxy :: KProxy o) where type Codomain ('KProxy @o) = NatTr (Proxy :: o -> *) ``` All of the discussion is now a part of the revamped `Note [Renaming associated types]` in `GHC.Rename.Module`. A different design would be to make associated type family instances have completely separate scoping from the parent instance declaration, much like how associated type family default declarations work today. See the discussion beginning at https://gitlab.haskell.org/ghc/ghc/-/issues/18021#note_265729 for more on this point. This, however, would break even more programs that are accepted today and likely warrants a GHC proposal before going forward. In the meantime, this patch fixes the issue described in #18021 in the least invasive way possible. There are programs that are accepted today that will no longer be accepted after this patch, but they are arguably pathological programs, and they are simple to repair. Fixes #18021.
* Force module recompilation if '*' prefix was used to load modules in ghci ↵nineonine2020-12-174-3/+24
| | | | | | | | | | | (#8042) Usually pre-compiled code is preferred to be loaded in ghci if available, which means that if we try to load module with '*' prefix and compilation artifacts are available on disc (.o and .hi files) or the source code was untouched, the driver would think no recompilation is required. Therefore, we need to force recompilation so that desired byte-code is generated and loaded. Forcing in this case should be ok, since this is what happens for interpreted code anyways when reloading modules.
* User guide minor typoDavid Eichmann2020-12-171-1/+1
| | | | [ci skip]
* Bump haddock submoduleGHC GitLab CI2020-12-161-0/+0
| | | | To adapt haddock for the nullary tyconapp optimisation patch.
* Revert haddock submodule yet againBen Gamari2020-12-151-0/+0
|
* Roll-back broken haddock commitBen Gamari2020-12-151-0/+0
| | | | Updates haddock submodule to revert a commit that does not build.
* Revert "Implement BoxedRep proposal"Ben Gamari2020-12-1595-632/+263
| | | | | | This was inadvertently merged. This reverts commit 6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.
* testsuite: Mark divbyzero, derefnull as fragileBen Gamari2020-12-151-0/+2
| | | Due to #18548.
* Add regression test for #19053Sebastian Graf2020-12-152-0/+9
|
* Implement BoxedRep proposalAndrew Martin2020-12-1495-263/+632
| | | | | | | | | | | | | | | | | | This implements the BoxedRep proposal, refacoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Closes #17526.
* Optimise nullary type constructor usagewip/tyconapp-optsBen Gamari2020-12-1423-77/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the compilation of programs GHC very frequently deals with the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch teaches GHC to avoid expanding the `Type` synonym (and other nullary type synonyms) during type comparisons, saving a good amount of work. This optimisation is described in `Note [Comparing nullary type synonyms]`. To maximize the impact of this optimisation, we introduce a few special-cases to reduce `TYPE 'LiftedRep` to `Type`. See `Note [Prefer Type over TYPE 'LiftedPtrRep]`. Closes #17958. Metric Decrease: T18698b T1969 T12227 T12545 T12707 T14683 T3064 T5631 T5642 T9020 T9630 T9872a T13035 haddock.Cabal haddock.base
* Optimize dumping of consecutive whitespace.wip/andreask/opt_dumpsAndreas Klebinger2020-12-146-19/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The naive way of putting out n characters of indent would be something like `hPutStr hdl (replicate n ' ')`. However this is quite inefficient as we allocate an absurd number of strings consisting of simply spaces as we don't cache them. To improve on this we now track if we can simply write ascii spaces via hPutBuf instead. This is the case when running with -ddump-to-file where we force the encoding to be UTF8. This avoids both the cost of going through encoding as well as avoiding allocation churn from all the white space. Instead we simply use hPutBuf on a preallocated unlifted string. When dumping stg like this: > nofib/spectral/simple/Main.hs -fforce-recomp -ddump-stg-final -ddump-to-file -c +RTS -s Allocations went from 1,778 MB to 1,702MB. About a 4% reduction of allocation! I did not measure the difference in runtime but expect it to be similar. Bumps the haddock submodule since the interface of GHC's Pretty slightly changed. ------------------------- Metric Decrease: T12227 -------------------------
* Move Unit related fields from DynFlags to HscEnvSylvain Henry2020-12-1458-1219/+1308
| | | | | | | | | | | | | The unit database cache, the home unit and the unit state were stored in DynFlags while they ought to be stored in the compiler session state (HscEnv). This patch fixes this. It introduces a new UnitEnv type that should be used in the future to handle separate unit environments (especially host vs target units). Related to #17957 Bump haddock submodule
* Revert "Optimise nullary type constructor usage"Ben Gamari2020-12-1423-213/+77
| | | | | | This was inadvertently merged. This reverts commit 7e9debd4ceb068effe8ac81892d2cabcb8f55850.
* Optimise nullary type constructor usageBen Gamari2020-12-1423-77/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the compilation of programs GHC very frequently deals with the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch teaches GHC to avoid expanding the `Type` synonym (and other nullary type synonyms) during type comparisons, saving a good amount of work. This optimisation is described in `Note [Comparing nullary type synonyms]`. To maximize the impact of this optimisation, we introduce a few special-cases to reduce `TYPE 'LiftedRep` to `Type`. See `Note [Prefer Type over TYPE 'LiftedPtrRep]`. Closes #17958. Metric Decrease: T18698b T1969 T12227 T12545 T12707 T14683 T3064 T5631 T5642 T9020 T9630 T9872a T13035 haddock.Cabal haddock.base
* Implement type applications in patternsCale Gibbard2020-12-1487-193/+959
| | | | | The haddock submodule is also updated so that it understands the changes to patterns.
* Remove old .travis.ymlJohn Ericson2020-12-131-61/+0
|
* mkDocs: support hadrian bindists #18973Adam Sandberg Ericsson2020-12-121-1/+3
|
* hadrian: correctly copy the docs dir into the bindist #18669Adam Sandberg Ericsson2020-12-121-1/+9
|
* Demand: Simplify `CU(U)` to `U` (#19005)Sebastian Graf2020-12-126-35/+47
| | | | | | Both sub-demands encode the same information. This is a trivial change and already affects a few regression tests (e.g. `T5075`), so no separate regression test is necessary.
* DmdAnal: Annotate top-level function bindings with demands (#18894)Sebastian Graf2020-12-1215-155/+937
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's useful to annotate a non-exported top-level function like `g` in ```hs module Lib (h) where g :: Int -> Int -> (Int,Int) g m 1 = (m, 0) g m n = (2 * m, 2 `div` n) {-# NOINLINE g #-} h :: Int -> Int h 1 = 0 h m | odd m = snd (g m 2) | otherwise = uncurry (+) (g 2 m) ``` with its demand `UCU(CS(P(1P(U),SP(U))`, which tells us that whenever `g` was called, the second component of the returned pair was evaluated strictly. Since #18903 we do so for local functions, where we can see all calls. For top-level functions, we can assume that all *exported* functions are demanded according to `topDmd` and thus get sound demands for non-exported top-level functions. The demand on `g` is crucial information for Nested CPR, which may the go on and unbox `g` for the second pair component. That is true even if that pair component may diverge, as is the case for the call site `g 13 0`, which throws a div-by-zero exception. In `T18894b`, you can even see the new demand annotation enabling us to eta-expand a function that we wouldn't be able to eta-expand without Call Arity. We only track bindings of function type in order not to risk huge compile-time regressions, see `isInterestingTopLevelFn`. There was a CoreLint check that rejected strict demand annotations on recursive or top-level bindings, which seems completely unjustified. All the cases I investigated were fine, so I removed it. Fixes #18894.
* Use static array in zeroCountSylvain Henry2020-12-111-37/+6
|
* rts: don't use siginterrupt (#19019)Sylvain Henry2020-12-111-5/+1
|
* ghci: reuse Arch from ghc-bootSylvain Henry2020-12-112-63/+22
|
* ghci: don't compile unneeded modulesSylvain Henry2020-12-111-2/+2
|
* Move SizedSeq into ghc-bootSylvain Henry2020-12-118-9/+8
|
* Parser: move parser utils into their own moduleSylvain Henry2020-12-114-58/+72
| | | | Move code unrelated to runtime evaluation out of GHC.Runtime.Eval
* Hadrian: fix libffi tarball parsingSylvain Henry2020-12-111-1/+1
| | | | | | Fix parsing of "libffi-3.3.tar.gz". NB: switch to a newer libffi isn't done in this patch
* Validate script: fix configure command when using stackSylvain Henry2020-12-111-1/+4
|
* Arrows: correctly query arrow methods (#17423)Sylvain Henry2020-12-114-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Consider the following code: proc (C x y) -> ... Before this patch, the evidence binding for the Arrow dictionary was attached to the C pattern: proc (C x y) { $dArrow = ... } -> ... But then when we desugar this, we use arrow operations ("arr", ">>>"...) specialised for this arrow: let arr_xy = arr $dArrow -- <-- Not in scope! ... in arr_xy (\(C x y) { $dArrow = ... } -> ...) This patch allows arrow operations to be type-checked before the proc itself, avoiding this issue. Fix #17423
* Delete outdated Note [Kind-checking tyvar binders for associated types]Ryan Scott2020-12-112-24/+0
| | | | | | | | | | | This Note has severely bitrotted, as it has no references anywhere in the codebase, and none of the functions that it mentions exist anymore. Let's just delete this. While I was in town, I deleted some outdated comments from `checkFamPatBinders` of a similar caliber. Fixes #19008. [ci skip]
* Add :doc test case for duplicate record fieldsAaron Allen2020-12-113-0/+17
| | | | | Tests that the output of the `:doc` command is correct for duplicate record fields defined using -XDuplicateRecordFields.
* Elide extraneous messages for :doc command (#15784)Aaron Allen2020-12-114-5/+26
| | | | | | | | Do not print `<has no documentation>` alongside a valid doc. Additionally, if two matching symbols lack documentation then the message will only be printed once. Hence, `<has no documentation>` will be printed at most once and only if all matching symbols are lacking docs.
* Display FFI labels (fix #18539)Sylvain Henry2020-12-112-8/+10
|
* gitlab-ci: Fix name of flavour in ThreadSanitizer jobBen Gamari2020-12-111-1/+1
| | | | | It looks like I neglected to update this after introduce flavour transformers.
* gitlab-ci: Fix incorrect Docker image for nightly cross jobBen Gamari2020-12-111-11/+8
| | | | Also refactor the job definition to eliminate the bug by construction.
* users guide: Describe GC lifecycle eventsBen Gamari2020-12-113-5/+101
| | | | | | Every time I am asked about how to interpret these events I need to figure it out from scratch. It's well past time that the users guide properly documents these.
* users guide: Fix syntax errorsBen Gamari2020-12-111-23/+21
| | | | Fixes errors introduced by 3a55b3a2574f913d046f3a6f82db48d7f6df32e3.
* rts/linker/Elf.c: add missing <dlfcn.h> include (musl support)Sergei Trofimovich2020-12-101-0/+3
| | | | | | | | | | | | | | The change fixes build failure on musl: ``` rts/linker/Elf.c:2031:3: error: warning: implicit declaration of function 'dlclose'; did you mean 'close'? [-Wimplicit-function-declaration] 2031 | dlclose(nc->dlopen_handle); | ^~~~~~~ | close ``` Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* doc: Extra-clarify -fomit-yieldsKirill Elagin2020-12-101-1/+1
| | | | Be more clear on what this optimisation being on by default means in terms of yields.
* doc: Clarify the default for -fomit-yieldsKirill Elagin2020-12-101-1/+1
| | | | | | “Yield points enabled” is confusing (and probably wrong? I am not 100% sure what it means). Change it to a simple “on”. Undo this change from 2c23fff2e03e77187dc4d01f325f5f43a0e7cad2.
* Bump time submodule.Andreas Klebinger2020-12-081-0/+0
| | | | This should fix #19002.
* GHC.Cmm.Opt: Be stricter in results.Andreas Klebinger2020-12-081-51/+51
| | | | | | | | | | | | | Optimization either returns Nothing if nothing is to be done or `Just <cmmExpr>` otherwise. There is no point in being lazy in `cmmExpr`. We usually inspect this element so the thunk gets forced not long after. We might eliminate it as dead code once in a blue moon but that's not a case worth optimizing for. Overall the impact of this is rather low. As Cmm.Opt doesn't allocate much (compared to the rest of GHC) to begin with.
* Cmm.Sink: Optimize retaining of assignments, live sets.Andreas Klebinger2020-12-085-52/+174
| | | | | | | | | | | | | | | | | | | | | | | | | Sinking requires us to track live local regs after each cmm statement. We used to do this via "Set LocalReg". However we can replace this with a solution based on IntSet which is overall more efficient without losing much. The thing we lose is width of the variables, which isn't used by the sinking pass anyway. I also reworked how we keep assignments to regs mentioned in skipped assignments. I put the details into Note [Keeping assignemnts mentioned in skipped RHSs]. The gist of it is instead of keeping track of it via the use count which is a `IntMap Int` we now use the live regs set (IntSet) which is quite a bit faster. I think it also matches the semantics a lot better. The skipped (not discarded) assignment does in fact keep the regs on it's rhs alive so keeping track of this in the live set seems like the clearer solution as well. Improves allocations for T3294 by yet another 1%.
* Cmm: Make a few types and utility function slightly stricter.Andreas Klebinger2020-12-082-9/+11
| | | | | | About 0.6% reduction in allocations for the code I was looking at. Not a huge difference but no need to throw away performance.
* CmmSink: Force inlining of foldRegsDefdAndreas Klebinger2020-12-081-6/+45
| | | | | Helps avoid allocating the folding function. Improves perf for T3294 by about 1%.
* CodeGen: Make folds User/DefinerOfRegs INLINEABLE.Andreas Klebinger2020-12-082-0/+7
| | | | | | | | | Reduces allocation for the test case I was looking at by about 1.2%. Mostly from avoiding allocation of some folding functions which turn into let-no-escape bindings which just reuse their environment instead. We also force inlining in a few key places in CmmSink which helps a bit more.
* hadrian: build the _l and _thr_l rts flavours in the develN flavoursAdam Sandberg Ericsson2020-12-081-1/+1
| | | | | The ghc binary requires the eventlog rts since fc644b1a643128041cfec25db84e417851e28bab