summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Sparc*: Prevent GHC from doing unaligned accessesErik de Castro Lopo2016-11-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | This is specifically for the C backend on Sparc64 (which has no native backend) but is also required for Sparc when building un-registerised. Bug reported via Debian (patch included): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842780 Test Plan: validate Reviewers: hvr, Phyx, bgamari, austin, simonmar Reviewed By: Phyx Subscribers: jrtc27, thomie Differential Revision: https://phabricator.haskell.org/D2661 GHC Trac Issues: #12793
* Have static pointers work with -fno-full-laziness.Facundo Domínguez2016-11-014-9/+61
| | | | | | | | | | | | | | | | Summary: Before this patch, static pointers wouldn't be floated to the top-level. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Subscribers: mboes, thomie Differential Revision: https://phabricator.haskell.org/D2662 GHC Trac Issues: #11656
* Align GHCi's library search order more closely with LDsTamar Christina2016-10-317-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Given a static library and an import library in the same folder. e.g. ``` libfoo.a libfoo.dll.a ``` running `ghci -lfoo` we should prefer the import library `libfoo.dll.a` over `libfoo.a` because we prefer having to just load the DLL. And not having to do any linking. This also more closely emulated the behaviour of LD, which has a search order of ``` libxxx.dll.a xxx.dll.a libxxx.a cygxxx.dll (*) libxxx.dll xxx.dll ``` Test Plan: ./validate Reviewers: RyanGlScott, austin, hvr, bgamari, erikd, simonmar Reviewed By: RyanGlScott Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2651 GHC Trac Issues: #12771
* Typos in commentsGabor Greif2016-10-3112-18/+18
|
* Zap redundant importsGabor Greif2016-10-303-4/+0
|
* Fix a bug in parallel GC synchronisationSimon Marlow2016-10-294-42/+45
| | | | | | | | | | | | | | | | | | | | | Summary: The problem boils down to global variables: in particular gc_threads[], which was being modified by a subsequent GC before the previous GC had finished with it. The fix is to not use global variables. This was causing setnumcapabilities001 to fail (again!). It's an old bug though. Test Plan: Ran setnumcapabilities001 in a loop for a couple of hours. Before this patch it had been failing after a few minutes. Not a very scientific test, but it's the best I have. Reviewers: bgamari, austin, fryguybob, niteria, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2654
* Minor refactoring in stg_unpackClosurezhÖmer Sinan Ağacan2016-10-281-10/+11
| | | | | - Reuse `clos` local variable - Rename labels for clarity
* Document unpackClosure# primopÖmer Sinan Ağacan2016-10-281-0/+5
|
* Add test for #12732Ryan Scott2016-10-283-0/+13
|
* Make it possible to use +RTS -qn without -NSimon Marlow2016-10-282-8/+5
| | | | | | It's entirely reasonable to set +RTS -qn without setting -N, because the program might later call setNumCapabilities. If we disallow it, there's no way to use -qn on programs that use setNumCapabilities.
* Clarify comments on kinds (Trac #12536)Simon Peyton Jones2016-10-282-58/+5
| | | | | - Remove misleading comments from TyCoRep. - Remove 'check_lifted' calls (which were no-ops) from TcValidity.
* Minor doc addition as requested in #12774.Edward Z. Yang2016-10-271-0/+3
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Revert "rts/linker: Move loadArchive to new source file"Matthew Pickering2016-10-273-671/+655
| | | | This reverts commit 488a9ed3440fe882ae043ba7f44fed4e84e679ce.
* Fix typo in commentSimon Peyton Jones2016-10-271-1/+1
|
* Allow levity-polymorpic arrowsSimon Peyton Jones2016-10-274-2/+78
| | | | | | | This cures Trac #12668 (and cures the Lint errors you get from Trac #12718). The idea is explained in Note [Levity polymorphism], in Kind.hs
* Collect coercion variables, not type variablesSimon Peyton Jones2016-10-272-5/+5
| | | | | | | | | | | ...when tracking which constraints are used. Previously we were gathering type variables too, which meant that the ics_need field was (stupidly) non-empty, which meant that we kept hold of solved implications for no purpose. Better just to get rid of them, which setImplicationStatus is all ste up to to do. No change in behaviour; a bit more efficient.
* Simple refactor to remove misleading commentSimon Peyton Jones2016-10-271-5/+3
|
* CmmUtils: remove the last dataflow functionsMichal Terepeta2016-10-266-81/+59
| | | | | | | | | | | | | | | | | | | | This commit: - Moves the remaining few methods concerned with dataflow analysis from `CmmUtils` to `Hoopl.Dataflow`. - Refactors the code to not use `FwdPass` and simply pass `FwdTransfer` and `DataflowLattice` directly. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: validate Reviewers: austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2634
* Remove -dtrace-levelMatthew Pickering2016-10-265-20/+15
| | | | | | | | | | | | | | | | | | | The flag was: 1. Not documented. 2. Only used as a boolean flag. 3. Has overlapping functionality with -dno-debug-output 4. My poll of #ghc concluded that people didn't know it existed. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2627 GHC Trac Issues: #12691
* Refine ASSERT in buildPatSyn for the nullary case.Matthew Pickering2016-10-264-2/+24
| | | | | | | | | | | | | | | | | For a nullary pattern synonym we add an extra void argument to the matcher in order to preserve laziness. The check in buildPatSyn wasn't aware of this special case which was causing the assertion to fail. Reviewers: austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2624 GHC Trac Issues: #12746
* rts/linker: Move loadArchive to new source fileBen Gamari2016-10-263-655/+671
| | | | | | | | | | | | | | Test Plan: Validate Reviewers: erikd, simonmar, austin, DemiMarie Reviewed By: erikd, simonmar, DemiMarie Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D2615 GHC Trac Issues: #12388
* Make traceRn behave more like traceTcMatthew Pickering2016-10-2610-90/+107
| | | | | | | | | | | | Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2586 GHC Trac Issues: #12617
* Delete extraneous backtick in users' guideRyan Scott2016-10-261-1/+1
| | | | [ci skip]
* Fundeps work even for unary type classesSimon Peyton Jones2016-10-265-56/+35
| | | | | | | | | | | | The functional-dependency improvement functions, improveFromAnother improveFromInstEnv had a side-condition that said the type class has to have at least two arguments. But not so, as Trac #12763 shows: class C a | -> a where ... is perfectly legal, albeit a bit of a corner case.
* testsuite: Bump peak_megabytes_allocated for T3064Ben Gamari2016-10-251-1/+2
|
* Test Trac #12081Simon Peyton Jones2016-10-243-0/+17
|
* Test Trac #12174Simon Peyton Jones2016-10-243-0/+17
|
* Take account of kinds in promoteTcTypeSimon Peyton Jones2016-10-2411-191/+196
| | | | | | | | | One of the ASSERT failures in Trac #12762, namely the one for T4439, showed that I had not dealt correctly with promoting the kind of a type in promoteTcType. Happily I could fix this by simplifying InferRes (eliminating the ir_kind field), so things get better. And the ASSERT is fixed.
* Don't instantaite when typechecking a pattern synonymSimon Peyton Jones2016-10-241-1/+1
| | | | Fixes most of the cases in Trac #12762
* Prioritise class-level equality costraintsSimon Peyton Jones2016-10-245-1/+237
| | | | | | | | | | | | | This patch fixes Trac #12734 by prioritising the class-level variants of equality constraints, namely (a~b) and (a~~b). See comment:10 of Trac #12734 for a description of what went wrong, and Note [Prioritise class equalities] in TcSMonad. The fix is still not great, but it's a definite step forward, and cures the particular problem. Worth merging to 8.0.
* rts: Move path utilities to separate source fileBen Gamari2016-10-233-83/+112
| | | | | | | | | | | | Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2614
* Refactoring: Replace when (not ...) with unless in ErrUtilsMatthew Pickering2016-10-231-1/+1
| | | | [skip ci]
* rts/package.conf.in: Fix CPP usageErik de Castro Lopo2016-10-231-1/+1
| | | | | | | | | | | | | | | | | Summary: The configure script sets `HAVE_LIBNUMA` to either `0` or `1` but this file had `#ifdef HAVE_LIBNUMA`. This surfaced as a side-effect of 1050e46b5b. CPP is really hard to get right. Test Plan: Validate on harbourmaster Reviewers: simonmar, bgamari, austin, mpickering Reviewed By: mpickering Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2631
* cmm/Hoopl/Dataflow: minor cleanupMichal Terepeta2016-10-221-26/+40
| | | | | | | | | | | | | | | | | This doesn't have any functional changes, it simply removes one unnecessary top binding and improves the comments. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2619
* Refactoring: Delete copied function in backpack/NameShapeMatthew Pickering2016-10-223-86/+75
| | | | | | | | | | | | | Also moved a few utility functions which work with Avails into the Avail module to avoid import loops and increase discoverability. Reviewers: austin, bgamari, ezyang Reviewed By: ezyang Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2629
* Add -Wcpp-undef warning flagErik de Castro Lopo2016-10-228-4/+38
| | | | | | | | | | | | | | | | | | | | When enabled, this new warning flag passes `-Wundef` to the C pre-processor which causes the pre-processor to warn on uses of the `#if` directive on undefined identifiers. It is not currently enabled in any of the standard warning groups. Test Plan: Make sure the two tests pass on all major platforms. Reviewers: hvr, carter, Phyx, bgamari, austin Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2626 GHC Trac Issues: #12752
* Skip T5611 on OSX as it fails non-deterministically.Matthew Pickering2016-10-221-1/+2
| | | | | | | | | | Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2622 GHC Trac Issues: #12751
* rts: configure.ac should populate HAVE_LIBNUMA instead of USE_LIBNUMADarshan Kapashi2016-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code in rts/ which deals with numa checks for `#if HAVE_LIBNUMA`, however this macro is not populated during `./configure`. https://phabricator.haskell.org/D2329 changed this code last and we instead set `USE_LIBNUMA` which fails to setup numa correctly. Test Plan: From main directory in ghc, ./configure && make clean && make boot && make cd nofib/parallel/queens ../../../inplace/bin/ghc-stage2 Main.hs -rtsopts -threaded ./Main 15 +RTS -N24 -s -A64m --numa This fails before this patch with Main: --numa: OS reports NUMA is not available After the fix, it works as expected. Run the validation script, ./validate (It fails with an error in `compiler/utils/Util.hs` saying `GHC.Stack.CallStack` not found, once I remove this 1 line from this file , the script works) Reviewers: hvr, austin, bgamari, erikd, simonmar Reviewed By: erikd, simonmar Subscribers: mpickering, thomie, erikd, niteria Differential Revision: https://phabricator.haskell.org/D2620 GHC Trac Issues: #12741
* Fix failure in setnumcapabilities001 (#12728)Simon Marlow2016-10-222-28/+27
| | | | | | | | | | | | | | | | | | | | | | | | | The value of enabled_capabilities can change across a call to requestSync(), and we were erroneously using an old value, causing things to go wrong later. It manifested as an assertion failure, I'm not sure whether there are worse consequences or not, but we should get this fix into 8.0.2 anyway. The failure didn't happen for me because it only shows up on machines with fewer than 4 processors, due to the new logic to enable -qn automatically. I've bumped the test parameter 8 to make it more likely to exercise that code. Test Plan: Ran setnumcapabilities001 many times Reviewers: niteria, austin, erikd, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2617 GHC Trac Issues: #12728
* Add and use a new dynamic-library-dirs field in the ghc-pkg infoDuncan Coutts2016-10-2110-10/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Build systems / package managers want to be able to control the file layout of installed libraries. In general they may want/need to be able to put the static libraries and dynamic libraries in different places. The ghc-pkg library regisrtation needs to be able to handle this. This is already possible in principle by listing both a static lib dir and a dynamic lib dir in the library-dirs field (indeed some previous versions of Cabal did this for shared libs on ELF platforms). The downside of listing both dirs is twofold. There is a lack of precision, if we're not careful with naming then we could end up picking up the wrong library. The more immediate problem however is that if we list both directories then both directories get included into the ELF and Mach-O shared object runtime search paths. On ELF this merely slows down loading of shared libs (affecting prog startup time). On the latest OSX versions this provokes a much more serious problem: that there is a rather low limit on the total size of the section containing the runtime search path (and lib names and related) and thus listing any unnecessary directories wastes the limited space. So the solution in this patch is fairly straightforward: split the static and dynamic library search paths in the ghc-pkg db and its use within ghc. This is a traditional solution: pkg-config has the same static / dynamic split (though it describes in in terms of private and public, but it translates into different behaviour for static and dynamic linking). Indeed it would make perfect sense to also have a static/dynamic split for the list of the libraries to use i.e. to have dynamic variants of the hs-libraries and extra-libraries fields. These are not immediately required so this patch does not add it, but it is a reasonable direction to follow. To handle compatibility, if the new dynamic-library-dirs field is not specified then its value is taken from the library-dirs field. Contains Cabal submodule update. Test Plan: Run ./validate Get christiaanb and carter to test it on OSX Sierra, in combination with Cabal/cabal-install changes to the default file layout for libraries. Reviewers: carter, austin, hvr, christiaanb, bgamari Reviewed By: christiaanb, bgamari Subscribers: ezyang, Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2611 GHC Trac Issues: #12479
* Improve TcCanonical.unifyWanted and unifyDerivedSimon Peyton Jones2016-10-211-14/+19
| | | | | | | | When debugging something else I noticed that these functions were emitting constraints like [W] a ~ a which is plain stupid. So I fixed it not to do that. Should result in fewer constraints getting generated.
* Define emitNewWantedEq, and use itSimon Peyton Jones2016-10-213-14/+19
| | | | This is just a minor refactoring
* Refactor occurrence-check logicSimon Peyton Jones2016-10-2113-399/+102
| | | | | | | | | | | | | | | | This patch does two related things * Combines the occurrence-check logic in the on-the-fly unifier with that in the constraint solver. They are both doing the same job, after all. The resulting code is now in TcUnify: metaTyVarUpdateOK occCheckExpand occCheckForErrors (called in TcErrors) * In doing this I disovered checking for family-free-ness and foralls can be unnecessarily inefficient, because it expands type synonyms. It's easy just to cache this info in the type syononym TyCon, which I am now doing.
* Accept 20% dedgradation in Trac #5030 compile timeSimon Peyton Jones2016-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | In commit 31621b12 * A collection of type-inference refactorings. I fixed a bug in the on-the-fly unifier. Usually the on-the-fly unifier (TcUnify) defers type function applications to the constraint solver. But in one situation it inconsistently did not defer, so a unification happened without reducing a type function. By a fluke this makes T5030 (specifcially the definition of cnst) much better. It turns out that consistently non-deferring type functions makes the test for #3064 go bad. So somehow the current, inconsistent situation was an accidental sweet spot. But it's a horrible sweet spot, relying on what was essentially a bug. So I've accepted the worsening (it's an exotic case), and opened #12724 to deal with the underlying cause.
* A collection of type-inference refactorings.Simon Peyton Jones2016-10-2179-859/+1322
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does a raft of useful tidy-ups in the type checker. I've been meaning to do this for some time, and finally made time to do it en route to ICFP. 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, 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 9. Kill off tcs_used_tcvs. Its purpose is to track the givens used by wanted constraints. For dictionaries etc we do that via the free vars of the /bindings/ in the implication constraint ic_binds. But for coercions we just do update-in-place in the type, rather than generating a binding. So we need something analogous to bindings, to track what coercions we have added. That was the purpose of tcs_used_tcvs. But it only worked for a /single/ iteration, whereas we may have multiple iterations of solving an implication. Look at (the old) 'setImplicationStatus'. If the constraint is unsolved, it just drops the used_tvs on the floor. If it becomes solved next time round, we'll pick up coercions used in that round, but ignore ones used in the first round. There was an outright bug. Result = (potentialy) bogus unused-constraint errors. Constructing a case where this actually happens seems quite trick so I did not do so. Solution: expand EvBindsVar to include the (free vars of the) coercions, so that the coercions are tracked in essentially the same way as the bindings. This turned out to be much simpler. Less code, more correct. 10. Make the ic_binds field in an implication have type ic_binds :: EvBindsVar instead of (as previously) ic_binds :: Maybe EvBindsVar This is notably simpler, and faster to use -- less testing of the Maybe. But in the occaional situation where we don't have anywhere to put the bindings, the belt-and-braces error check is lost. So I put it back as an ASSERT in 'setImplicationStatus' (see the use of 'termEvidenceAllowed') All these changes led to quite bit of error message wibbling
* Make TcLevel increase by 1 not 2Simon Peyton Jones2016-10-211-11/+6
| | | | | | | | | | Make the TcLevel of a flatten-meta-var be always zero. See TcType.fmvTcLevel. This allows the levels of implication constraints to to up by 1 each time instead of 2, which is less confusing. This change has no effect on type checking.
* Test Trac #12507Simon Peyton Jones2016-10-212-0/+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-10-215-21/+23
|
* Refactor typechecking of pattern bindingsSimon Peyton Jones2016-10-215-177/+304
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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!
* Typos in commentsGabor Greif2016-10-214-5/+5
|