summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Test Trac #12507wip/spj-tc-branchSimon Peyton Jones2016-09-212-1/+17
| | | | | | This is now working apparently. It relates to when a polymorphic function gets instantiated, under some implicit paramter bindings.
* Comments and trivial refactoringSimon Peyton Jones2016-09-206-22/+24
|
* Refactor typechecking of pattern bindingsSimon Peyton Jones2016-09-205-177/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a regression introduced, post 8.0.1, by this major commit: commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Sat Jun 11 23:49:27 2016 +0100 Improve typechecking of let-bindings This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. I didn't get the typechecking of pattern bindings right, leading to Trac #12427. In fixing this I found that this program doesn't work: data T where T :: a -> ((forall b. [b]->[b]) -> Int) -> T h1 y = case y of T _ v -> v Works in 7.10, but not in 8.0.1. There's a happy ending. I found a way to fix this, and improve pattern bindings too. Not only does this fix #12427, but it also allows In particular,we now can accept data T where MkT :: a -> Int -> T ... let { MkT _ q = t } in ... Previously this elicited "my head exploded" but it's really fine since q::Int. The approach is described in detail in TcBinds Note [Typechecking pattern bindings] Super cool. And not even a big patch!
* A collection of type-inference refactorings.Simon Peyton Jones2016-09-2070-660/+850
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Modify TcType.ExpType to make a distinct data type, InferResult for the Infer case, and consequential refactoring. 2. Define a new function TcUnify.fillInferResult, to fill in an InferResult. It uses TcMType.promoteTcType to promote the type to the level of the InferResult. See TcMType Note [Promoting a type] This refactoring is in preparation for an improvement to typechecking pattern bindings, coming next. I flirted with an elaborate scheme to give better higher rank inference, but it was just too complicated. See TcMType Note [Promotion and higher rank types] 3. Add to InferResult a new field ir_inst :: Bool to say whether or not the type used to fill in the InferResult should be deeply instantiated. See TcUnify Note [Deep instantiation of InferResult]. 4. Add a TcLevel to SkolemTvs. This will be useful generally - it's a fast way to see if the type variable escapes when floating (not used yet) - it provides a good consistency check when updating a unification variable (TcMType.writeMetaTyVarRef, the level_check_ok check) I originally had another reason (related to the flirting in (2), but I left it in because it seems like a step in the right direction. 5. Reduce and simplify the plethora of uExpType, tcSubType and related functions in TcUnify. It was such an opaque mess and it's still not great, but it's better. 6. Simplify the uo_expected field of TypeEqOrigin. Richard had generatlised it to a ExpType, but it was almost always a Check type. Now it's back to being a plain TcType which is much easier. 7. Improve error messages by refraining from skolemisation when it's clear that there's an error: see TcUnify Note [Don't skolemise unnecessarily] 8. Type.isPiTy and isForAllTy seem to be missing a coreView check, so I added it All these changes led to quite bit of error message wibbling
* Comments and white space onlySimon Peyton Jones2016-08-292-4/+4
|
* Revert "codeGen: Remove binutils<2.17 hack, fixes T11758"Simon Peyton Jones2016-08-193-3/+46
| | | | | | | This reverts commit e3e2e49a8f6952e1c8a19321c729c17b294d8c92. I'm reverting because it makes ghc-stage2 seg-fault on 64-bit Windows machines. Even ghc-stage2 --version seg-faults.
* Add gcoerceWith to Data.Type.CoercionRyan Scott2016-08-183-0/+13
| | | | | | | | | | | | | | | | | Summary: For symmetry with `gcastWith` in `Data.Type.Equality`. Fixes #12493. Test Plan: It compiles Reviewers: bgamari, goldfire, hvr, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2456 GHC Trac Issues: #12493
* Revert "T1969: Enable it again but bump the max residency temporarily"Matthew Pickering2016-08-171-2/+3
| | | | This reverts commit 773e3aadac4bbee9a0173ebc90ffdc9458a2a3a9.
* Refactor nestImplicTcSSimon Peyton Jones2016-08-171-30/+32
| | | | | Simpler code, and simpler to understand. No change in behaviour.
* Keep the bindings local during defaultCallStacksSimon Peyton Jones2016-08-175-5/+20
| | | | | | | | | defaultCallStacks generates evidence bindings for call stacks, but wasn't setting the binding site correctly. As a result they were simply discarded in the case of pattern synonyms, giving rise to Trac #12489. The fix is easy; and I added an ASSERT to catch the error earlier.
* Not-in-scope variables are always errorsSimon Peyton Jones2016-08-176-6/+44
| | | | | This fixes Trac #12406. A not-in-scope error shoudl be an error even if you have -fdefer-typed-holes.
* Typo in commentGabor Greif2016-08-161-1/+1
|
* Typofix in System.Environment docs.Edward Z. Yang2016-08-161-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Minor typofix.Edward Z. Yang2016-08-161-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* When in sanity mode, un-zero malloc'd memory; fix uninitialized memory bugs.Edward Z. Yang2016-08-152-0/+3
| | | | | | | | | | | | | | | | malloc'd memory is not guaranteed to be zeroed. On Linux, however, it is often zeroed, leading to latent bugs. In fact, with this patch I fix two uninitialized memory bugs stemming from this. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonmar, austin, Phyx, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2455
* Darwin: Detect broken NM program at configure timeErik de Castro Lopo2016-08-161-0/+26
| | | | | | | | | | | | | | | | Some recent versions of XCode ship a broken version of `nm`. Detect this at configure time, and error out with a suggestion to rerun configure with a `--with-nm=...` argument. Test Plan: Test of Linux and OS X Reviewers: carter, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2425
* refactor test for __builtin_unreachable into Rts.h macro RTS_UNREACHABLEKarel Gardas2016-08-152-4/+8
| | | | | | | | | | | | | Summary: This patch refactors GNU C version test (for 4.5 and more modern) due to usage of __builtin_unreachable done in the CNF.c code directly into the new RTS_UNREACHABLE macro placed into Rts.h Reviewers: bgamari, austin, simonmar, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2457
* Update hoopl submodule (extra .gitignore entry)Edward Z. Yang2016-08-151-0/+0
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* fix compilation failure on OpenBSD with system supplied GNU C 4.2.1Karel Gardas2016-08-141-1/+4
| | | | | | | | | | | | | | Summary: This patch fixes compilation failure on OpenBSD. The OpenBSD's GNU C compiler is of 4.2.1 version and problematic __builtin_unreachable was added in GNU C 4.5 release. Let's use pure abort() call on OpenBSD instead of __builtin_unreachable Reviewers: bgamari, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2453
* Fix configure detection.Tamar Christina2016-08-141-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: GHC's configure script seems to normalize the values returned from config.guess. So for Windows it turns x86_64-pc-mingw64 into x86_64-unknown-mingw32. These mangled names are stored in the values $BuildPlatform, $HostPlatform and $TargetPlatform. However further down the file when the comparison is done between the stage0 compiler and the host the normalized versions are not used. So when normalization actually changes the triple this check will fail. Not sure why it's worked for all this time.. Nor if this is the right fix? Does it still work for cross compiling correctly? Test Plan: ./configure Reviewers: hvr, austin, thomie, bgamari, erikd Reviewed By: erikd Subscribers: erikd, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2452 GHC Trac Issues: #12487
* Misspellings in comments [skip ci]Gabor Greif2016-08-142-3/+3
|
* Update `nofib` submodule to newest commitGabor Greif2016-08-141-0/+0
|
* Fix GHCi perf-llvm build on x86_64Erik de Castro Lopo2016-08-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | With BuildFlavour set to `perf-llvm`, GHCi would fail as soon as it was run with: ghc-stage2: .../ghc-prim/dist-install/build/HSghc-prim-0.5.0.0.o: unknown symbol `__udivti3' ghc-stage2: unable to load package `ghc-prim-0.5.0.0' Fix this by adding `__udivti3` and `__umodti3` to RtsSymbols.c. Test Plan: Validate Reviewers: simonmar, austin, bgamari, Phyx, trofi Reviewed By: Phyx, trofi Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2449 GHC Trac Issues: #11981
* Improve missing-sig warningSimon Peyton Jones2016-08-126-43/+62
| | | | Fixes Trac #12484
* Remove StgRubbishArg and CmmArgÖmer Sinan Ağacan2016-08-1026-197/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea behind adding special "rubbish" arguments was in unboxed sum types depending on the tag some arguments are not used and we don't want to move some special values (like 0 for literals and some special pointer for boxed slots) for those arguments (to stack locations or registers). "StgRubbishArg" was an indicator to the code generator that the value won't be used. During Stg-to-Cmm we were then not generating any move or store instructions at all. This caused problems in the register allocator because some variables were only initialized in some code paths. As an example, suppose we have this STG: (after unarise) Lib.$WT = \r [dt_sit] case case dt_sit of { Lib.F dt_siv [Occ=Once] -> (#,,#) [1# dt_siv StgRubbishArg::GHC.Prim.Int#]; Lib.I dt_siw [Occ=Once] -> (#,,#) [2# StgRubbishArg::GHC.Types.Any dt_siw]; } of dt_six { (#,,#) us_giC us_giD us_giE -> Lib.T [us_giC us_giD us_giE]; }; This basically unpacks a sum type to an unboxed sum with 3 fields, and then moves the unboxed sum to a constructor (`Lib.T`). This is the Cmm for the inner case expression (case expression in the scrutinee position of the outer case): ciN: ... -- look at dt_sit's tag if (_ciT::P64 != 1) goto ciS; else goto ciR; ciS: -- Tag is 2, i.e. Lib.F _siw::I64 = I64[_siu::P64 + 6]; _giE::I64 = _siw::I64; _giD::P64 = stg_RUBBISH_ENTRY_info; _giC::I64 = 2; goto ciU; ciR: -- Tag is 1, i.e. Lib.I _siv::P64 = P64[_siu::P64 + 7]; _giD::P64 = _siv::P64; _giC::I64 = 1; goto ciU; Here one of the blocks `ciS` and `ciR` is executed and then the execution continues to `ciR`, but only `ciS` initializes `_giE`, in the other branch `_giE` is not initialized, because it's "rubbish" in the STG and so we don't generate an assignment during code generator. The code generator then panics during the register allocations: ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.1.20160722 for x86_64-unknown-linux): LocalReg's live-in to graph ciY {_giE::I64} (`_giD` is also "rubbish" in `ciS`, but it's still initialized because it's a pointer slot, we have to initialize it otherwise garbage collector follows the pointer to some random place. So we only remove assignment if the "rubbish" arg has unboxed type.) This patch removes `StgRubbishArg` and `CmmArg`. We now always initialize rubbish slots. If the slot is for boxed types we use the existing `absentError`, otherwise we initialize the slot with literal 0. Reviewers: simonpj, erikd, austin, simonmar, bgamari Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2446
* Fix a bug in unboxed sum layout generationÖmer Sinan Ağacan2016-08-092-2/+16
| | | | | | We need to maintain the invariant that the layout fields are always sorted. Two tests that were previously broken are added.
* Actually update haddock.Cabal stats.Edward Z. Yang2016-08-081-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Cabal submodule update.Edward Z. Yang2016-08-087-22/+29
| | | | | | | | | | | | | | | | | There's a substantial bump to the haddock.Cabal allocation stats, because we added 50% more modules, so of course allocations are going to increase 50%. (But perhaps this is indicative of some bad constant factor in Haddock related to modules.) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: ggreif, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2442
* Fix typo in Data.Bitraversable HaddocksRyan Scott2016-08-081-1/+1
| | | | [ci skip]
* T1969: Enable it again but bump the max residency temporarilyÖmer Sinan Ağacan2016-08-071-3/+2
| | | | | | | T1969 was broken by 714beb (which actually reduced allocations but residency was increased). Instead of disabling it completely, just bump the number a little bit to avoid making things even worse in the meantime. See also #12437.
* configure.ac: Remove checks for bug 9439Erik de Castro Lopo2016-08-072-74/+0
| | | | | | | | | | | | | | | Bug #9439 only affects some ghc 7.8 versions of the compiler and since git HEAD no longer builds with ghc-7.8 we can drop this check. Test Plan: Works here! Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2427
* Use Data.Functor.Const to implement Data.Data internalsRyan Scott2016-08-061-9/+6
| | | | | | | | | | | | Summary: `Data.Data` uses an internal datatype `CONST`, which can be replaced completely by `Const` from `Data.Functor.Const`. Reviewers: austin, bgamari, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2396
* RegAlloc: Use IntSet/IntMaps instead of generic Set/MapsÖmer Sinan Ağacan2016-08-064-29/+29
|
* RegAlloc: Remove duplicate seqList (use seqList from Util)Ömer Sinan Ağacan2016-08-061-14/+7
|
* AsmCodeGen: Give linear-scan and coloring reg. allocators different cc namesÖmer Sinan Ağacan2016-08-061-2/+2
|
* rts/Printer.h: fix constness of argument declarationSergei Trofimovich2016-08-062-2/+2
| | | | | | | | | | | | | | | | | | Noticed on today's build failure: rts/Printer.c:659:13: error: error: conflicting types for 'DEBUG_LoadSymbols' extern void DEBUG_LoadSymbols( const char *name ) ^~~~~~~~~~~~~~~~~ In file included from rts/Printer.c:17:0: error: rts/Printer.h:29:13: error: note: previous declaration of 'DEBUG_LoadSymbols' was here extern void DEBUG_LoadSymbols( char *name ); ^~~~~~~~~~~~~~~~~ Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Util.count: Implement as a left-fold instead of a right-foldJoachim Breitner2016-08-051-4/+5
|
* Replace some `length . filter` with `count`Ömer Sinan Ağacan2016-08-053-3/+3
|
* StgCmm: Remove unused Bool field of Return sequelÖmer Sinan Ağacan2016-08-053-7/+6
|
* Temporarily mark T1969 perf test as broken (#12437)Ömer Sinan Ağacan2016-08-051-1/+2
|
* Bump `hoopl` submodule, mostly cosmeticsGabor Greif2016-08-051-0/+0
|
* Another try to get thread migration rightSimon Marlow2016-08-051-99/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is surprisingly tricky. There were linked list bugs in the previous version (D2430) that showed up as a test failure in setnumcapabilities001 (that's a great stress test!). This new version uses a different strategy that doesn't suffer from the problem that @ezyang pointed out in D2430. We now pre-calculate how many threads to keep for this capability, and then migrate any surplus threads off the front of the queue, taking care to account for threads that can't be migrated. Test Plan: 1. setnumcapabilities001 stress test with sanity checking (+RTS -DS) turned on: ``` cd testsuite/tests/concurrent/should_run make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-rtsopts=-DS CLEANUP=0 while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000 || break; done ``` 2. The test case from #12419 Reviewers: niteria, ezyang, rwbarton, austin, bgamari, erikd Subscribers: thomie, ezyang Differential Revision: https://phabricator.haskell.org/D2441 GHC Trac Issues: #12419
* Fix an assertion that could randomly failSimon Marlow2016-08-052-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: ASSERT_THREADED_CAPABILITY_INVARIANTS was testing properties of the returning_tasks queue, but that requires cap->lock to access safely. This assertion would randomly fail if stressed enough. Instead I've removed it from the catch-all ASSERT_PARTIAL_CAPABILITIY_INVARIANTS and made it a separate assertion only called under cap->lock. Test Plan: ``` cd testsuite/tests/concurrent/should_run make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-rtsopts=-DS CLEANUP=0 while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000 || break; done ``` Reviewers: niteria, bgamari, ezyang, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2440 GHC Trac Issues: #10860
* Expanded abbreviations in Haddock documentationBen Gamari2016-08-0524-140/+559
| | | | | | | | | | | This adds notes to the Haddock documentation for various core datatypes expanding abbreviations. Reviewers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D2406 GHC Trac Issues: #12405
* codeGen: Remove binutils<2.17 hack, fixes T11758Alex Dzyoba2016-08-053-46/+3
| | | | | | | | | | | | | | | | | | | There was a complication on the x86_64 platform, where pointers were 64 bits, but the tools didn't support 64-bit relative relocations. This was true before binutils 2.17, which nowadays is quite standart (even CentOs 5 is shipped with 2.17). Hacks were removed from x86 genSwitch and asm pretty printer. Also [x86-64-relative] note was dropped from includes/rts/storage/InfoTables.h as it's not referenced anywhere now. Reviewers: austin, simonmar, rwbarton, erikd, bgamari Reviewed By: simonmar, erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2426
* check that the number of parallel build is greater than 0Ruey-Lin Hsu2016-08-0510-6/+41
| | | | | | | | | | | | | | Fixes #12062. Reviewers: bgamari, thomie, austin, simonmar Reviewed By: bgamari, thomie, simonmar Subscribers: simonmar, thomie Differential Revision: https://phabricator.haskell.org/D2415 GHC Trac Issues: #12062
* Remove identity update of field componentsConfigsGabor Greif2016-08-051-6/+1
| | | | | | | ... in LocalBuildInfo, getting rid of a TODO in the process. Turns out that componentsConfigs won't be a field in Cabal 2.0 any more, so this can be seen as a preparation for it.
* Trim all spaces after 'version:'Gabor Greif2016-08-051-1/+1
| | | | | | | ... that we grep out of libraries/Cabal/Cabal/Cabal.cabal This is necessary because the file got reformatted in the 'master' branch.
* Fix omission in haddock instance headGabor Greif2016-08-051-1/+1
|
* Replace an unsafeCoerce with coerceRyan Scott2016-08-041-1/+1
| | | | This matches the implementations of `castPtr` and `castFunPtr`.