summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Never apply worker/wrapper to DFunsSimon Peyton Jones2016-12-212-38/+46
| | | | | | | | | While fixing Trac #12444 I found an occasion on which we applied worker/wrapper to a DFunId. This is bad: it destroys the magic DFunUnfolding. This patch is a minor refactoring that stops this corner case happening, and tidies up the code a bit too.
* Move InId/OutId to CoreSynSimon Peyton Jones2016-12-218-84/+51
| | | | | | | | It turned out that many different modules defined the same type synonyms (InId, OutId, InType, OutType, etc) for the same purpose. This patch is refactoring only: it moves all those definitions to CoreSyn.
* Lint DFunUnfoldingsSimon Peyton Jones2016-12-211-2/+14
| | | | | Previously we simply failed to Lint these DFunUnfoldings, which led to a very delayed error message for Trac #12944
* Don't eta-expand in stable unfoldingsSimon Peyton Jones2016-12-217-13/+64
| | | | | See SimplUtils Note [No eta expansion in stable unfoldings], and Trac #9509 for an excellend diagnosis by Nick Frisby
* Add INLINE pragamas on Traversable default methodsSimon Peyton Jones2016-12-211-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I discovered, when debugging a performance regression in the compiler, that the list instance of mapM was not being inlined at call sites, with terrible runtime costs. It turned out that this was a serious (but not entirely obvious) omission of an INLINE pragmas in the class declaration for Traversable. This patch fixes it. I reproduce below the Note [Inline default methods], which I wrote at some length. We may well want to apply the same fix in other class declarations whose default methods are often used. {- Note [Inline default methods] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider class ... => Traversable t where ... mapM :: Monad m => (a -> m b) -> t a -> m (t b) mapM = traverse -- Default method instance Traversable [] where {-# INLINE traverse #-} traverse = ...code for traverse on lists ... This gives rise to a list-instance of mapM looking like this $fTraversable[]_$ctaverse = ...code for traverse on lists... {-# INLINE $fTraversable[]_$ctaverse #-} $fTraversable[]_$cmapM = $fTraversable[]_$ctraverse Now the $ctraverse obediently inlines into the RHS of $cmapM, /but/ that's all! We get $fTraversable[]_$cmapM = ...code for traverse on lists... with NO INLINE pragma! This happens even though 'traverse' had an INLINE pragma becuase the author knew it should be inlined pretty vigorously. Indeed, it turned out that the rhs of $cmapM was just too big to inline, so all uses of mapM on lists used a terribly inefficient dictionary-passing style, because of its 'Monad m =>' type. Disaster! Solution: add an INLINE pragma on the default method: class ... => Traversable t where ... mapM :: Monad m => (a -> m b) -> t a -> m (t b) {-# INLINE mapM #-} -- VERY IMPORTANT! mapM = traverse
* Move typeSize/coercionSize into TyCoRepSimon Peyton Jones2016-12-214-47/+59
| | | | | | | | | | | | | | | While investigating something else I found that 'typeSize' was allocating like crazy. Stupid becuase it should allocate precisely nothing!! Turned out that it was because typeSize and coercionSize were mutually recursive across module boundaries, and so could not benefit from the CPR property. To fix this I moved them both into TyCoRep. It's not critical (because typeSize is really only used in debug mode, but I tripped over and example (T5642) in which typeSize was one of the biggest single allocators in all of GHC. And it's easy to fix, so I did.
* Add note for rebindable syntax of [a..b]Simon Peyton Jones2016-12-211-0/+4
| | | | See Trac #12969
* Test Trac #12968, plus some commentsSimon Peyton Jones2016-12-214-0/+20
|
* Fix typos (not test relevant)Gabor Greif2016-12-212-2/+2
|
* Suppress duplicate .T filesGabor Greif2016-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per http://stackoverflow.com/questions/7961363/removing-duplicates-in-lists use the set() function to zap duplicates from the obtained list of .T files. I am using $ python3 --version Python 3.5.1 and strangely findTFiles() returns some .T files twice: -- BEFORE Found 376 .T files... ... ====> Scanning ../../libraries/array/tests/all.T ====> Scanning ../../libraries/array/tests/all.T *** framework failure for T2120(duplicate) There are multiple tests with this name *** framework failure for largeArray(duplicate) There are multiple tests with this name *** framework failure for array001(duplicate) There are multiple tests with this name *** framework failure for T9220(duplicate) There are multiple tests with this name *** framework failure for T229(duplicate) There are multiple tests with this name ... -- AFTER Found 365 .T files... ... ====> Scanning ../../libraries/array/tests/all.T ... Even more strangely 'find' begs to differ: $ find libraries testsuite/tests -name "*.T" | sort | uniq | wc -l 368
* Rewrite Note [Api annotations] for clarity.Edward Z. Yang2016-12-203-55/+88
| | | | | | | | | | | | | | | Summary: Based off my understanding of how the moving parts work. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: comments only Reviewers: alanz, mpickering, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2887
* Make CompactionFailed a newtypeRyan Scott2016-12-201-2/+2
|
* Test Trac #12996Simon Peyton Jones2016-12-203-0/+60
|
* Allow use of the external interpreter in stage1.Shea Levy2016-12-2033-405/+218
| | | | | | | | | | | | | | | | | | | Summary: Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs. This was originally added in https://phabricator.haskell.org/D2826 but that led to a compatibility issue with ghc 7.10.x on Windows. That's fixed here and the revert reverted. Reviewers: goldfire, hvr, austin, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2884 GHC Trac Issues: #13008
* Mark T8089 as unbroken since #7325 is now resolvedBen Gamari2016-12-191-3/+1
|
* Fix timeout's timeout on WindowsTamar Christina2016-12-191-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Timeout has been broken by my previous patch. The timeout event was not being processed correctly, as such hanging processes would not be killed as they should have been. This corrects it. Test Plan: ./validate ~/ghc/testsuite/timeout/install-inplace/bin/timeout.exe 10 "sleep 10000s" Reviewers: austin, RyanGlScott, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2880 GHC Trac Issues: #13004
* Revert "Allow use of the external interpreter in stage1."Tamar Christina2016-12-1933-195/+405
| | | | This reverts commit 52ba9470a7e85d025dc84a6789aa809cdd68b566.
* T8242: disable on NOSMP targetsSergei Trofimovich2016-12-181-1/+1
| | | | | | Test calls setNumCapabilities, requires SMP support. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* regalloc_unit_tests: disable on UNREG targetsSergei Trofimovich2016-12-181-1/+2
| | | | | | | Test requires register allocator to be present (native code generator). Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* T10296a: disable on NOSMP targetsSergei Trofimovich2016-12-181-1/+1
| | | | | | Test uses +RTS -N2, requires SMP support. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* T8209: disable on NOSMP targetsSergei Trofimovich2016-12-181-1/+1
| | | | | | Test calls setNumCapabilities, requires SMP support. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* T12035j: disable on NOSMP targetsSergei Trofimovich2016-12-181-1/+1
| | | | | | Test calls setNumCapabilities, requires SMP support. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Fix #12998 by removing CTimerRyan Scott2016-12-183-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: CTimer is a wrapper around `timer_t`, which is a typedef for `void*` on most platforms. The issue is that GHC's `FPTOOLS_CHECK_HTYPE` is not robust enough to discern pointer types from non-pointer types, so it mistakenly labels `timer_t` as a `Double` or `Int32` (depending on how many bits a pointer takes up on your platform). This wreaks havoc when trying to give it certain type class instances, as noted in https://phabricator.haskell.org/rGHCffc2327070dbb664bdb407a804121eacb2a7c734. For now, the simplest thing to do would be removing `CTimer`, since: 1. The original author (@DanielG) didn't have a particular use in mind for `timer_t` when he fixed #12795. 2. `CTimer` hasn't appeared in a release of `base` yet. Fixes #12998. Reviewers: austin, hvr, bgamari, DanielG, trofi Reviewed By: bgamari, trofi Subscribers: thomie, DanielG, erikd Differential Revision: https://phabricator.haskell.org/D2876 GHC Trac Issues: #12795, #12998
* Introduce unboxedSum{Data,Type}Name to template-haskellRyan Scott2016-12-186-4/+81
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D2448 (which introduced Template Haskell support for unboxed sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName` functions, since there wasn't any way you could write unboxed sum data or type constructors in prefix form to begin with (see #12514). But even if you can't write these `Name`s directly in source code, it would still be nice to be able to use these `Name`s in Template Haskell (for instance, to be able to treat unboxed sum type constructors like any other type constructors). Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in `TysWiredIn`, which was calculating the arity of unboxed sum data constructors incorrectly. Test Plan: make test TEST=T12478_5 Reviewers: osa1, goldfire, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2854 GHC Trac Issues: #12478, #12514
* Fix Haddock comment typo.Edward Z. Yang2016-12-181-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Check family instance consistency of hs-boot families later, fixes #11062.Edward Z. Yang2016-12-1710-8/+95
| | | | | | | | | | | | | | | | | | | | | | Summary: With hs-boot files, some type families may be defined in the module we are typechecking. In this case, we are not allowed to poke these families until after we typecheck our local declarations. So we first check everything involving non-recursive families, and then check the recursive families as we finish kind-checking them. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: goldfire, austin, simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2859 GHC Trac Issues: #11062
* Allow use of the external interpreter in stage1.Shea Levy2016-12-1733-405/+195
| | | | | | | | | | | | Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs. Reviewers: simonmar, goldfire, austin, hvr, bgamari Reviewed By: simonmar Subscribers: RyanGlScott, mpickering, angerman, thomie Differential Revision: https://phabricator.haskell.org/D2826
* Docs: Delete duplicate paragraph in user guideSiddhanathan Shanmugam2016-12-171-8/+0
| | | | | | | | | | | | | Removes duplicate paragraph in user guide. The same paragraph is repeated below this one. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2874
* Improve StringBuffer and FastString docsPhil Ruffwind2016-12-172-4/+51
| | | | | | | | | | | | | | | This area of code contains a lot of unsafe functionality, so it might be worth documenting to reduce the risk of misuse. Test Plan: inspection Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2872
* Run some tests with -fexternal-interpreter -profSimon Marlow2016-12-172-7/+21
| | | | | | | | | | | | | | | | | | We don't have any other tests for this, except one Template Haskell test. This would have caught the bug I just fixed in D2868, at least when validating with profiling on. Test Plan: Ran tests Reviewers: niteria, austin, erikd, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2869 GHC Trac Issues: #5654
* Fix bug in previous fix for #5654Simon Marlow2016-12-171-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | I forgot to account for BCOs, which have a different layout from functions. This caused crashes when using profiling with GHCi (via -fexternal-interpreter -prof), which unfortunately is not tested at all by validate, even when profiling is enabled. I'm going to add some testing that would have caught this in a separate patch. Test Plan: ``` cd nofib/spectral/puzzle && make NoFibWithGHCi=YES EXTRA_RUNTEST_OPTS='-fexternal-interpreter -prof' ``` New testsuite tests coming in a separate diff. Reviewers: niteria, austin, erikd, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2868 GHC Trac Issues: #5654
* Reexport Language.Haskell.TH.Lib from Language.Haskell.THRyan Scott2016-12-173-85/+115
| | | | | | | | | | | | | | | | | | | | Reexporting `Language.Haskell.TH.Lib` from `Language.Haskell.TH` ensures that `Language.Haskell.TH` will continue to expose all of the functions that `Language.Haskell.TH.Lib` does in the future. Fixes #12992. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Reviewed By: bgamari, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2867 GHC Trac Issues: #12992
* rts/win32/IOManager: Fix integer typesBen Gamari2016-12-174-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code has been broken on 64-bit systems for some time: the length and timeout arguments of `addIORequest` and `addDelayRequest`, respectively, were declared as `int`. However, they were passed Haskell integers from their respective primops. Integer overflow and madness ensued. This resulted in #7325 and who knows what else. Also, there were a few left-over `BOOL`s in here which were not passed to Windows system calls; these were changed to C99 `bool`s. However, there is still a bit of signedness inconsistency within the `delay#` call-chain, * `GHC.Conc.IO.threadDelay` and the `delay#` primop accept `Int` arguments * The `delay#` implementation in `PrimOps.cmm` expects the timeout as a `W_` * `AsyncIO.c:addDelayRequest` expects an `HsInt` (was `int` prior to this patch) * `IOManager.c:AddDelayRequest` expects an `HsInt`` (was `int`) * The Windows `Sleep` function expects a `DWORD` (which is unsigned) Test Plan: Validate on Windows Reviewers: erikd, austin, simonmar, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2861 GHC Trac Issues: #7325
* Windows: Improve terminal detection mechanismPhil Ruffwind2016-12-174-98/+154
| | | | | | | | | | | | | | | | | | | | | The previous detection mechanism allowed environment variables (ANSICON, ConEmuANSI, TERM) to supersede the fact that the stderr is not a terminal, which is probably what led to color codes appearing in the stderr of the tests (see: 847d229346431483b99adcff12e46c7bf6af15da). This commit changes the detection mechanism to detect Cygwin/MSYS2 terminals in a more reliable manner, avoiding the use of environment variables entirely. Test Plan: validate Reviewers: Phyx, austin, erikd, bgamari Reviewed By: Phyx, bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2809
* Reshuffle levity polymorphism checks.Richard Eisenberg2016-12-1714-26/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, GHC checked for bad levity polymorphism to the left of all arrows in data constructors. This was wrong, as reported in #12911 (where an example is also shown). The solution is to check each individual argument for bad levity polymorphism. Thus the check has been moved from TcValidity to TcTyClsDecls. A similar situation exists with pattern synonyms, also fixed here. This patch also nabs #12819 while I was in town. Test cases: typecheck/should_compile/T12911, patsyn/should_fail/T12819 Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2783 GHC Trac Issues: #12819, #12911
* utils/genargs: delete unused toolSergei Trofimovich2016-12-172-73/+0
| | | | | | The tool was added in 2003 but never used at least in ghc tree. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* fix OpenBSD linkage (wxneeded)Sergei Trofimovich2016-12-173-4/+5
| | | | | | | | | | | | | | | | | | | | There is two types of options passed directly to 'ld' (and not to 'gcc' driver): - CONF_LD_LINKER_OPTS_STAGE$4 - EXTRA_LD_OPTS This changedoes two things: - split 'EXTRA_LD_OPTS' into two variables: - EXTRA_LD_OPTS (accepts 'gcc' wrapper options) - EXTRA_LD_LINKER_OPTS (accepts raw 'ld' options) - wraps all LD_LINKER options as '-Wl,' when passed to 'gcc' driver. Fixes https://phabricator.haskell.org/D2776 Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Revert "Do not init record accessors as exported"Ben Gamari2016-12-174-19/+3
| | | | | This reverts commit 3a00ff92a3ee66c096b85b180d247d1a471a6b6e due to #12993
* Fix Pretty printer tests on WindowsTamar Christina2016-12-171-5/+10
| | | | | | | | | | | | | | | | | | | Summary: D2752 added some tests which escapes string literals. This means newlines are converted before they get normalized by the IO functions. So on Windows \r\n would be in the output while \n was expected. Test Plan: make test -C testsuite/tests/printer Reviewers: austin, bgamari, alanz Reviewed By: alanz Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2873 GHC Trac Issues: #3384
* rts/Compact.cmm: fix UNREG build failureSergei Trofimovich2016-12-171-54/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change does the following: - Add explicit declaration of exception closures from base. C backend needs those symbols to be visible. - Reorder cmm functions in use order. Again C backend needs symbol declaration/definition before use. even for module-local cmm functions. Fixes the following build failure: rts_dist_HC rts/dist/build/Compact.o In file included from /tmp/ghc3348_0/ghc_4.hc:3:0: error: /tmp/ghc3348_0/ghc_4.hc: In function 'stg_compactAddWithSharingzh': /tmp/ghc3348_0/ghc_4.hc:27:11: error: error: 'stg_compactAddWorkerzh' undeclared (first use in this function) JMP_((W_)&stg_compactAddWorkerzh); ^ ... /tmp/ghc3348_0/ghc_4.hc:230:13: error: error: 'base_GHCziIOziException_cannotCompactMutable_closure' undeclared (first use in this function) R1.w = (W_)&base_GHCziIOziException_cannotCompactMutable_closure; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* revert '-Wl' prefixing to *_LD_OPTSSergei Trofimovich2016-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts f48f5a9ebf384e1e157b7b413e1d779f4289ddd2 The prefixing does not work as comma is stripped by $(addprefix) macro: The following call $$(addprefix -optl-Wl, $$($1_$2_$3_ALL_LD_OPTS)) prefixes options with "-optl-Wl" not with "-optl-Wl," The simplest breakage can be seen by adding SRC_LD_OPTS += -O1 to mk/build.mk: <no location info>: error: Warning: Couldn't figure out linker information! Make sure you're using GNU ld, GNU gold or the built in OS X linker, etc. gcc: error: unrecognized command line option '-Wl-O1' Another problem with original change is loss of ability to pass options to gcc as a linker driver, for example: SRC_LD_OPTS += -flto Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* UNREG: include CCS_OVERHEAD to STGSergei Trofimovich2016-12-171-0/+1
| | | | | | | | | | | | | | | | | | | | Commit 394231b301efb6b56654b0a480ab794fe3b7e4db aded CCS_OVERHEAD annotation to 'rts/Apply.cmm'. Before the change CCS_OVERHEAD was used only in C code. The change exports CCS_OVERHEAD to STG. Fixes UNREG build failure: rts_dist_HC rts/dist/build/Apply.p_o /tmp/ghc29563_0/ghc_4.hc: In function 'cm_entry': /tmp/ghc29563_0/ghc_4.hc:73:13: error: error: 'CCS_OVERHEAD' undeclared (first use in this function) *((P_)((W_)&CCS_OVERHEAD+72)) = ... ^~~~~~~~~~~~ Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* testsuite: Add test for #12993Ben Gamari2016-12-163-0/+10
|
* Enable split sections by default where possibleSimon Brenner2016-12-161-5/+16
| | | | | | | | | | | | | | | On non-windows platforms with GNU ld, enable SplitSections in the GHC build by default. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: DemiMarie, thomie Differential Revision: https://phabricator.haskell.org/D1800 GHC Trac Issues: #11445
* Fix string merging with -split-sectionsSimon Brenner2016-12-161-3/+14
| | | | | | | | | | | | | | | | | | The added flags for string literal merging ended up printed in the middle of the section name when -split-sections was enabled. Break it up to put the flags after the name. Test Plan: validate with SplitSections=YES Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2865 GHC Trac Issues: #9577
* Make up a module name for c-- filesBen Gamari2016-12-161-2/+5
| | | | | | | | | | | | | | | | | | | | | Summary: We used to pass a bottoming Module to the NCG, which resulted in panics when `-v` was used due to debug output (see #11784). Instead we make up a module name. This is a bit scary since `PIC.howToAccessLabel` might actually use the Module, but if it wasn't crashing before I suppose it's fine. Test Plan: `touch hi.cmm; ghc -v2 -c -dcmm-lint hi.cmm` Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2864 GHC Trac Issues: #11784
* CLabel: Kill redundant UnitId argument from labelDynamicBen Gamari2016-12-164-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | It already has access to the current package's UnitId via the Module. Edward Yang pointed out that there is one wrinkle, however: the following invariant isn't true at all stages of compilation, if I am compiling the module (this_mod :: Module), then thisPackage dflags == moduleUnitId this_mod. Specifically, this is only true after desugaring; it may be broken when typechecking an indefinite signature. However, it's safe to assume this in the native codegen. I've updated Note to state this invariant more directly. Test Plan: Validate Reviewers: austin, ezyang, simonmar Reviewed By: ezyang, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2863
* Packages: Kill unused UnitId argument to isDllNameBen Gamari2016-12-164-19/+16
| | | | | | | | | | Test Plan: Validate Reviewers: austin, simonmar Subscribers: thomie, ezyang Differential Revision: https://phabricator.haskell.org/D2866
* DynFlags: Rip out remnants of WarnContextQuantificationBen Gamari2016-12-162-7/+2
| | | | | | | | | | | | Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2862 GHC Trac Issues: #11221
* Typos in commentsGabor Greif2016-12-169-9/+9
|