summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix binary-trees regression from unnecessary floating in CorePrep.wip/D2471Edward Z. Yang2016-08-304-12/+76
| | | | | | | | | | | | | | | | | | | Summary: In 0d3bf62092de83375025edca6f7242812338542d, I handled lazy @(Int -> Int) f x correctly, but failed to handle lazy @Int (f x) (we need to collect arguments in f x). Additionally, if we have lazy @Int (case ...) (or anything that's not an application, we have to bounce back to cpeRhsE. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, nomeata, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2471
* Remove unused DerivInst constructor for DerivStuffRyan Scott2016-08-292-16/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: Back when derived `Generic` instances used to generate auxiliary datatypes, they would also generate instances for those datatypes. Nowadays, GHC generics uses a `DataKinds`-based encoding that requires neither auxiliary datatypes (corresponding to the `DerivTyCon` constructor of `DerivStuff`) nor instances for them (the `DerivInst` constructor of `DerivStuff`). It appears that `DerivTyCon` constructor was removed at some point, but `DerivInst` never was. No `DerivInst` values are ever constructed, so we can safely remove it. Test Plan: It builds Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2481
* Fix broken Haddock commentRyan Scott2016-08-291-1/+1
|
* Template Haskell support for TypeApplicationsRyan Scott2016-08-2912-31/+78
| | | | | | | | | | | | | | | | Summary: Fixes #12530. Test Plan: make test TEST=12530 Reviewers: austin, bgamari, hvr, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2472 GHC Trac Issues: #12530
* Typofix in docs.Edward Z. Yang2016-08-281-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Fix scoping of type variables in instancesSimon Peyton Jones2016-08-266-35/+78
| | | | | | | | | | | | | | This fixes Trac #12531: class Foo x where foo :: forall a . x a -> x a default foo :: forall b . x b -> x b foo x = go where go :: x b go = undefined We want 'b' to scope over the code for 'foo', but we were using 'a' instead.
* Move import to avoid warningSimon Peyton Jones2016-08-261-1/+1
| | | | The import of UniqFM in HscTypes was only needed in stage2
* Allow typed holes to be levity-polymorphicSimon Peyton Jones2016-08-264-4/+12
| | | | | | This one-line change fixes Trac #12531. Hooray. Simple, non-invasive; can merge to 8.0.2
* Fix doc build inconsistencyHarendra Kumar2016-08-251-0/+1
| | | | | | | | | | | | | | Remove the doc targets completely not partially when disabled. Otherwise even though we are able to build the targets but we will see some strange errors. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2470
* WwLib: Add strictness signature to "let x = absentError …"Joachim Breitner2016-08-252-8/+15
| | | | | indicating that it is bottom. This should help making the "empty cases" lint error give less false alarms.
* Degrade "case scrutinee not known to diverge for sure" Lint error to warningJoachim Breitner2016-08-251-1/+1
| | | | | as proposed in #12435, as it easily gets in the way of development when it reports false positives.
* DmdAnal: Testcase about splitFVs and dmdFix abortionJoachim Breitner2016-08-252-0/+30
| | | | | | | Any variable with useful information (strict or used-once) will not be included in lazy_fv (according to splitFVs). If we now also remove them from the strictness signatures, their uses are not recorded anywhere – and then probably considered absent.
* DmdAnal: Add a final, safe iterationJoachim Breitner2016-08-255-81/+128
| | | | | | | | | | | | | | | | | | | this fixes #12368. It also refactors dmdFix a bit, removes some redundancies (such as passing around an strictness signature right next to an id, when that id is guaranteed to have been annotated with that strictness signature). Note that when fixed-point iteration does not terminate, we conservatively delete their strictness signatures (set them to nopSig). But this loses the information on how its strict free variables are used! Lazily used variables already escape via lazy_fvs. We ensure that in the case of an aborted fixed-point iteration, also the strict variables are put there (with a conservative demand of topDmd). Differential Revision: https://phabricator.haskell.org/D2392
* Comments only: Refer to actually existing NotesJoachim Breitner2016-08-251-2/+3
|
* Template Haskell support for unboxed sumsRyan Scott2016-08-2318-93/+277
| | | | | | | | | | | | | | | | | | | | | | | This adds new constructors `UnboxedSumE`, `UnboxedSumT`, and `UnboxedSumP` to represent unboxed sums in Template Haskell. One thing you can't currently do is, e.g., `reify ''(#||#)`, since I don't believe unboxed sum type/data constructors can be written in prefix form. I will look at fixing that as part of #12514. Fixes #12478. Test Plan: make test TEST=T12478_{1,2,3} Reviewers: osa1, goldfire, austin, bgamari Reviewed By: goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2448 GHC Trac Issues: #12478
* RtClosureInspect: Fix off-by-one error in cvReconstructTypemniip2016-08-234-4/+10
| | | | | | | | | | | | | | | | | Replaced error-prone index manipulation on a pointer array with a simple fold on the array elements. Test Plan: Added a test case that triggers the bug Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2439 GHC Trac Issues: #12458
* Add T12520 as a testÖmer Sinan Ağacan2016-08-234-0/+18
| | | | #12520 was already fixed in HEAD. Adding a test to make sure it stays fixed.
* Move #12403, #12513 users guide notes to 8.2.1 release notesRyan Scott2016-08-222-11/+8
| | | | | | | | The changes in #12403 and #12513 subtly changed the behavior of Template Haskell reification and splicing. While the old behavior was certainly buggy, it's possible that there's code in the wild that depended on the old behavior to work. To err on the side of caution, I'll postpone these changes to GHC 8.2.1 instead of having them merged into GHC 8.0.2.
* Extra comments, as per SPJ in #12035.Edward Z. Yang2016-08-222-1/+8
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Splice singleton unboxed tuples correctly with Template HaskellRyan Scott2016-08-225-3/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Previously, TH would implicitly remove the parentheses when splicing in singleton unboxed tuple types (e.g., turning `(# Int #)` into `Int`). Luckily, the fix is simply to delete some code. Fixes #12513. Test Plan: make test TEST=T12513 Reviewers: hvr, bgamari, austin, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2462 GHC Trac Issues: #12513
* pass -z wxneeded or -Wl,-zwxneeded for linking on OpenBSDKarel Gardas2016-08-221-0/+7
| | | | | | | | | | | | | | | | | Summary: This patch fixes issue with abort in GHCi on OpenBSD current as of Aug 12 2016. The OpenBSD is more and more strict about usage of writable and executable memory. Programs/applications which requires such functionality need to be linked with -z wxneeded linker flag and need to be run from the file-system mounted with wxallowed mount option. If either of those options in not met, then problematic program/application usually fail on some mmap/mprotect call which fail. Reviewers: bgamari, austin, hvr Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2454
* Fix #12472 by looking for noinline/lazy inside oversaturated applications.Edward Z. Yang2016-08-212-91/+128
| | | | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2444 GHC Trac Issues: #12472
* We also need to retypecheck before when we do parallel make.Edward Z. Yang2016-08-214-2/+20
| | | | | | | | | | | | | | | | | | Summary: Kept this seperate from the previous patch for clarity. Comes with a test. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2220 GHC Trac Issues: #12035
* Retypecheck both before and after finishing hs-boot loops in --make.Edward Z. Yang2016-08-217-8/+55
| | | | | | | | | | | | | | | | | | Summary: This makes ghc --make's retypecheck behavior more in line with ghc -c, which is able to tie the knot as we are typechecking. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2213 GHC Trac Issues: #12035
* When a value Id comes from hi-boot, insert noinline. Fixes #10083.Edward Z. Yang2016-08-215-62/+89
| | | | | | | | | | | | | | | | | | | Summary: This also drops the parked fix from efa7b3a474bc373201ab145c129262a73c86f959 (though I didn't revert the refactoring). Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2211 GHC Trac Issues: #10083
* Introduce BootUnfolding, set when unfolding is absent due to hs-boot file.Edward Z. Yang2016-08-2113-21/+52
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2246
* Support for noinline magic function.Edward Z. Yang2016-08-218-6/+85
| | | | | | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2209
* Axe initIfaceTc, tie the knot through HPT (or if_rec_types).Edward Z. Yang2016-08-2112-58/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: initIfaceTc was originally used to make sure when we typecheck an interface, it can find the TyThings for things it itself defined. However, in the case of retypecheckLoop, this wasn't necessary because we ALREADY tied the knot through the HPT. This commit removes initIfaceTc, instead relying on the HPT to tie the knot. genModDetails' caller needed to be modified to tie the knot, but there are not that many call-sites of typecheckIface so the change is quite reasonable. We also introduce a new 'initIfaceLoad', which does NOT set up 'if_rec_types'. It's used when we're typechecking old, up-to-date interfaces in, since we're never going to update the type environment. The full details are in Note [Knot-tying typecheckIface]. Displeasingly, we need a special case to handle DFuns in the case of tcHiBootIface, see Note [DFun knot-tying special case] for the gory details. I also added another test which tickles a bug in a buggy version of this patch (see "Why the seq?") Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2349
* Annotate initIfaceCheck with usage information.Edward Z. Yang2016-08-216-8/+8
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* 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.