summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Avoid excessive space usage from unfoldings in CoreTidywip/rwbarton-D3516Reid Barton2017-04-302-2/+11
| | | | | | | | | | | | Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie GHC Trac Issues: #13564 Differential Revision: https://phabricator.haskell.org/D3516
* Remove unused tidyOccNames and update NoteJoachim Breitner2017-04-301-16/+7
| | | | | | | addressing rwbarton’s concerns in https://phabricator.haskell.org/rGHC18ac80ff729e#66197 Differential Revision: https://phabricator.haskell.org/D3511
* Prefer #if defined to #ifdefBen Gamari2017-04-28220-1185/+1185
| | | | Our new CPP linter enforces this.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-2827-107/+160
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* Improve code generation for conditionalsSimon Peyton Jones2017-04-285-38/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch in in preparation for the fix to Trac #13397 The code generator has a special case for case tagToEnum (a>#b) of False -> e1 True -> e2 but it was not doing nearly so well on case a>#b of DEFAULT -> e1 1# -> e2 This patch arranges to behave essentially identically in both cases. In due course we can eliminate the special case for tagToEnum#, once we've completed Trac #13397. The changes are: * Make CmmSink swizzle the order of a conditional where necessary; see Note [Improving conditionals] in CmmSink * Hack the general case of StgCmmExpr.cgCase so that it use NoGcInAlts for conditionals. This doesn't seem right, but it's the same choice as the tagToEnum version. Without it, code size increases a lot (more heap checks). There's a loose end here. * Add comments in CmmOpt.cmmMachOpFoldM
* Re-engineer caseRules to add tagToEnum/dataToTagSimon Peyton Jones2017-04-287-232/+391
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See Note [Scrutinee Constant Folding] in SimplUtils * Add cases for tagToEnum and dataToTag. This is the main new bit. It allows the simplifier to remove the pervasive uses of case tagToEnum (a > b) of False -> e1 True -> e2 and replace it by the simpler case a > b of DEFAULT -> e1 1# -> e2 See Note [caseRules for tagToEnum] and Note [caseRules for dataToTag] in PrelRules. * This required some changes to the API of caseRules, and hence to code in SimplUtils. See Note [Scrutinee Constant Folding] in SimplUtils. * Avoid duplication of work in the (unusual) case of case BIG + 3# of b DEFAULT -> e1 6# -> e2 Previously we got case BIG of DEFAULT -> let b = BIG + 3# in e1 3# -> let b = 6# in e2 Now we get case BIG of b# DEFAULT -> let b = b' + 3# in e1 3# -> let b = 6# in e2 * Avoid duplicated code in caseRules A knock-on refactoring: * Move Note [Word/Int underflow/overflow] to Literal, as documentation to accompany mkMachIntWrap etc; and get rid of PrelRuls.intResult' in favour of mkMachIntWrap
* Move dataConTagZ to DataConSimon Peyton Jones2017-04-285-16/+14
| | | | Just a simple refactoring to remove duplication
* nativeGen: Use SSE2 SQRT instructionBen Gamari2017-04-284-7/+20
| | | | | | | | | | Reviewers: austin, dfeuer Subscribers: dfeuer, rwbarton, thomie GHC Trac Issues: #13629 Differential Revision: https://phabricator.haskell.org/D3508
* CSE: Fix cut and paste errorBen Gamari2017-04-281-2/+2
| | | | | | | | | | | | | extendCSRecEnv took the map to be extended from cs_map instead of cs_rec_map. Oops! Test Plan: Validate Reviewers: simonpj, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3510
* Use memcpy in cloneArrayBen Gamari2017-04-281-16/+2
| | | | | | | | | | | | | | | | While looking at #13615 I noticed that there was this strange open-coded memcpy in the definition of the cloneArray macro. I don't see why this should be preferable to memcpy. Test Plan: Validate, particularly focusing on array operations Reviewers: simonmar, tibbe, austin, alexbiehl Reviewed By: tibbe, alexbiehl Subscribers: alexbiehl, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3504
* Make the tyvars in TH-reified data family instances uniformRyan Scott2017-04-284-5/+35
| | | | | | | | | | | | | | | | | | | | | It turns out we were using two different sets of type variables when reifying data family instances in Template Haskell. We were using the tyvars quantifying over the instance itself for the LHS, but using the tyvars quantifying over the data family instance constructor for the RHS. This commit uses the instance tyvars for both the LHS and the RHS, fixing #13618. Test Plan: make test TEST=T13618 Reviewers: goldfire, austin, bgamari Reviewed By: goldfire, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13618 Differential Revision: https://phabricator.haskell.org/D3505
* Add regression test for #12104Ryan Scott2017-04-283-0/+17
| | | | | | | | | | | | | | | | | | Commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021 (#13487) fixes #12104 as well. This adds a regression test for the program reported in #12104 to keep it fixed. Test Plan: make test TEST=T12104 Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #12104 Differential Revision: https://phabricator.haskell.org/D3495
* get-win32-tarballs: Grab perl tarball from haskell.org, not GitHubBen Gamari2017-04-281-1/+1
| | | | | | | | | | Reviewers: austin, dfeuer Reviewed By: dfeuer Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3509
* Be a bit more eager to inline in a strict contextSimon Peyton Jones2017-04-283-7/+23
| | | | | | | | | | | | | | | | | | | If we see f (g x), and f is strict, we want to be a bit more eager to inline g, because it may well expose an eval (on x perhaps) that can be eliminated or shared. I saw this in nofib boyer2, function RewriteFuns.onewayunify1. It showed up as a consequence of the preceding patch that makes the simplifier do less work (Trac #13379). We had f d (g x) where f was a class-op. Previously we simplified both d and (g x) with a RuleArgCtxt (making g a bit more eager to inline). But now we simplify only d that way, then fire the rule, and only then simplify (g x). Firing the rule produces a strict funciion, so we want to make a strict function encourage inlining a bit.
* Cure exponential behaviour in the simplifierSimon Peyton Jones2017-04-286-71/+549
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch nails a Bad Bug exposed in Trac #13379. Roughly, a deeply-nested application like f (f (f ....) ) ) could make the simplifier go exponential -- without producing an exponential-sized result! The reason was that we - simplified a (big) function argument - then decided to inline the function - then preInilneUnconditionally the argument - and then re-simplified the big argument And if the "big argument" itself had a similar structure things could get very bad. Once I'd understood, it was easy to fix: * See Note Note [Avoiding exponential behaviour] for an overview * The key change is that Simplify.simplLam now as a case for (isSimplified dup). This is what removes the perf bug. * But I also made simplCast more parsimonious about simplifying, avoiding doing so when the coercion is Refl * And similarly I now try to avoid simplifying arguments where possible before applying rules. See Note [Trying rewrite rules] The latter two points tackle common cases, and in those cases make the simplifier take fewer iterations.
* Eta expansion and join pointsSimon Peyton Jones2017-04-281-96/+43
| | | | | | | | | | | | | | | | | | CoreArity.etaExpand tried to deal with eta-expanding expressions with join points. For example let j x = e in \y. b But it is hard to eta-expand this in the "no-crap" way described in Note [No crap in eta-expanded code], becuase it would mean pushing the "apply to y" into the join RHS, and changing its type. And the join might be recursive, and it might have an unfolding. Moreover in elaborate cases like this I don't think we need the no-crap thing. So for now I'm simplifying the code by generating \z. (let j x = e in \y. b) z Let's see if that gives rise to any problems. See Note [Eta expansion for join points]
* Comments onlySimon Peyton Jones2017-04-283-8/+8
|
* Comments onlySimon Peyton Jones2017-04-281-7/+15
|
* A bit more tcTraceSimon Peyton Jones2017-04-281-2/+4
|
* Comments and tiny refactoringSimon Peyton Jones2017-04-282-5/+3
|
* Bump process to 1.6Ben Gamari2017-04-275-4/+4
| | | | Also bumps Cabal submodule due to version bound bump.
* Update Cabal submodule, with necessary wibbles.Edward Z. Yang2017-04-267-26/+14
| | | | | | | | | | | | Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3501
* Update hsc2hs submodule to 0.68.2Ben Gamari2017-04-261-0/+0
|
* Add instances for Data.Ord.DownAdam Sandberg Eriksson2017-04-256-3/+43
| | | | | | | | | | | | | | | Namely `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup` and `Monoid` for `Data.Ord.Down` (#13097). Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: bgamari, RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #13097 Differential Revision: https://phabricator.haskell.org/D3500
* Document mkWeak#Ben Gamari2017-04-251-0/+5
| | | | | | | | | | | | Reviewers: simonmar, austin Reviewed By: simonmar Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #10640, #13611 Differential Revision: https://phabricator.haskell.org/D3498
* Only pretty-print binders in closed type families with -fprint-explicit-forallsRyan Scott2017-04-258-8/+28
| | | | | | | | | | | | | | | | | | | Previously, we were unconditionally pretty-printing all type variable binders when pretty-printing closed type families (e.g., in the output of `:info` in GHCi). This threw me for a loop, so let's guard this behind the `-fprint-explicit-foralls` flag. Test Plan: make test TEST=T13420 Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13420 Differential Revision: https://phabricator.haskell.org/D3497
* Add backup url and sync support for Win32 tarball scriptTamar Christina2017-04-251-13/+59
| | | | | | | | | | | | | | | | | | | | | This imports @bgamari's sync script into the mirror script and adds a backup url for packages. The idea is that the URLs won't need updating when updating the tarballs from now on. It will first try haskell.org, failing that it'll try repo.msys2.org Test Plan: try new command `mk/get-win32-tarballs.sh sync` Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, bgamari Differential Revision: https://phabricator.haskell.org/D3488
* PPC NCG: Implement callish prim opsPeter Trommler2017-04-255-184/+611
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide PowerPC optimised implementations of callish prim ops. MO_?_QuotRem The generic implementation of quotient remainder prim ops uses a division and a remainder operation. There is no remainder on PowerPC and so we need to implement remainder "by hand" which results in a duplication of the divide operation when using the generic code. Avoid this duplication by implementing the prim op in the native code generator. MO_U_Mul2 Use PowerPC's instructions for long multiplication. Addition and subtraction Use PowerPC add/subtract with carry/overflow instructions MO_Clz and MO_Ctz Use PowerPC's CNTLZ instruction and implement count trailing zeros using count leading zeros MO_QuotRem2 Implement an algorithm given by Henry Warren in "Hacker's Delight" using PowerPC divide instruction. TODO: Use long division instructions when available (POWER7 and later). Test Plan: validate on AIX and 32-bit Linux Reviewers: simonmar, erikd, hvr, austin, bgamari Reviewed By: erikd, hvr, bgamari Subscribers: trofi, kgardas, thomie Differential Revision: https://phabricator.haskell.org/D2973
* configure: Kill off FP_ARG_WITH_*Ben Gamari2017-04-254-109/+49
| | | | | | | | | | | | | | | | | This replaces the --with-* configure flags with the usual autoconf environment variables, as suggested by #13583. Test Plan: Configure on various platforms Reviewers: hvr, trofi, thomie, austin Reviewed By: trofi Subscribers: rwbarton, erikd GHC Trac Issues: #13583 Differential Revision: https://phabricator.haskell.org/D3499
* Revert "Remove special casing of Windows in generic files"Ben Gamari2017-04-252-36/+26
| | | | | | | | This commit didn't consider the fact that binary distributions on Windows must have relative toolchain paths. This caused #13560. This reverts commit 48385cb2fc295eb8af9188cbe140142c1807d5a7 (except for a helpful comment).
* Don't describe tuple sections as "Python-style"Chris Martin2017-04-251-1/+1
| | | | (cherry picked from commit 960589e89da3dbf60e88042d7e064ad4a98fb2ff)
* Don't setProgramDynFlags on every :loadSimon Marlow2017-04-253-19/+46
| | | | | | | | | | | | | | | | | | | | Summary: setProgramDynFlags invalidates the whole module graph, forcing everything to be re-summarised (including preprocessing) on every :reload. Looks like this was a bad regression in 8.0, but we didn't notice because there was no test for it. Now there is! Test Plan: * validate * new unit test Reviewers: bgamari, triple, austin, niteria, erikd, jme Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3398
* core-spec: Simplify the handling of LetRecJoachim Breitner2017-04-243-56/+24
| | | | | | | | | | | | We do not need to keep an enrivonment around to implement letrec, as long as we only do call-by-name. Instead, evaluate letrec by substituting for all the variables with their RHS wrapped in the letrec binding. Since nothing adds to the enrivonment any more, there is no need for a S_Var rule. Differential Revision: https://phabricator.haskell.org/D3466
* Guard yet another /bin/sh `for in` loop against empty varsHerbert Valerio Riedel2017-04-241-0/+2
| | | | | This is a follow-up to df6794035f1e4397d89896f329525e5368b7d1cc which missed `INSTALL_BINS`
* Add failing test case for T13611Joachim Breitner2017-04-242-0/+10
| | | | this program should be rejected, but is not (and segfaults).
* testsuite/driver: Fix deletion retry logic on WindowsBen Gamari2017-04-241-7/+15
| | | | | | | | | | | | | | | Previously rmtree's error callback would throw an exception, breaking out of the retry loop. Test Plan: Validate on Windows Reviewers: Phyx, austin Reviewed By: Phyx Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3492
* compiler/cmm/PprC.hs: constify labels in .rodataSergei Trofimovich2017-04-248-49/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider one-line module module B (v) where v = "hello" in -fvia-C mode it generates code like static char gibberish_str[] = "hello"; It resides in data section (precious resource on ia64!). The patch switches genrator to emit: static const char gibberish_str[] = "hello"; Other types if symbols that gained 'const' qualifier are: - info tables (from haskell and CMM) - static reference tables (from haskell and CMM) Cleanups along the way: - fixed info tables defined in .cmm to reside in .rodata - split out closure declaration into 'IC_' / 'EC_' - added label declaration (based on label type) right before each label definition (based on section type) so that C compiler could check if declaration and definition matches at definition site. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: ran testsuite on unregisterised x86_64 compiler Reviewers: simonmar, ezyang, austin, bgamari, erikd Reviewed By: bgamari, erikd Subscribers: rwbarton, thomie GHC Trac Issues: #8996 Differential Revision: https://phabricator.haskell.org/D3481
* Disable terminfo, if we don’t build it.Moritz Angermann2017-04-241-0/+3
| | | | | | | | | | | | | | | This is a derivation of a patch from @jophish. This is necessary due to `haskeline`'s `terminfo` flag being marked as `Manual` as of 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c. Reviewers: jophish, bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie, jophish Differential Revision: https://phabricator.haskell.org/D3493
* Add regression test for #13603Ryan Scott2017-04-242-1/+11
| | | | | | | | | | | | | | | | | | Summary: Commit b207b536ded40156f9adb168565ca78e1eef2c74 (#11714) happened to fix #13603 as well. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T13603 Reviewers: bgamari, austin, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13603 Differential Revision: https://phabricator.haskell.org/D3489
* testsuite: Mark T13075 as broken due to #13075Ben Gamari2017-04-231-1/+1
|
* Export function for use in GHC APIAlan Zimmerman2017-04-231-1/+2
|
* testsuite: Add testcase for #13075Ben Gamari2017-04-232-0/+8
|
* testsuite: Increase T13056 window size to +/-10%Ben Gamari2017-04-231-2/+3
|
* testsuite: Add testcase for #13587Ben Gamari2017-04-233-0/+27
| | | | | | | | | | | | Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13587 Differential Revision: https://phabricator.haskell.org/D3474
* testsuite: Add test for #13591Ben Gamari2017-04-235-0/+12
| | | | | | | | | | Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13591 Differential Revision: https://phabricator.haskell.org/D3470
* Only build iserv with -threaded if GhcThreaded is setReid Barton2017-04-231-0/+2
| | | | | | | | | | | | | | | | | | | | | By default GhcThreaded is set by ``` GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO) ``` so it seems incorrect to try to build iserv with -threaded when GhcThreaded is not set. This came up when I was building GHC with some strange combination of flavours (debugged and profiled but not threaded). Test Plan: harbormaster Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3429
* Document the kind generalization behavior observed in #13555Ryan Scott2017-04-235-0/+115
| | | | | | | | | | | | | | | | | | | | The conclusion of #13555 was that a program which began to fail to typecheck (starting in GHC 8.2) was never correct to begin with. Let's document why this is the case with respect to `MonoLocalBinds`' interaction with kind generalization. Also adds the reported program as a `compile_fail` testcase. Test Plan: make test TEST=T13555 # Also, read the docs Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: goldfire, simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13555 Differential Revision: https://phabricator.haskell.org/D3472
* [linker] Adds elf_compat.h, util.h, elf_util.hMoritz Angermann2017-04-2310-112/+671
| | | | | | | | | | | | | | | | | Further cleanup of the linker, we'll add elf_compat.h for a more complete set of relocations. Also Util.h has been added as suggested in the code already. Depends on D3444, D3445 Reviewers: bgamari, austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3446
* [linker] Adds ElfTypesMoritz Angermann2017-04-233-86/+195
| | | | | | | | | | | | | | This diff introduces ElfTypes similar to provide the linker code with a richer data structure, similar to the approach taken for mach-o already. Reviewers: bgamari, austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3445
* rts: Fix "ASSERT ("sBen Gamari2017-04-234-22/+22
| | | | | | | | | | Reviewers: austin, erikd, simonmar Reviewed By: erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3486