summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Redesign withDict (formerly magicDict)wip/T16646-take-threeRyan Scott2021-04-2725-135/+437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gives a more precise type signature to `magicDict` as proposed in #16646. In addition, this replaces the constant-folding rule for `magicDict` in `GHC.Core.Opt.ConstantFold` with a special case in the desugarer in `GHC.HsToCore.Expr.dsHsWrapped`. I have also renamed `magicDict` to `withDict` in light of the discussion in https://mail.haskell.org/pipermail/ghc-devs/2021-April/019833.html. All of this has the following benefits: * `withDict` is now more type safe than before. Moreover, if a user applies `withDict` at an incorrect type, the special-casing in `dsHsWrapped` will now throw an error message indicating what the user did incorrectly. * `withDict` can now work with classes that have multiple type arguments, such as `Typeable @k a`. This means that `Data.Typeable.Internal.withTypeable` can now be implemented in terms of `withDict`. * Since the special-casing for `withDict` no longer needs to match on the structure of the expression passed as an argument to `withDict`, it no longer cares about the presence or absence of `Tick`s. In effect, this obsoletes the fix for #19667. The new `T16646` test case demonstrates the new version of `withDict` in action, both in terms of `base` functions defined in terms of `withDict` as well as in terms of functions from the `reflection` and `singletons` libraries. The `T16646Fail` test case demonstrates the error message that GHC throws when `withDict` is applied incorrectly. This fixes #16646. By adding more tests for `withDict`, this also fixes #19673 as a side effect.
* EPA: cleanups after the mergeAlan Zimmerman2021-04-1935-1123/+884
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove EpaAnn type synonym, rename EpaAnn' to EpaAnn. Closes #19705 Updates haddock submodule -- Change data EpaAnchor = AR RealSrcSpan | AD DeltaPos To instead be data EpaAnchor = AnchorReal RealSrcSpan | AnchorDelta DeltaPos Closes #19699 -- Change data DeltaPos = DP { deltaLine :: !Int, deltaColumn :: !Int } To instead be data DeltaPos = SameLine { deltaColumn :: !Int } | DifferentLine { deltaLine :: !Int, startColumn :: !Int } Closes #19698 -- Also some clean-ups of unused parts of check-exact.
* Enable tables next to code for riscv64Andreas Schwab2021-04-193-2/+32
| | | | | This requires adding another rewrite to the mangler, to avoid generating PLT entries.
* Use correct precedence in Complex's Read1/Show1 instancesRyan Scott2021-04-184-3/+50
| | | | Fixes #19719.
* users-guide: Add missing FieldSelectors to GHC2021 listBen Gamari2021-04-181-0/+1
|
* users guide: Sort lists of implied language extensionsBen Gamari2021-04-181-20/+20
|
* users-guide: Clarify GHC2021 documentationBen Gamari2021-04-181-1/+7
| | | | | Point out that GHC2021 doesn't offer the same degree of stability that Haskell2010 does, as noted by @phadej.
* Fix Haddock referenceBen Gamari2021-04-181-1/+1
|
* Only load package environment file once when starting GHCiMatthew Pickering2021-04-186-2/+24
| | | | | | | | | | | | | | | Since d880d6b2e48268f5ed4d3eb751fe24cc833e9221 the parsing of the environment files was moved to `parseDynamicFlags`, under the assumption it was typically only called once. It turns out not to be true in GHCi and this led to continually reparsing the environment file whenever a new option was set, the options were appended to the package state and hence all packages reloaded, as it looked like the options were changed. The simplest fix seems to be a clearer specification: > Package environment files are only loaded in GHCi during initialisation. Fixes #19650
* Improvements in SpecConstrwip/T19672Simon Peyton Jones2021-04-175-90/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow under-saturated calls to specialise See Note [SpecConstr call patterns] This just allows a bit more specialisation to take place. * Don't discard calls from un-specialised RHSs. This was a plain bug in `specialise`, again leading to loss of specialisation. Refactoring yields an `otherwise` case that is easier to grok. * I refactored CallPat to become a proper data type, not a tuple. All this came up when I was working on eta-reduction. The ticket is #19672. The nofib results are mostly zero, with a couple of big wins: Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- awards +0.2% -0.1% -18.7% -18.8% 0.0% comp_lab_zift +0.2% -0.2% -23.9% -23.9% 0.0% fft2 +0.2% -1.0% -34.9% -36.6% 0.0% hpg +0.2% -0.3% -18.4% -18.4% 0.0% mate +0.2% -15.7% -19.3% -19.3% +11.1% parser +0.2% +0.6% -16.3% -16.3% 0.0% puzzle +0.4% -19.7% -33.7% -34.0% 0.0% rewrite +0.2% -0.5% -20.7% -20.7% 0.0% -------------------------------------------------------------------------------- Min +0.2% -19.7% -48.1% -48.9% 0.0% Max +0.4% +0.6% -1.2% -1.1% +11.1% Geometric Mean +0.2% -0.4% -21.0% -21.1% +0.1% I investigated the 0.6% increase on 'parser'. It comes because SpecConstr has a limit of 3 specialisations. With HEAD, hsDoExpr has 2 specialisations, and then a further several from the specialised bodies, of which 1 is picked. With this patch we get 3 specialisations right off the bat, so we discard all from the recursive calls. Turns out that that's not the best choice, but there is no way to tell that. I'm accepting it. NB: these figures actually come from this patch plus the preceding one for StgCSE, but I think the gains come from SpecConstr.
* Improve CSE in STG-landSimon Peyton Jones2021-04-174-23/+119
| | | | | | | | This patch fixes #19717, a long-standing bug in CSE for STG, which led to a stupid loss of CSE in some situations. It's explained in Note [Trivial case scrutinee], which I have substantially extended.
* Fix handling ze_meta_tv_env in GHC.Tc.Utils.ZonkSimon Peyton Jones2021-04-151-31/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As #19668 showed, there was an /asymptotic/ slow-down in zonking in GHC 9.0, exposed in test T9198. The bug was actually present in earlier compilers, but by a fluke didn't actually show up in any of our tests; but adding Quick Look exposed it. The bug was that in zonkTyVarOcc we 1. read the meta-tyvar-env variable 2. looked up the variable in the env 3. found a 'miss' 4. looked in the variable, found `Indirect ty` 5. zonked `ty` 6. update the env *gotten from step 1* to map the variable to its zonked type. The bug is that we thereby threw away all teh work done in step 4. In T9198 that made an enormous, indeed asymptotic difference. The fix is easy: use updTcRef. I commented in `Note [Sharing when zonking to Type]` ------------------------- Metric Decrease: T9198 -------------------------
* hie: Initialise the proper environment for calling dsExprMatthew Pickering2021-04-151-8/+13
| | | | | | | | | | | | | | | | We now use DsM as the base monad for writing hie files and properly initialise it from the TcGblEnv. Before, we would end up reading the interface file from disk for the module we were currently compiling. The modules iface then ended up in the EPS causing all sorts of subtle carnage, including difference in the generated core and haddock emitting a lot of warnings. With the fix, the module in the TcGblEnv is set correctly so the lookups happen in the local name env rather than thinking the identifier comes from an external package. Fixes #19693 and #19334
* Fix some negation issues when creating FractionalLitMatthew Pickering2021-04-147-3/+30
| | | | | | | | | | There were two different issues: 1. integralFractionalLit needed to be passed an already negated value. (T19680) 2. negateFractionalLit did not actually negate the argument, only flipped the negation flag. (T19680A) Fixes #19680
* Add isInjectiveTyCon check to opt_univ (fixes #19509)Adam Gundry2021-04-141-0/+18
|
* Prelude: Fix version bound on Bits importPeter Trommler2021-04-141-2/+1
| | | | Fixes #19683
* Data.List strictness optimisations for maximumBy and minimumByHécate Moonlight2021-04-141-14/+21
| | | | follow-up from !4675
* Always generate ModDetails from ModIfaceMatthew Pickering2021-04-1417-234/+116
| | | | | | | | | | | | | | | | | | This vastly reduces memory usage when compiling with `--make` mode, from about 900M when compiling Cabal to about 300M. As a matter of uniformity, it also ensures that reading from an interface performs the same as using the in-memory cache. We can also delete all the horrible knot-tying in updateIdInfos. Goes some way to fixing #13586 Accept new output of tests fixing some bugs along the way ------------------------- Metric Decrease: T12545 -------------------------
* configure: Bump version to 9.3wip/bump-versionBen Gamari2021-04-132-1/+1
| | | | Bumps the `haddock` submodule.
* Add {lifted,unlifted}DataConKey to pretendNameIsInScope's list of NamesRyan Scott2021-04-1311-1/+56
| | | | Fixes #19688.
* Produce constant file atomically (#19684)Sylvain Henry2021-04-132-6/+18
|
* Make the specialiser handle polymorphic specialisationSimon Peyton Jones2021-04-135-50/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | Ticket #13873 unexpectedly showed that a SPECIALISE pragma made a program run (a lot) slower, because less specialisation took place overall. It turned out that the specialiser was missing opportunities because of quantified type variables. It was quite easy to fix. The story is given in Note [Specialising polymorphic dictionaries] Two other minor fixes in the specialiser * There is no benefit in specialising data constructor /wrappers/. (They can appear overloaded because they are given a dictionary to store in the constructor.) Small guard in canSpecImport. * There was a buglet in the UnspecArg case of specHeader, in the case where there is a dead binder. We need a LitRubbish filler for the specUnfolding stuff. I expanded Note [Drop dead args from specialisations] to explain. There is a 4% increase in compile time for T13056, because we generate more specialised code. This seems OK. Metric Increase: T13056
* hadrian: Provide build rule for ghc-stage3 wrapperStefan Schulze Frielinghaus2021-04-131-0/+1
|
* CI: Also ignore metric decreases on masterMatthew Pickering2021-04-121-0/+8
| | | | | | Otherwise, if the marge batch has decreased metrics, they will fail on master which will result in the pipeline being cut short and the expected metric values for the other jobs will not be updated.
* Turn T11545 into a normal performance testMatthew Pickering2021-04-121-2/+2
| | | | | This makes it more robust to people running it with `quick` flavour and so on.
* Add regression test for T19615Matthew Pickering2021-04-123-0/+24
| | | | Fixes #19615
* template-haskell: Run TH splices with err_vars from current contextMatthew Pickering2021-04-124-1/+21
| | | | | | Otherwise, errors can go missing which arise when running the splices. Fixes #19470
* More accurate SrcSpan when reporting redundant constraintsSimon Peyton Jones2021-04-1219-58/+204
| | | | | | | | | | | | | | | | | | | | | | | | We want an accurate SrcSpan for redundant constraints: • Redundant constraint: Eq a • In the type signature for: f :: forall a. Eq a => a -> () | 5 | f :: Eq a => a -> () | ^^^^ This patch adds some plumbing to achieve this * New data type GHC.Tc.Types.Origin.ReportRedundantConstraints (RRC) * This RRC value is kept inside - FunSigCtxt - ExprSigCtxt * Then, when reporting the error in GHC.Tc.Errors, use this SrcSpan to control the error message: GHC.Tc.Errors.warnRedundantConstraints Quite a lot of files are touched in a boring way.
* Fix magicDict in ghci (and in the presence of other ticks)Matthew Pickering2021-04-109-3/+71
| | | | | | | | | | | The problem was that ghci inserts some ticks around the crucial bit of the expression. Just like in some of the other rules we now strip the ticks so that the rule fires more reliably. It was possible to defeat magicDict by using -fhpc as well, so not just an issue in ghci. Fixes #19667 and related to #19673
* tests: Allow --skip-perf-tests/--only-perf-tests to be used with ↵Matthew Pickering2021-04-101-1/+1
| | | | --ignore-perf-failures
* Use CI_MERGE_REQUEST_SOURCE_BRANCH_NAME rather than undefined ↵Matthew Pickering2021-04-101-1/+3
| | | | | GITLAB_CI_BRANCH env var See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
* Report actual port in libiserv:Remote.Slave.startSlaveFacundo Domínguez2021-04-101-1/+2
| | | | | | This allows to start iserv by passing port 0 to startSlave, which in turns allows to get an available port when no port is known to be free a priori.
* Add missing relational constant folding for sized numeric typesJohn Ericson2021-04-104-11/+118
|
* Allow C-- to scrutinize non-native-size wordsJohn Ericson2021-04-103-10/+17
|
* Constants: add a note and fix minor doc glitchesSylvain Henry2021-04-104-29/+79
|
* Don't produce platformConstants fileSylvain Henry2021-04-105-25/+0
| | | | It isn't used for anything anymore
* Read constants header instead of global platformConstantsSylvain Henry2021-04-1010-38/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | With this patch we switch from reading the globally installed platformConstants file to reading the DerivedConstants.h header file that is bundled in the RTS unit. When we build the RTS unit itself, we get it from its includes directories. The new parser is more efficient and strict than the Read instance for PlatformConstants and we get about 2.2MB less allocations in every cases. However it only really shows in tests that don't allocate much, hence the following metric decreases. Metric Decrease: Naperian T10421 T10547 T12150 T12234 T12425 T13035 T18304 T18923 T5837 T6048 T18140
* Generate parser for DerivedConstants.hSylvain Henry2021-04-101-31/+89
| | | | | | deriveConstants utility now generates a Haskell parser for DerivedConstants.h. It can be used to replace the one used to read platformConstants file.
* Enhance pretty-printing perfSylvain Henry2021-04-104-58/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few refactorings made after looking at Core/STG * Use Doc instead of SDoc in pprASCII to avoid passing the SDocContext that is never used. * Inline every SDoc wrappers in GHC.Utils.Outputable to expose Doc constructs * Add text/[] rule for empty strings (i.e., text "") * Use a single occurrence of pprGNUSectionHeader * Use bangs on Platform parameters and some others Metric Decrease: ManyAlternatives ManyConstructors T12707 T13035 T13379 T18698a T18698b T1969 T3294 T4801 T5321FD T783
* Implement list `fold` and `foldMap` via mconcatKoz Ross2021-04-106-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This allows specialized mconcat implementations an opportunity to combine elements efficiently in a single pass. - Inline the default implementation of `mconcat`, this may result in list fusion. - In Monoids with strict `mappend`, implement `mconcat` as a strict left fold: * And (FiniteBits) * Ior (FiniteBits) * Xor (FiniteBits) * Iff (FiniteBits) * Max (Ord) * Min (Ord) * Sum (Num) * Product (Num) * (a -> m) (Monoid m) - Delegate mconcat for WrappedMonoid to the underlying monoid. Resolves: #17123 Per the discussion in !4890, we expect some stat changes: * T17123(normal) run/alloc 403143160.0 4954736.0 -98.8% GOOD This is the expected improvement in `fold` for a long list of `Text` elements. * T13056(optasm) ghc/alloc 381013328.0 447700520.0 +17.5% BAD Here there's an extra simplifier run as a result of the new methods of the Foldable instance for List. It looks benign. The test is a micro benchmark that compiles just the derived foldable instances for a pair of structures, a cost of this magnitude is not expected to extend to more realistic programs. * T9198(normal) ghc/alloc 504661992.0 541334168.0 +7.3% BAD This test regressed from 8.10 and 9.0 back to exponential blowup. This metric also fluctuates, for reasons not yet clear. The issue here is the exponetial blowup, not this MR. Metric Decrease: T17123 Metric Increase: T9198 T13056
* Test #19665 as expect_broken, with commentaryRichard Eisenberg2021-04-104-8/+35
|
* Clarify commentary around the constraint solverRichard Eisenberg2021-04-103-32/+104
| | | | | No changes to code; no changes to theory. Just better explanation.
* Kick out fewer equalities by thinking harderRichard Eisenberg2021-04-102-27/+44
| | | | | | | | | | | | | | | | Close #17672. By scratching our heads quite hard, we realized that we should never kick out Given/Nominal equalities. This commit tweaks the kick-out conditions accordingly. See also Note [K4] which describes what is going on. This does not fix a known misbehavior, but it should be a small improvement in both practice (kicking out is bad, and we now do less of it) and theory (a Given/Nominal should behave just like a filled-in metavariable, which has no notion of kicking out).
* Tweak kick-out condition K2b to deal with LHSsRichard Eisenberg2021-04-105-52/+205
| | | | | | | | | | | | | | Kick out condition K2b really only makes sense for inerts with a type variable on the left. This updates the commentary and the code to skip this check for inerts with type families on the left. Also cleans up some commentary around solver invariants and adds Note [K2b]. Close #19042. test case: typecheck/should_compile/T19042
* Bignum: add BigNat Eq/Ord instances (#19647)Sylvain Henry2021-04-091-0/+16
|
* Update HACKING.mdMatthew Pickering2021-04-091-1/+1
|
* [docs] release notes for !4729 + !3678Douglas Wilson2021-04-091-1/+33
| | | | Also includes small unrelated type fix
* Add perf test for #15304Matthew Pickering2021-04-093-0/+778
| | | | | The test max memory usage improves dramatically with the fixes to memory usage in demand analyser from #15455
* Don't tidy type in pprTypeForUserMatthew Pickering2021-04-092-22/+10
| | | | | | | | | | | | | | | | There used to be some cases were kinds were not generalised properly before being printed in GHCi. This seems to have changed in the past so now it's uncessary to tidy before printing out the test case. ``` > :set -XPolyKinds > data A x y > :k A k1 -> k2 -> A ``` This tidying was causing issues with an attempt to increase sharing by making `mkTyConApp` (see !4762)
* Avoid repeated zonking and tidying of types in `relevant_bindings`Matthew Pickering2021-04-091-41/+81
| | | | | | | | | | | The approach taking in this patch is that the tcl_bndrs in TcLclEnv are zonked and tidied eagerly, so that work can be shared across multiple calls to `relevant_bindings`. To test this patch I tried without the `keepThisHole` filter and the test finished quickly. Fixes #14766