summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Unused identifierswip/all-inlinable-headMatthew Pickering2017-01-091-2/+2
|
* Always expose unfoldings for overloaded functions.Matthew Pickering2017-01-092-2/+10
| | | | | | | | | | | | | | | | | | | | | Summary: Users expect their overloaded functions to be specialised at call sites, however, this is only the case if they are either lucky and GHC chooses to include the unfolding or they mark their definition with an INLINABLE pragma. This leads to library authors marking all their functions with `INLINABLE` (or more accurately `INLINE`) so they ensure that downstream consumers pay no cost for their abstraction. A more sensible default is to do this job for the library author and give more predictable guarantees about specialisation. Empirically, I compiled a selection of 1150 packages with (a similar) patch applied. The total size of the interface files before the patch was 519mb and after 634mb. On modern machines, I think this increase is justified for the result. Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2929
* Parse holes as infix operatorsÖmer Sinan Ağacan2017-01-085-0/+42
| | | | | | | | | | | | | | | | Reported as #13050. Since holes are expressions but not identifiers, holes were not allowed in infix operator position. This patch introduces a new production in infix operator parser to allow this. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: simonpj, RyanGlScott, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2910 GHC Trac Issues: #13050
* TH: Add Trustworthy language pragmaErik de Castro Lopo2017-01-083-6/+6
| | | | | | | | | | | | | | Test Plan: validate Reviewers: goldfire, bgamari, austin, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, simonpj, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D2546 GHC Trac Issues: #12511
* Have addModFinalizer expose the local type environment.Facundo Domínguez2017-01-063-0/+17
| | | | | | | | | | | | | | | | Kind inference in ghci was interfered when renaming of type splices introduced the HsSpliced data constructor. This patch has kind inference skip over it. Test Plan: ./validate Reviewers: simonpj, rrnewton, bgamari, goldfire, austin Subscribers: thomie, mboes Differential Revision: https://phabricator.haskell.org/D2886 GHC Trac Issues: #12985
* Revert "Have addModFinalizer expose the local type environment."Facundo Domínguez2017-01-0614-305/+206
| | | | This reverts commit e5d1ed9c8910839e109da59820ca793642961284.
* Actually add the right file for T13035 stderrMatthew Pickering2017-01-061-1/+4
|
* Have addModFinalizer expose the local type environment.Facundo Domínguez2017-01-0614-206/+305
| | | | | | | | | | | | | | | | | | | Summary: Kind inference in ghci was interfered when renaming of type splices introduced the HsSpliced data constructor. This patch has kind inference skip over it. Test Plan: ./validate Reviewers: simonpj, rrnewton, austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: thomie, mboes Differential Revision: https://phabricator.haskell.org/D2886 GHC Trac Issues: #12985
* Add missing stderr file for T13035Matthew Pickering2017-01-061-1/+1
|
* More fixes for #5654Simon Marlow2017-01-0610-62/+170
| | | | | | | | | | | | | | * In stg_ap_0_fast, if we're evaluating a thunk, the thunk might evaluate to a function in which case we may have to adjust its CCS. * The interpreter has its own implementation of stg_ap_0_fast, so we have to do the same shenanigans with creating empty PAPs and copying PAPs there. * GHCi creates Cost Centres as children of CCS_MAIN, which enterFunCCS() wrongly assumed to imply that they were CAFs. Now we use the is_caf flag for this, which we have to correctly initialise when we create a Cost Centre in GHCi.
* Add performance test for #13056Ryan Scott2017-01-062-1/+36
| | | | | | This performance regression was fixed by commit 517d03e41b4f5c144d1ad684539340421be2be2a (#12234). Let's add a performance test to ensure that it doesn't break again.
* Fix the implementation of the "push rules"Simon Peyton Jones2017-01-065-153/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Richard pointed out (comment:12 of Trac #13025) that my implementation of the coercion "push rules", newly added in exprIsConAppMaybe by commit b4c3a66, wasn't quite right. But in fact that means that the implementation of those same rules in Simplify.simplCast was wrong too. Hence this commit: * Refactor the push rules so they are implemented in just one place (CoreSubst.pushCoArgs, pushCoTyArg, pushCoValArg) The code in Simplify gets simpler, which is nice. * Fix the bug that Richard pointed out (to do with hetero-kinded coercions) Then compiler performance worsened, which led mt do discover two performance bugs: * The smart constructor Coercion.mkNthCo didn't have a case for ForAllCos, which meant we stupidly build a complicated coercion where a simple one would do * In OptCoercion there was one place where we used CoherenceCo (the data constructor) rather than mkCoherenceCo (the smart constructor), which meant that the the stupid complicated coercion wasn't optimised away For reasons I don't fully understand, T5321Fun did 2% less compiler allocation after all this, which is good.
* Avoid exponential blowup in FamInstEnv.normaliseTypeSimon Peyton Jones2017-01-064-13/+190
| | | | | | Trac #13035 showed up a nasty case where we took exponentially long to normalise a (actually rather simple) type. Fortunately it was easy to fix: see Note [Normalisation and type synonyms].
* Use the right in-scope setSimon Peyton Jones2017-01-061-2/+3
| | | | | I tripped over these calls to substTyWith that didn't obey the precondition about in-scope variables. Easily fixed, happily.
* Coerce for fmapDefault and foldMapDefaultDavid Feuer2017-01-052-9/+41
| | | | | | | | | | | | | | | | | | Define `fmapDefault = coerce traverse` and `foldMapDefault = coerce traverse`. This ensures that we won't get unnecessary allocation and indirection when the arguments don't inline. Fixes #13058 Reviewers: ekmett, RyanGlScott, austin, hvr, bgamari Reviewed By: RyanGlScott Subscribers: simonpj, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2916 GHC Trac Issues: #13058
* Fix doctests in Data.FunctorOleg Grenrus2017-01-051-1/+1
| | | | | | | | | | | | Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2920 GHC Trac Issues: #11551
* Remove single top-level section in Foldable docsChris Martin2017-01-051-7/+6
| | | | | | | | | | | | | | This fixes a mild annoyance in the haddock output for Data.Foldable. The section outline had a single top-level heading, which doesn't serve any purpose as far as I can tell. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2922
* Use atomic counter for GHC.Event.Uniquealexbiehl2017-01-052-21/+17
| | | | | | | | | | Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2905
* Add a CSE pass to Stg (#9291)Joachim Breitner2017-01-0516-30/+588
| | | | | | | | | | | This CSE pass only targets data constructor applications. This is probably the best we can do, as function calls and primitive operations might have side-effects. Introduces the flag -fstg-cse, enabled by default with -O for now. It might also be a good candiate for -O2. Differential Revision: https://phabricator.haskell.org/D2871
* Ensure nested binders have Internal NamesSimon Peyton Jones2017-01-055-51/+94
| | | | | | | | | | | | | | | | | | | | | | | | This is a long-standing bug. A nested (non-top-level) binder in Core should not have an External Name, like M.x. But - Lint was not checking this invariant - The desugarer could generate programs that failed the invariant. An example is in tests/deSugar/should_compile/T13043, which had let !_ = M.scState in ... This desugared to let ds = case M.scSate of M.scState { DEFAULT -> () } in case ds of () -> ... We were wrongly re-using that scrutinee as a case binder. And Trac #13043 showed that could ultimately lead to two top-level bindings with the same closure name. Alas! - The desugarer had one other place (in DsUtils.mkCoreAppDs) that could generate bogus code This patch fixes all three bugs, and adds a regression test.
* Minor refactoring in CSESimon Peyton Jones2017-01-051-34/+46
| | | | | | | I noticed that CSE.addBinding was always returning one of its own inputs, so I refactored to avoid doing so. No change in behaviour.
* Remove a redundant testSimon Peyton Jones2017-01-051-1/+4
| | | | | | postInlineUnconditionally was testing for isExportedId, but it was /also/ testing for top-level-ness, which is redundant. This patch just removes the redundant test, and documents it.
* Typofixes in manual and comments [ci skip]Gabor Greif2017-01-043-3/+3
|
* Typo in manual [ci skip]Gabor Greif2017-01-031-1/+1
|
* Don't use $ in the definition of (<**>) in GHC.BaseMatthew Pickering2017-01-031-1/+2
| | | | | | | | | | | | | | | | | | | ($) is special as Richard explains in the note at the top of the page. However, when adding the note he didn't remove this usage. Normally it didn't cause any problems as the optimiser optimised it away. However if one had the propensity to stick one's fingers into the depths of the inliner, it caused horrible idInfo panics. Reviewers: rwbarton, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2913 GHC Trac Issues: #13055
* Add specialization rules for realToFrac on ComplexTakano Akio2017-01-031-0/+13
| | | | | | | | | | | | | | | | | | | This patch implements RULES that specialize realToFrac at these 2 types: `(Real a) => a -> Complex Double` `(Real a) => a -> Complex Float` Test Plan: ./validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2901 GHC Trac Issues: #13040
* Refactor importdecls/topdecls parsing.Edward Z. Yang2017-01-021-44/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had the following parser: xs : xs ';' x | xs ';' | x This is a very clever construction that handles duplicate, leading and trailing semicolons well, but it didn't work very well with annotations, where we wanted to attach the annotation for a semicolon to the *previous* x in the list. This lead to some very disgusting code in the parser. This commit refactors the parser into this form: semis1 : semis1 ';' | ';' xs_semi : xs x semis1 | {- empty -} xs : xs_semi x Now, when we parse one or more semicolons after an x, we can attach them immediately, eliminating some very grotty annotations swizzling that was previously in the parser. We now need to write the top-level parser for imports and then declarations in a slightly special way now: top : semis top1 top1 : importdecls_semi topdecls_semi | importdecls_semi topdecls | importdecls This is because the *_semi parsers always require a semicolon, but we're allowed to omit that last newline. So we need special cases to handle each of the possible cases where we may run out of semicolons. I don't know if there is a better way to structure this, but it is not much more complicated than what we had before for top (and asymptotically better!) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonmar, austin, alanz, bgamari Reviewed By: alanz, bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2893
* Don't suggest enabling TypeApplications when it's already enabledMaciej Bielecki2017-01-024-2/+17
| | | | | | | | | | | | | | | | | | Previously when encountering EAsPat in an expression context, TypeApplications was suggested even when already enabled. This patch replaces the suggestion with more appropriate message. Test Plan: validate Reviewers: austin, bgamari, mpickering, goldfire, simonpj Reviewed By: mpickering, goldfire, simonpj Subscribers: simonpj, goldfire, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2877 GHC Trac Issues: #12879
* Update .mailmapMatthew Pickering2017-01-021-2/+9
|
* Disallow users to write instances of KnownNat and KnownSymsjorn32017-01-024-7/+37
| | | | | | | | | | | | | | | | | As noted in #12837, these classes are special and the user should not be able to define their own instances. Test Plan: Validate Reviewers: adamgundry, goldfire, mpickering, austin, bgamari Reviewed By: goldfire, mpickering Subscribers: goldfire, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2898 GHC Trac Issues: #12837
* Remove documentation about non-existent flag.Edward Z. Yang2017-01-011-9/+0
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Fix incorrect statement about plugin packages.Edward Z. Yang2017-01-011-4/+4
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Fix various issues with testsuite code on WindowsTamar Christina2016-12-283-39/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously we would make direct calls to `diff` using `os.system`. On Windows `os.system` is implemented using the standard idiom `CreateProcess .. WaitForSingleObject ..`. This again runs afoul with the `_exec` behaviour on Windows. So we ran into some trouble where sometimes `diff` would return before it's done. On tests which run multiple ways, such as `8086` what happens is that we think the diff is done and continue. The next way tries to set things up again by removing any previous directory. This would then fail with and error saying the directory can't be removed. Which is true, because the previous diff code/child is still running. We shouldn't make any external calls to anything using `os.system`. Instead just use `runCmd` which uses `timeout`. This also ensures that if we hit the cygwin bug where diff or any other utility hangs, we kill it and continue and not hang the entire test and leave hanging processes. Further more we also: Ignore error lines from `removeFile` from tools in the testsuite. This is a rather large hammer to work around the fact that `hsc2hs` often tries to remove it's own file too early. When this is patched the workaround can be removed. See Trac #9775 We mark `prog003` as skip. Since this test randomly fails and passes. For stability it's disabled but it is a genuine bug which we should find. It's something with interface files being overwritten. See Trac #11317 when `rmtree` hits a readonly file, the `onerror` handler is raised afterwards but not during the tree walk. It doesn't allow you to recover and continue as we thought. Instead you have to explicitly start again. This is why sometimes even though we call `cleanup` before `os.mkdirs`, it would sometimes fail with an error that the folder already exists. So we now do a second walk. A new verbosity level (4) will strip the silent flags from `MAKE` invocations so you can actually see what's going on. Test Plan: ./validate on build bots. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: mpickering, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2894 GHC Trac Issues: #12661, #11317, #9775
* Bump array submoduleBen Gamari2016-12-271-0/+0
| | | | Fixes overflow check from fix to #229.
* Testsuite: Skip failing tests on PowerPC 64-bitPeter Trommler2016-12-279-13/+41
| | | | | | | | | | | | | | | | | | | The Power ISA says the result of a division by zero is undefined. So ignore stdout on PowerPC 64-bit systems. Disable ext-interp tests on 64-bit PowerPC. We don't have support for PowerPC 64-bit ELF in the RTS linker, which is needed for the external interpreter. Test Plan: ./validate Reviewers: austin, simonmar, hvr, erikd, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2782
* testsuite: Fix T13025Ben Gamari2016-12-272-2/+2
| | | | | | It relied on `wc`, which produces slightly different format on OS X and Linux. Instead use `grep -c` which appears to be supported on both platforms and produces consistent output.
* Expand I/O CP in commentsJoachim Breitner2016-12-271-2/+2
| | | | | as suggested by @gracjan at https://github.com/ghc/ghc/commit/efc4a1661f0fc1004a4b7b0914f3d3a08c2e791a#commitcomment-20284337
* CallArity: Use exprIsCheap to detect thunksJoachim Breitner2016-12-262-10/+22
| | | | | | | | | | | | | | | Originally, everything that is not in WHNF (`exprIsWHNF`) is considered a thunk, not eta-expanded, to avoid losing any sharing. This is also how the published papers on Call Arity describe it. In practice, there are thunks that do a just little work, such as pattern-matching on a variable, and the benefits of eta-expansion likely oughtweigh the cost of doing that repeatedly. Therefore, this implementation of Call Arity considers everything that is not cheap (`exprIsCheap`) as a thunk. Nofib reports -2.58% allocations for scs and -40.93% allocation for wheel-sieve1; the latter has - 2.92% runtime.
* Remove redudant import from check-pprMatthew Pickering2016-12-261-1/+0
|
* check-ppr: Make --dump the default behaviorBen Gamari2016-12-261-11/+6
|
* rename: Add note describing #11216Ben Gamari2016-12-231-4/+22
|
* Define MAP_ANONYMOUS on systems that only provide MAP_ANONGracjan Polak2016-12-232-5/+10
| | | | | | | | | | | | Reviewers: simonmar, erikd, austin, bgamari Reviewed By: bgamari Subscribers: gracjan, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2881 GHC Trac Issues: #13005
* base: Override Foldable.{toList,length} for NonEmptyArtyom2016-12-231-2/+4
| | | | | | | | | | | | | | | | | | | | Previously the Foldable instance for NonEmpty used default implementations for toList and length. I assume that the existing implementations (i.e. Data.List.NonEmpty.{toList,length}) are better than the default ones, and frankly can't see a good reason why they might be worse – but if they are, instead of this commit we'd have to switch Data.List.NonEmpty.{toList,length} to use Foldable. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: int-index, thomie Differential Revision: https://phabricator.haskell.org/D2882
* Fix test for T12877Sylvain Henry2016-12-234-22/+6
| | | | | | | | | | | | Summary: See https://phabricator.haskell.org/rGHCd3b546b1a605 Reviewers: nomeata, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2883
* Use python3 for lintersMatthew Pickering2016-12-234-6/+6
| | | | | | | | | | | | | | We now require python3 for the testsuite so rather than require two versions of python it makes sense to use python3 for the linters as well. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2888
* Add caret diagnosticsPhil Ruffwind2016-12-2316-14/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | This is controlled by -f[no-]diagnostics-show-caret. Example of what it looks like: ``` | 42 | x = 1 + () | ^^^^^^ ``` This is appended to each diagnostic message. Test Plan: testsuite/tests/warnings/should_fail/CaretDiagnostics1 testsuite/tests/warnings/should_fail/CaretDiagnostics2 Reviewers: simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: joehillen, mpickering, Phyx, simonpj, alanz, thomie Differential Revision: https://phabricator.haskell.org/D2718 GHC Trac Issues: #8809
* rename: Don't require 'fail' in non-monadic contextsBen Gamari2016-12-234-4/+32
| | | | Fixes #11216.
* users-guide: Kill extraneous linkBen Gamari2016-12-231-1/+1
|
* testsuite: Split out Windows allocations numbers for T12234Ben Gamari2016-12-231-1/+3
|
* Push coercions in exprIsConApp_maybeSimon Peyton Jones2016-12-236-2/+114
| | | | | | | | | | Trac #13025 showed up the fact that exprIsConApp_maybe isn't clever enough: it didn't push coercions through applicatins, and that meant we weren't getting as much superclass selection as we should. It's easy to fix, happily. See Note [Push coercions in exprIsConApp_maybe]