summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Stashing away stuffwip/T14620Sebastian Graf2022-06-081-53/+102
|
* WIP: Fix #14620 by introducing WW to detect more join pointsSebastian Graf2020-09-238-92/+408
|
* PmCheck: Rewrite inhabitation testSebastian Graf2020-09-2211-1225/+1210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to produce inhabitants of a pattern-match refinement type Nabla in the checker in at least two different and mostly redundant ways: 1. There was `provideEvidence` (now called `generateInhabitingPatterns`) which is used by `GHC.HsToCore.PmCheck` to produce non-exhaustive patterns, which produces inhabitants of a Nabla as a sub-refinement type where all match variables are instantiated. 2. There also was `ensure{,All}Inhabited` (now called `inhabitationTest`) which worked slightly different, but was whenever new type constraints or negative term constraints were added. See below why `provideEvidence` and `ensureAllInhabited` can't be the same function, the main reason being performance. 3. And last but not least there was the `nonVoid` test, which tested that a given type was inhabited. We did use this for strict fields and -XEmptyCase in the past. The overlap of (3) with (2) was always a major pet peeve of mine. The latter was quite efficient and proven to work for recursive data types, etc, but could not handle negative constraints well (e.g. we often want to know if a *refined* type is empty, such as `{ x:[a] | x /= [] }`). Lower Your Guards suggested that we could get by with just one, by replacing both functions with `inhabitationTest` in this patch. That was only possible by implementing the structure of φ constraints as in the paper, namely the semantics of φ constructor constraints. This has a number of benefits: a. Proper handling of unlifted types and strict fields, fixing #18249, without any code duplication between `GHC.HsToCore.PmCheck.Oracle.instCon` (was `mkOneConFull`) and `GHC.HsToCore.PmCheck.checkGrd`. b. `instCon` can perform the `nonVoid` test (3) simply by emitting unliftedness constraints for strict fields. c. `nonVoid` (3) is thus simply expressed by a call to `inhabitationTest`. d. Similarly, `ensureAllInhabited` (2), which we called after adding type info, now can similarly be expressed as the fuel-based `inhabitationTest`. See the new `Note [Why inhabitationTest doesn't call generateInhabitingPatterns]` why we still have tests (1) and (2). Fixes #18249 and brings nice metric decreases for `T17836` (-76%) and `T17836b` (-46%), as well as `T18478` (-8%) at the cost of a few very minor regressions (< +2%), potentially due to the fact that `generateInhabitingPatterns` does more work to suggest the minimal COMPLETE set. Metric Decrease: T17836 T17836b
* PmCheck - Comments only: Replace /~ by ≁Sebastian Graf2020-09-223-33/+33
|
* Fix the occurrence analyserSimon Peyton Jones2020-09-224-480/+611
| | | | | | | | | | | | | | | | | | | Ticket #18603 demonstrated that the occurrence analyser's handling of local RULES for imported Ids (which I now call IMP-RULES) was inadequate. It led the simplifier into an infnite loop by failing to label a binder as a loop breaker. The main change in this commit is to treat IMP-RULES in a simple and uniform way: as extra rules for the local binder. See Note [IMP-RULES: local rules for imported functions] This led to quite a bit of refactoring. The result is still tricky, but it's much better than before, and better documented I think. Oh, and it fixes the bug.
* Better eta-expansion (again) and don't specilise DFunsSimon Peyton Jones2020-09-2216-698/+870
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes #18223, which made GHC generate an exponential amount of code. There are three quite separate changes in here 1. Re-engineer eta-expansion (again). The eta-expander was generating lots of intermediate stuff, which could be optimised away, but which choked the simplifier meanwhile. Relatively easy to kill it off at source. See Note [The EtaInfo mechanism] in GHC.Core.Opt.Arity. The main new thing is the use of pushCoArg in getArg_maybe. 2. Stop Specialise specalising DFuns. This is the cause of a huge (and utterly unnecessary) blowup in program size in #18223. See Note [Do not specialise DFuns] in GHC.Core.Opt.Specialise. I also refactored the Specialise monad a bit... it was silly, because it passed on unchanging values as if they were mutable state. 3. Do an extra Simplifer run, after SpecConstra and before late-Specialise. I found (investigating perf/compiler/T16473) that failing to do this was crippling *both* SpecConstr *and* Specialise. See Note [Simplify after SpecConstr] in GHC.Core.Opt.Pipeline. This change does mean an extra run of the Simplifier, but only with -O2, and I think that's acceptable. T16473 allocates *three* times less with this change. (I changed it to check runtime rather than compile time.) Some smaller consequences * I moved pushCoercion, pushCoArg and friends from SimpleOpt to Arity, because it was needed by the new etaInfoApp. And pushCoValArg now returns a MCoercion rather than Coercion for the argument Coercion. * A minor, incidental improvement to Core pretty-printing This does fix #18223, (which was otherwise uncompilable. Hooray. But there is still a big intermediate because there are some very deeply nested types in that program. Modest reductions in compile-time allocation on a couple of benchmarks T12425 -2.0% T13253 -10.3% Metric increase with -O2, due to extra simplifier run T9233 +5.8% T12227 +1.8% T15630 +5.0% There is a spurious apparent increase on heap residency on T9630, on some architectures at least. I tried it with -G1 and the residency is essentially unchanged. Metric Increase T9233 T12227 T9630 Metric Decrease T12425 T13253
* hadrian: Add extra-deps: happy-1.20 to stack.yamlBen Gamari2020-09-211-0/+3
| | | | | GHC now requires happy-1.20, which isn't available in LTS-16.14. Fixes #18726.
* Disallow constraints in KindSigCtxtRyan Scott2020-09-214-40/+94
| | | | | | | | | | | | | | | | | | | This patch cleans up how `GHC.Tc.Validity` classifies `UserTypeCtxt`s that can only refer to kind-level positions, which is important for rejecting certain classes of programs. In particular, this patch: * Introduces a new `TypeOrKindCtxt` data type and `typeOrKindCtxt :: UserTypeCtxt -> TypeOrKindCtxt` function, which determines whether a `UserTypeCtxt` can refer to type-level contexts, kind-level contexts, or both. * Defines the existing `allConstraintsAllowed` and `vdqAllowed` functions in terms of `typeOrKindCtxt`, which avoids code duplication and ensures that they stay in sync in the future. The net effect of this patch is that it fixes #18714, in which it was discovered that `allConstraintsAllowed` incorrectly returned `True` for `KindSigCtxt`. Because `typeOrKindCtxt` now correctly classifies `KindSigCtxt` as a kind-level context, this bug no longer occurs.
* Remove unused ThBrackCtxt and ResSigCtxtRyan Scott2020-09-213-12/+0
| | | | Fixes #18715.
* testsuite: Mark TH_spliceE5_prof as broken on WindowsGHC GitLab CI2020-09-201-1/+2
| | | | Due to #18721.
* testsuite: Mark tempfiles as broken on Win32 without WinIOGHC GitLab CI2020-09-201-1/+4
| | | | The old POSIX emulation appears to ignore the user-requested prefix.
* testsuite: Fix WinIO error message normalizationGHC GitLab CI2020-09-201-4/+6
| | | | This wasn't being applied to stderr.
* testsuite: Mark some GHCi/Makefile tests as broken on WindowsBen Gamari2020-09-204-0/+5
| | | | See #18718.
* testsuite: Update expected output for outofmem on WindowsBen Gamari2020-09-201-1/+1
| | | | The error originates from osCommitMemory rather than getMBlocks.
* base/testsuite: Add missing LANGUAGE pragma in ThreadDelay001Ben Gamari2020-09-201-0/+1
| | | | Only affected the Windows codepath.
* testsuite: Unmark T5975[ab] as broken on WindowsBen Gamari2020-09-201-2/+2
| | | | | | Sadly it's unclear *why* they have suddenly started working. Closes #7305.
* testsuite: Unmark T12971 as broken on WindowsBen Gamari2020-09-201-1/+1
| | | | | | It's unclear why, but this no longer seems to fail. Closes #17945.
* Resolve shift/reduce conflicts with %shift (#17232)wip/parsing-shiftVladislav Zavialov2020-09-191-218/+332
|
* rts: Drop field initializer on thread_basic_info_data_tBen Gamari2020-09-191-1/+1
| | | | | This struct has a number of fields and we only care that the value is initialized with zeros. This eliminates the warnings noted in #17905.
* Remove GADT self-reference check (#11554, #12081, #12174, fixes #15942)Artyom Kuznetsov2020-09-1911-40/+68
| | | | Reverts 430f5c84dac1eab550110d543831a70516b5cac8
* Unpack the MVar in CompactDavid Feuer2020-09-191-1/+1
| | | The `MVar` lock in `Compact` was unnecessarily lazy, creating an extra indirection and wasting two words. Make it strict.
* hadrian: Fail on Sphinx syntax errorsBen Gamari2020-09-191-0/+15
| | | | | | Specifically the "Inline literal start-string without end-string" warning, which typically means that the user neglected to separate an inline code block from suffix text with a backslash.
* users guide: Fix various documentation issuesBen Gamari2020-09-195-11/+20
|
* Fix a codeblock in ghci.rstAndreas Klebinger2020-09-191-0/+1
|
* Fix docs who misstated how the RTS treats size suffixes.Andreas Klebinger2020-09-191-2/+2
| | | | | | | They are parsed as multiples of 1024. Not 1000. The docs used to imply otherwise. See decodeSize in rts/RtsFlags.c for the logic for this.
* Add quick-validate Hadrian flavour (quick + -Werror)Sylvain Henry2020-09-192-2/+12
|
* Cinch -fno-warn-name-shadowing down to specific GHCi moduleJohn Ericson2020-09-194-1/+6
|
* Bump Stack resolverSylvain Henry2020-09-193-2/+8
|
* Export singleton function from Data.ListWander Hillen2020-09-198-15/+16
| | | | | | | | | | | | | | | Data.OldList exports a monomorphized singleton function but it is not re-exported by Data.List. Adding the export to Data.List causes a conflict with a 14-year old function of the same name and type by SPJ in GHC.Utils.Misc. We can't just remove this function because that leads to a problems when building GHC with a stage0 compiler that does not have singleton in Data.List yet. We also can't hide the function in GHC.Utils.Misc since it is not possible to hide a function from a module if the module does not export the function. To work around this, all places where the Utils.Misc singleton was used now use a qualified version like Utils.singleton and in GHC.Utils.Misc we are very specific about which version we export.
* Wire in constraint tuplesRyan Scott2020-09-196-54/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This wires in the definitions of the constraint tuple classes. The key changes are in: * `GHC.Builtin.Types`, where the `mk_ctuple` function is used to define constraint tuple type constructors, data constructors, and superclass selector functions, and * `GHC.Builtin.Uniques`. In addition to wiring in the `Unique`s for constraint tuple type and data constructors, we now must wire in the superclass selector functions. Luckily, this proves to be not that challenging. See the newly added comments. Historical note: constraint tuples used to be wired-in until about five years ago, when commit 130e93aab220bdf14d08028771f83df210da340b turned them into known-key names. This was done as part of a larger refactor to reduce the number of special cases for constraint tuples, but the commit message notes that the main reason that constraint tuples were made known-key (as opposed to boxed/unboxed tuples, which are wired in) is because it was awkward to wire in the superclass selectors. This commit solves the problem of wiring in superclass selectors. Fixes #18635. ------------------------- Metric Decrease: T10421 T12150 T12227 T12234 T12425 T13056 T13253-spj T18282 T18304 T5321FD T5321Fun T5837 T9961 Metric Decrease (test_env='x86_64-linux-deb9-unreg-hadrian'): T12707 Metric Decrease (test_env='x86_64-darwin'): T4029 -------------------------
* gitlab-ci: Ensure that cabal-install overwrites existing executablesBen Gamari2020-09-191-1/+3
| | | | | Previously cabal-install wouldn't overwrite toolchain executables if they already existed (as they likely would due to caching).
* ci.sh: Enforce minimum happy/alex versionsBen Gamari2020-09-191-10/+8
| | | | | Also, always invoke cabal-install to ensure that happy/alex symlinks are up-to-date.
* Require happy >=1.20Vladislav Zavialov2020-09-194-5/+5
|
* Deprecate Data.Semigroup.OptionSimon Jakobi2020-09-193-6/+6
| | | | | | | | | | | | Libraries email: https://mail.haskell.org/pipermail/libraries/2018-April/028724.html GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/15028 Corresponding PRs for deepseq: * https://github.com/haskell/deepseq/pull/55 * https://github.com/haskell/deepseq/pull/57 Bumps the deepseq submodule.
* rts: Refactor unloading of foreign export StablePtrsBen Gamari2020-09-184-37/+50
| | | | | | Previously we would allocate a linked list cell for each foreign export. Now we can avoid this by taking advantage of the fact that they are already broken into groups.
* rts: Refactor foreign export trackingBen Gamari2020-09-189-45/+209
| | | | | | | | | This avoids calling `libc` in the initializers which are responsible for registering foreign exports. We believe this should avoid the corruption observed in #18548. See Note [Tracking foreign exports] in rts/ForeignExports.c for an overview of the new scheme.
* rts/nonmoving: Add missing STM write barrierBen Gamari2020-09-181-0/+3
| | | | | | When updating a TRec for a TVar already part of a transaction we previously neglected to add the old value to the update remembered set. I suspect this was the cause of #18587.
* Bignum: add clamping naturalToWord (fix #18697)Sylvain Henry2020-09-171-0/+8
|
* Remove pprPrec from Outputable (unused)Sylvain Henry2020-09-171-8/+1
|
* Add note about OutputablePSylvain Henry2020-09-171-9/+108
|
* Generalize OutputablePSylvain Henry2020-09-1719-111/+182
| | | | | Add a type parameter for the environment required by OutputableP. It avoids tying Platform with OutputableP.
* Introduce OutputablePSylvain Henry2020-09-1742-700/+777
| | | | | | | | | | | | | | | | | | | | | | | | | Some types need a Platform value to be pretty-printed: CLabel, Cmm types, instructions, etc. Before this patch they had an Outputable instance and the Platform value was obtained via sdocWithDynFlags. It meant that the *renderer* of the SDoc was responsible of passing the appropriate Platform value (e.g. via the DynFlags given to showSDoc). It put the burden of passing the Platform value on the renderer while the generator of the SDoc knows the Platform it is generating the SDoc for and there is no point passing a different Platform at rendering time. With this patch, we introduce a new OutputableP class: class OutputableP a where pdoc :: Platform -> a -> SDoc With this class we still have some polymorphism as we have with `ppr` (i.e. we can use `pdoc` on a variety of types instead of having a dedicated `pprXXX` function for each XXX type). One step closer removing `sdocWithDynFlags` (#10143) and supporting several platforms (#14335).
* Documented '-m' flags for machine specific instruction extensions.Benjamin Maurer2020-09-172-11/+142
| | | | See #18641 'Documenting the Expected Undocumented Flags'
* Parser.y: clarify treatment of @{-# UNPACK #-}Vladislav Zavialov2020-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, we had this parser production: ftype : ... | ftype PREFIX_AT tyarg { ... } And 'tyarg' is defined as follows: tyarg : atype { ... } | unpackedness atype { ... } So one might get the (false) impression that that parser production is intended to parse things like: F @{-# UNPACK #-} X However, the lexer wouldn't produce PREFIX_AT followed by 'unpackedness', as the '@' operator followed by '{-' is not considered prefix. Thus there's no point using 'tyarg' after PREFIX_AT, and a simple 'atype' will suffice: ftype : ... | ftype PREFIX_AT atype { ... } This change has no user-facing consequences. It just makes the grammar a bit more clear.
* CosmeticLeif Metcalf2020-09-171-1/+1
|
* Make Z-encoding comment into a noteLeif Metcalf2020-09-172-2/+4
|
* Bump version to 9.0Ben Gamari2020-09-172-1/+1
| | | | | | Bumps haskeline and haddock submodules. (cherry picked from commit f218cfc92f7b1a1e01190851972bb9a0e0f3c682)
* Bump Win32 submodule to 2.9.0.0Ben Gamari2020-09-178-5/+5
| | | | Also bumps Cabal, directory
* rts/win32: Fix missing #include'sBen Gamari2020-09-172-1/+3
| | | | These slipped through CI.
* Make the 'IsString (Const a b)' instance polykinded on 'b'Cary Robbins2020-09-171-1/+3
|