summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clean up the inferred type variable restrictionwip/T18432-T18455Ryan Scott2020-07-2914-128/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch primarily: * Documents `checkInferredVars` (previously called `check_inferred_vars`) more carefully. This is the function which throws an error message if a user quantifies an inferred type variable in a place where specificity cannot be observed. See `Note [Unobservably inferred type variables]` in `GHC.Rename.HsType`. Note that I now invoke `checkInferredVars` _alongside_ `rnHsSigType`, `rnHsWcSigType`, etc. rather than doing so _inside_ of these functions. This results in slightly more call sites for `checkInferredVars`, but it makes it much easier to enumerate the spots where the inferred type variable restriction comes into effect. * Removes the inferred type variable restriction for default method type signatures, per the discussion in #18432. As a result, this patch fixes #18432. Along the way, I performed some various cleanup: * I moved `no_nested_foralls_contexts_err` into `GHC.Rename.Utils` (under the new name `noNestedForallsContextsErr`), since it now needs to be invoked from multiple modules. I also added a helper function `addNoNestedForallsContextsErr` that throws the error message after producing it, as this is a common idiom. * In order to ensure that users cannot sneak inferred type variables into `SPECIALISE instance` pragmas by way of nested `forall`s, I now invoke `addNoNestedForallsContextsErr` when renaming `SPECIALISE instance` pragmas, much like when we rename normal instance declarations. (This probably should have originally been done as a part of the fix for #18240, but this task was somehow overlooked.) As a result, this patch fixes #18455 as a side effect.
* ghc/mk: don't build gmp packages for BIGNUM_BACKEND=nativeSergei Trofimovich2020-07-281-0/+2
| | | | | | | | | | | | | | | Before this change make-based `BIGNUM_BACKEND=native` build was failing as: ``` x86_64-pc-linux-gnu-gcc: error: libraries/ghc-bignum/gmp/objs/*.o: No such file or directory ``` This happens because ghc.mk was pulling in gmp-dependent ghc-bignum library unconditionally. The change avoid building ghc-bignum. Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/18437 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Fix typo in haddockOleg Grenrus2020-07-281-1/+1
| | | | Spotted by `vilpan` on `#haskell`
* config: Fix Haskell platform constructor w/ paramsPeter Trommler2020-07-281-4/+4
| | | | Fixes #18505
* Bignum: add support for negative shifts (fix #18499)Sylvain Henry2020-07-284-4/+60
| | | | | | | shiftR/shiftL support negative arguments despite Haskell 2010 report saying otherwise. We explicitly test for negative values which is bad (it gets in the way of constant folding, etc.). Anyway, for consistency we fix Bits instancesof Integer/Natural.
* This patch addresses the exponential blow-up in the simplifier.Simon Peyton Jones2020-07-2833-277/+848
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: #13253 exponential inlining #10421 ditto #18140 strict constructors #18282 another nested-function call case This patch makes one really significant changes: change the way that mkDupableCont handles StrictArg. The details are explained in GHC.Core.Opt.Simplify Note [Duplicating StrictArg]. Specific changes * In mkDupableCont, when making auxiliary bindings for the other arguments of a call, add extra plumbing so that we don't forget the demand on them. Otherwise we haev to wait for another round of strictness analysis. But actually all the info is to hand. This change affects: - Make the strictness list in ArgInfo be [Demand] instead of [Bool], and rename it to ai_dmds. - Add as_dmd to ValArg - Simplify.makeTrivial takes a Demand - mkDupableContWithDmds takes a [Demand] There are a number of other small changes 1. For Ids that are used at most once in each branch of a case, make the occurrence analyser record the total number of syntactic occurrences. Previously we recorded just OneBranch or MultipleBranches. I thought this was going to be useful, but I ended up barely using it; see Note [Note [Suppress exponential blowup] in GHC.Core.Opt.Simplify.Utils Actual changes: * See the occ_n_br field of OneOcc. * postInlineUnconditionally 2. I found a small perf buglet in SetLevels; see the new function GHC.Core.Opt.SetLevels.hasFreeJoin 3. Remove the sc_cci field of StrictArg. I found I could get its information from the sc_fun field instead. Less to get wrong! 4. In ArgInfo, arrange that ai_dmds and ai_discs have a simpler invariant: they line up with the value arguments beyond ai_args This allowed a bit of nice refactoring; see isStrictArgInfo, lazyArgcontext, strictArgContext There is virtually no difference in nofib. (The runtime numbers are bogus -- I tried a few manually.) Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- fft +0.0% -2.0% -48.3% -49.4% 0.0% multiplier +0.0% -2.2% -50.3% -50.9% 0.0% -------------------------------------------------------------------------------- Min -0.4% -2.2% -59.2% -60.4% 0.0% Max +0.0% +0.1% +3.3% +4.9% 0.0% Geometric Mean +0.0% -0.0% -33.2% -34.3% -0.0% Test T18282 is an existing example of these deeply-nested strict calls. We get a big decrease in compile time (-85%) because so much less inlining takes place. Metric Decrease: T18282
* gitlab-ci: Bump bootstrap compiler to 8.8.4Ben Gamari2020-07-271-6/+6
| | | | Hopefully this will make the Windows jobs a bit more reliable.
* gitlab-ci: Ensure that Hadrian jobs don't download artifactsBen Gamari2020-07-271-0/+1
| | | | | | Previously the Hadrian jobs had the default dependencies, meaning that they would download artifacts from all jobs of earlier stages. This is unneccessary.
* Eta-expand the Simplifier monadSimon Peyton Jones2020-07-271-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch eta-expands the Simplifier's monad, using the method explained in GHC.Core.Unify Note [The one-shot state monad trick]. It's part of the exta-expansion programme in #18202. It's a tiny patch, but is worth a 1-2% reduction in bytes-allocated by the compiler. Here's the list, based on the compiler-performance tests in perf/compiler: Reduction in bytes allocated T10858(normal) -0.7% T12425(optasm) -1.3% T13056(optasm) -1.8% T14683(normal) -1.1% T15164(normal) -1.3% T15630(normal) -1.4% T17516(normal) -2.3% T18282(normal) -1.6% T18304(normal) -0.8% T1969(normal) -0.6% T4801(normal) -0.8% T5321FD(normal) -0.7% T5321Fun(normal) -0.5% T5642(normal) -0.9% T6048(optasm) -1.1% T9020(optasm) -2.7% T9233(normal) -0.7% T9675(optasm) -0.5% T9961(normal) -2.9% WWRec(normal) -1.2% Metric Decrease: T12425 T9020 T9961
* Use allocate, not ALLOC_PRIM_P for unpackClosure#Michalis Pardalos2020-07-271-5/+7
| | | | | | | ALLOC_PRIM_P fails for large closures, by directly using allocate we can handle closures which are larger than the block size. Fixes #12492
* Add minimal test for #12492Michalis Pardalos2020-07-272-0/+12
|
* Drop 32-bit Windows supportBen Gamari2020-07-272-37/+5
| | | | As noted in #18487, we have reached the end of this road.
* Refactor the parser a littleVladislav Zavialov2020-07-272-39/+23
| | | | | | * Create a dedicated production for type operators * Create a dedicated type for the UNPACK pragma * Remove an outdated part of Note [Parsing data constructors is hard]
* fix typo referring to non-existent `-ohidir` flag, should be `-hidir` I thinkleiftw2020-07-271-1/+1
|
* Improve NegativeLiterals (#18022, GHC Proposal #344)Vladislav Zavialov2020-07-277-39/+149
| | | | | | | | | | | | | | | | | | | | Before this patch, NegativeLiterals used to parse x-1 as x (-1). This may not be what the user expects, and now it is fixed: x-1 is parsed as (-) x 1. We achieve this by the following requirement: * When lexing a negative literal, it must not be preceded by a 'closing token'. This also applies to unboxed literals, e.g. -1#. See GHC Proposal #229 for the definition of a closing token. A nice consequence of this change is that -XNegativeLiterals becomes a subset of -XLexicalNegation. In other words, enabling both of those extensions has the same effect as enabling -XLexicalNegation alone.
* winio: update codeownersTamar Christina2020-07-261-0/+15
|
* winio: fix detection of tty terminalsTamar Christina2020-07-261-2/+2
|
* winio: remove dead argument to stg_newIOPortzhTamar Christina2020-07-261-1/+1
|
* gitlab-ci: Kill ssh-agent after pushing test metricsBen Gamari2020-07-261-0/+5
| | | | | Otherwise the Windows builds hang forever waiting for the process to terminate.
* testsuite: Normalise WinIO error message differencesBen Gamari2020-07-262-3/+27
| | | | | Previously the old Windows IO manager threw different errors than WinIO. We now canonicalise these to the WinIO errors.
* testsuite: Update win32 output for parseTreeBen Gamari2020-07-261-7/+7
|
* rts/win32: Exit with EXIT_HEAPOVERFLOW if memory commit failsBen Gamari2020-07-261-1/+1
| | | | | | | | Since switching to the two-step allocator, the `outofmem` test fails via `osCommitMemory` failing to commit. However, this was previously exiting with `EXIT_FAILURE`, rather than `EXIT_HEAPOVERFLOW`. I think the latter is a more reasonable exit code for this case and matches the behavior on POSIX platforms.
* Document loadFramework changes. (#18446)Matthias Andreas Benkard2020-07-261-0/+35
| | | | | Adds commentary on the rationale for the changes made in merge request !3689.
* Require SMP support in order to build a threaded stage1Stefan Schulze Frielinghaus2020-07-251-1/+5
| | | | Fixes 18266
* Add accessors to ArchOSSylvain Henry2020-07-251-1/+4
|
* Bump CountParserDepsSylvain Henry2020-07-251-1/+1
|
* Fix build systemsSylvain Henry2020-07-258-30/+15
|
* Move GHC.Platform into the compilerSylvain Henry2020-07-2518-349/+337
| | | | | | | Previously it was in ghc-boot so that ghc-pkg could use it. However it wasn't necessary because ghc-pkg only uses a subset of it: reading target arch and OS from the settings file. This is now done via GHC.Platform.ArchOS (was called PlatformMini before).
* Remove dead code in utils/derivConstantsSylvain Henry2020-07-251-48/+0
|
* Remove platform constant wrappersSylvain Henry2020-07-2541-1289/+1392
| | | | | | | | | | Platform constant wrappers took a DynFlags parameter, hence implicitly used the target platform constants. We removed them to allow support for several platforms at once (#14335) and to avoid having to pass the full DynFlags to every function (#17957). Metric Decrease: T4801
* Put PlatformConstants into PlatformSylvain Henry2020-07-2512-28/+49
|
* Add GHC.Platform.ProfileSylvain Henry2020-07-255-26/+61
|
* Rename GHC.Driver.Ways into GHC.Platform.WaysSylvain Henry2020-07-2515-15/+15
|
* DynFlags: store printer in TraceBinIfaceReadingSylvain Henry2020-07-252-33/+36
| | | | | We don't need to pass the whole DynFlags, just pass the logging function, if any.
* Simplify XRec definitionZubin Duggal2020-07-2524-337/+403
| | | | | | | | | | | | Change `Located X` usage to `XRec pass X` This increases the scope of the LPat experiment to almost all of GHC. Introduce UnXRec and MapXRec classes Fixes #17587 and #18408 Updates haddock submodule Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
* Care with occCheckExpand in kind of occurrencesSimon Peyton Jones2020-07-2410-40/+170
| | | | | | | | | | | | | | | | | | | Issue #18451 showed that we could get an infinite type, through over-use of occCheckExpand in the kind of an /occurrence/ of a type variable. See Note [Occurrence checking: look inside kinds] in GHC.Core.Type This patch fixes the problem by making occCheckExpand less eager to expand synonyms in kinds. It also improves pretty printing of kinds, by *not* suppressing the kind on a tyvar-binder like (a :: Const Type b) where type Const p q = p. Even though the kind of 'a' is Type, we don't want to suppress the kind ascription. Example: the error message for polykinds/T18451{a,b}. See GHC.Core.TyCo.Ppr Note [Suppressing * kinds].
* winio: change memory allocation strategy and fix double free errors.Tamar Christina2020-07-242-73/+95
|
* winio: restore console cp on exitTamar Christina2020-07-243-2/+39
|
* [linker] Fix out of range relocations.Moritz Angermann2020-07-238-28/+122
| | | | | | | | | | | | mmap may return address all over the place. mmap_next will ensure we get the next free page after the requested address. This is especially important for linking on aarch64, where the memory model with PIC admits relocations in the +-4GB range, and as such we can't work with arbitrary object locations in memory. Of note: we map the rts into process space, so any mapped objects must not be ouside of the 4GB from the processes address space.
* Minor refactoring of Unit displaySylvain Henry2020-07-227-56/+63
| | | | | | | | * for consistency, try to always use UnitPprInfo to display units to users * remove some uses of `unitPackageIdString` as it doesn't show the component name and it uses String
* Add regression test for #18478Sebastian Graf2020-07-222-0/+953
| | | | | | !3392 backported !2993 to GHC 8.10.2 which most probably is responsible for fixing #18478, which triggered a pattern match checker performance regression in GHC 8.10.1 as first observed in #17977.
* Define type Void# = (# #) (#18441)Krzysztof Gogolewski2020-07-2226-116/+119
| | | | | There's one backwards compatibility issue: GHC.Prim no longer exports Void#, we now manually re-export it from GHC.Exts.
* Add test for #18064Sylvain Henry2020-07-228-0/+29
| | | | It has been fixed by 0effc57d48ace6b719a9f4cbeac67c95ad55010b
* Deprecate -fdmd-tx-dict-sel.Andreas Klebinger2020-07-224-7/+9
| | | | | | | | | | | It's behaviour is now unconditionally enabled as it's slightly beneficial. There are almost no benchmarks which benefit from disabling it, so it's not worth the keep this configurable. This fixes #18429.
* Replace HscTarget with BackendSylvain Henry2020-07-2233-277/+333
| | | | | | | | | They both have the same role and Backend name is more explicit. Metric Decrease: T3064 Update Haddock submodule
* Replace ghcWithNativeCodeGen with a proper Backend datatypeSylvain Henry2020-07-2212-46/+71
| | | | | | | | | | | | | | | | * Represent backends with a `Backend` datatype in GHC.Driver.Backend * Don't detect the default backend to use for the target platform at compile time in Hadrian/make but at runtime. It makes "Settings" simpler and it is a step toward making GHC multi-target. * The latter change also fixes hadrian which has not been updated to take into account that the NCG now supports AIX and PPC64 (cf df26b95559fd467abc0a3a4151127c95cb5011b9 and d3c1dda60d0ec07fc7f593bfd83ec9457dfa7984) * Also we don't treat iOS specifically anymore (cf cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f)
* Correctly test active backendSylvain Henry2020-07-221-1/+1
| | | | | | Previously we used a platform settings to detect if the native code generator was used. This was wrong. We need to use the `DynFlags.hscTarget` field instead.
* Remove unused sGhcWithNativeCodeGenSylvain Henry2020-07-222-4/+0
|
* Don't panic if the NCG isn't built (it is always built)Sylvain Henry2020-07-221-4/+0
|
* Remove unused "ncg" flagSylvain Henry2020-07-222-7/+1
| | | | | This flag has been removed in 066b369de2c6f7da03c88206288dca29ab061b31 in 2011.