summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove uniqSetToListBartosz Nitka2016-07-0112-48/+86
| | | | | | | This documents nondeterminism in code generation and removes the nondeterministic ufmToList function. In the future someone will have to use nonDetEltsUFM (with proper explanation) or pprUFM.
* Allow one type signature for multiple pattern synonymsMatthew Pickering2016-07-017-18/+18
| | | | | | | | | This makes pattern synonym signatures more consistent with normal type signatures. Updates haddock submodule. Differential Revision: https://phabricator.haskell.org/D2083
* Add NamedThing (GenLocated l e) instanceBen Gamari2016-07-011-0/+3
|
* CmmExpr: remove unused `vgcFlag` functionMichal Terepeta2016-06-301-6/+1
| | | | | | | | | | | | Test Plan: validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2351
* nativeGen: Allow -fregs-graph to be usedBen Gamari2016-06-301-4/+2
| | | | | | | | | | | | | | | | Previously the flag was silently ignored due the #7679 and #8657. This, however, seems unnecessarily brutal and makes experimentation unduly difficult for users. Test Plan: Validate Reviewers: austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2335 GHC Trac Issues: #7679, #8657
* Trac #11554 fix loopy GADTsAlexander Vieth2016-06-301-1/+25
| | | | | | | | | | | | | | Summary: Fixes T11554 Reviewers: goldfire, thomie, simonpj, austin, bgamari Reviewed By: thomie, simonpj, bgamari Subscribers: simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2283 GHC Trac Issues: #11554
* Axe RecFlag on TyCons.Edward Z. Yang2016-06-3013-350/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit removes the information about whether or not a TyCon is "recursive", as well as the code responsible for calculating this information. The original trigger for this change was complexity regarding how we computed the RecFlag for hs-boot files. The problem is that in order to determine if a TyCon is recursive or not, we need to determine if it was defined in an hs-boot file (if so, we conservatively assume that it is recursive.) It turns that doing this is quite tricky. The "obvious" strategy is to typecheck the hi-boot file (since we are eventually going to need the typechecked types to check if we properly implemented the hi-boot file) and just extract the names of all defined TyCons from the ModDetails, but this actually does not work well if Names from the hi-boot file are being knot-tied via if_rec_types: the "extraction" process will force thunks, which will force the typechecking process earlier than we have actually defined the types locally. Rather than work around all this trickiness (it certainly can be worked around, either by making interface loading MORE lazy, or just reading of the set of defined TyCons directly from the ModIface), we instead opted to excise the source of the problem, the RecFlag. For one, it is not clear if the RecFlag even makes sense, in the presence of higher-orderness: data T f a = MkT (f a) T doesn't look recursive, but if we instantiate f with T, then it very well is! It was all very shaky. So we just don't bother anymore. This has two user-visible implications: 1. is_too_recursive now assumes that all TyCons are recursive and will bail out in a way that is still mysterious to me if there are too many TyCons. 2. checkRecTc, which is used when stripping newtypes to get to representation, also assumes all TyCons are recursive, and will stop running if we hit the limit. The biggest risk for this patch is that we specialize less than we used to; however, the codeGen tests still seem to be passing. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Reviewers: simonpj, austin, bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2360
* Remove ufmToListBartosz Nitka2016-06-307-26/+60
| | | | | | | This documents nondeterminism in code generation and removes the nondeterministic ufmToList function. In the future someone will have to use nonDetUFMToList (with proper explanation) or pprUFMWithKeys.
* Delete Ord UniqueBartosz Nitka2016-06-309-35/+169
| | | | | | | | | | | | | | | | | | | | | | Ord Unique can be a source of invisible, accidental nondeterminism as explained in Note [No Ord for Unique]. This removes it, leaving a note with rationale. It's unfortunate that I had to write Ord instances for codegen data structures by hand, but I believe that it's a right trade-off here. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2370 GHC Trac Issues: #4012
* Fix pretty-printer for IfaceCoSimon Peyton Jones2016-06-301-11/+16
| | | | | | | As Trac #12242 showed, there was a missing case in the pretty printer for IfaceCo. I've refactored it so that the pattern-match ovelap checker will spot it next time.
* Refactor match to not use Unique orderBartosz Nitka2016-06-291-9/+23
| | | | | | | | | | | | | | | | Unique order can introduce nondeterminism. As a step towards removing the Ord Unique instance I've refactored the code to use deterministic sets instead. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2369 GHC Trac Issues: #4012
* Stop the simplifier from removing StaticPtr binds.Facundo Domínguez2016-06-285-17/+62
| | | | | | | | | | | | | | | | | | | | | | | Summary: We have the FloatOut pass create exported ids for floated StaticPtr bindings. The simplifier doesn't try to remove those. This patch also improves on 7fc20b by making a common definition collectStaticPtrSatArgs to test for StaticPtr binds. Fixes #12207. Test Plan: ./validate Reviewers: simonpj, austin, bgamari, simonmar, goldfire Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2366 GHC Trac Issues: #12207
* Deal correctly with unused imports for 'coerce'Simon Peyton Jones2016-06-286-68/+85
| | | | | | | | | | | | | | | | | We only do newtype unwrapping for Coercible constraints if the newtype's data constructor is in scope. We were trying to record the fact that the data constructor was thereby 'used', so that an import statement would not be flagged as unnecsssary (by -Wunused-imports). But the code was simply wrong. It was wrong because it assumed that only one level of unwrapping happened, whereas tcTopNormaliseNewTypeTF_maybe actually unwraps multiple layers. So we need to return a /list/ of data constructors that are used. This entailed a bit of refactoring, as usual. Fixes Trac #12067
* Don't omit any evidence bindingsSimon Peyton Jones2016-06-281-28/+29
| | | | | | | | This fixes Trac #12156, where we were omitting to make an evidence binding (because cec_suppress was on), but yet the program was compiled and run. The fix is easy, and involves deleting code :-).
* Typos in user manual and code: recurisve -> recursiveÖmer Sinan Ağacan2016-06-272-2/+2
|
* Remove some `undefined`sÖmer Sinan Ağacan2016-06-274-13/+10
| | | | | | These get annoying when `undefined` is actually used as placeholder in WIP code. Some of these were also completely redundant (just call `deAnnotate'` instead of `deAnnotate` etc.).
* Allow building static libs.Moritz Angermann2016-06-251-0/+2
| | | | | | | | | | | | | | | | | | Summary: Commit 90538d86af579595987826cd893828d6f379f35a, seems to have broken static linking. The introduction of `argFixup` in `runLink` rearranges libs, and considers anything with an `-l` prefix or `.a` suffix a lib, which fails for libs that are just being linked together (e.g. `-o lib.a`). The proposed solution explicitly checks for the existance of the `-o` flag. Reviewers: rwbarton, erikd, Phyx, bgamari, austin Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2362
* Refactor tcInferArgs and add comments.Richard Eisenberg2016-06-254-41/+57
| | | | | | This removes an unnecessary loop looking for invisible binders and tries to clarify what the very closely-related functions tcInferArgs, tc_infer_args, tcInferApps all do.
* s/Invisible/Inferred/g s/Visible/Required/gRichard Eisenberg2016-06-2526-200/+206
| | | | | | | | | | | | | This renames VisibilityFlag from > data VisibilityFlag = Visible | Specified | Invisible to > data ArgFlag = Required | Specified | Inferred The old name was quite confusing, because both Specified and Invisible were invisible! The new names are hopefully clearer.
* Remote GHCi: comments onlySimon Marlow2016-06-242-3/+20
| | | | | | | | | | | | Summary: Add more Notes and signposts across the codebase to help navigation. Test Plan: validate Reviewers: goldfire, simonpj, austin, ezyang, hvr, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2358
* Remote GHCi: separate out message typesSimon Marlow2016-06-241-11/+19
| | | | | | | | | | | | | | | | | Summary: From a suggestion by @goldfire: clean up the message types, so that rather than one Message type with all the messages, we have a separate THMessage type for messages sent back to GHC during TH execution. At the same time I also removed the QDone/QFailed/QException messages into their own type, and made the result type of RunTH more accurate. Test Plan: validate Reviewers: goldfire, ezyang, austin, niteria, bgamari, erikd Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D2356
* Implement ReifyConStrictness for -fexternal-interpreter (#12219)Simon Marlow2016-06-241-0/+1
| | | | | | | Fixes T10697_decided_1.run T10697_decided_1 [exit code non-0] (ext-interp) T10697_decided_2.run T10697_decided_2 [exit code non-0] (ext-interp) T10697_decided_3.run T10697_decided_3 [exit code non-0] (ext-interp)
* Improve pretty-printing of AvailSimon Peyton Jones2016-06-241-2/+5
|
* Remove bogus comment on ForAllTySimon Peyton Jones2016-06-241-2/+0
|
* Fix renamer panicSimon Peyton Jones2016-06-241-7/+15
| | | | | | | | | | | This patch fixes Trac #12216 and #12127. The 'combine' function in 'imp_occ_env' in RnNames.filterImports checked for an empty field-selector list, which was (a) unnecessary and (b) wrong. I've elaborated the comments. This does NOT fix #11959 which is related but not the same (it concerns bundling of pattern synonyms).
* Comments around invisibilitySimon Peyton Jones2016-06-243-3/+4
| | | | Very minor
* Improve typechecking of instance defaultsSimon Peyton Jones2016-06-244-88/+71
| | | | | | | | | | | | | | | | | | | | | | | | | In an instance declaration when you don't specify the code for a method, GHC fills in from the default binding in the class. The type of the default method can legitmiately be ambiguous --- see Note [Default methods in instances] in TcInstDcls --- so typechecking it can be tricky. Trac #12220 showed that although we were dealing with that ambiguity for /vanilla/ default methods, we were not doing so for /generic/ default methods. Moreover we were dealing with it clumsily, by generating post-typechecked code. This patch fixes the bug AND deletes code! We now use the same code path for both vanilla and generic default methods; and generate /pre-typechecked/ code in both cases. The key trick is that we can use Visible Type Application to deal with the ambiguity, which wasn't possible before. Hooray. There is a small hit to performance in compiler/perf/T1969 which consists of nothing BUT instance declarations with several default methods to fill, which we now have to typecheck. The actual hit is from 724 -> 756 or 4% in that extreme example. Real world programs have vastly fewer instance decls.
* Fix #10963 and #11975 by adding new cmds to GHCi.Richard Eisenberg2016-06-238-73/+162
| | | | | | See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975}
* Fix #11974 by adding a more smarts to TcDefaults.Richard Eisenberg2016-06-233-18/+33
| | | | | | Test cases: typecheck/should_compile/T11974 typecheck/should_fail/T11974b
* Very confusing typo in error message.Richard Eisenberg2016-06-231-1/+1
|
* Remove Ord TyConBartosz Nitka2016-06-231-7/+0
| | | | | | | | After 35d1564cea2e: Provide Uniquable version of SCC we can remove this. We want to remove it because when used it can introduce unnecessary nondeterminism. GHC Trac: #4012
* Provide Uniquable version of SCCBartosz Nitka2016-06-2317-47/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | We want to remove the `Ord Unique` instance because there's no way to implement it in deterministic way and it's too easy to use by accident. We sometimes compute SCC for datatypes whose Ord instance is implemented in terms of Unique. The Ord constraint on SCC is just an artifact of some internal data structures. We can have an alternative implementation with a data structure that uses Uniquable instead. This does exactly that and I'm pleased that I didn't have to introduce any duplication to do that. Test Plan: ./validate I looked at performance tests and it's a tiny bit better. Reviewers: bgamari, simonmar, ezyang, austin, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2359 GHC Trac Issues: #4012
* Have Core linter accept programs using StaticPointers and -fhpc.Facundo Domínguez2016-06-231-1/+1
| | | | | | | | | | | | | | | | | | Summary: This patch uses collectArgsTicks instead of collectArgs to test that StaticPtr only occurs at the top of RHSs of top-level expressions. Ticks introduced by -fhpc would interfere otherwise. Test Plan: ./validate Reviewers: thomie, austin, goldfire, bgamari, simonpj Reviewed By: simonpj Differential Revision: https://phabricator.haskell.org/D2355 GHC Trac Issues: #12207
* Narrow the use of record wildcards slightlySimon Peyton Jones2016-06-231-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | In reviewing the fix to Trac #12130 I found the wild-card fill-in code for ".." notation in record constructions hard to understand. It went to great contortions (including the find_tycon code) to allow data T = C { x, y :: Int } f x = C { .. } to expand to f x = C { x = x, y = y } where 'y' is an /imported function/! That seems way over the top for what record wildcards are supposed to do. So I have narrowed the record-wildcard expansion to include only /locally-bound/ variables; i.e. not top level, and certainly not imported. I don't think anyone is using record wildcards in this bizarre way, so I don't expect any fallout. Even if there is, you can easily initialise fields with eponymous but imported values by hand. An intermediate position would be to allow /local/ top-level definitions. But I doubt anyone is doing that either. Let's see if there's any fallout. It's a local change, easy to revert, so I've just gone ahead to save everyone's time.
* Narrow the warning for simplifiable constraintsSimon Peyton Jones2016-06-231-6/+14
| | | | | | | | | | | | | | In Trac #11948 I added the warning -Wsimplifiable-class-constraints which warns if the class constraints in a type signature are simplifiable. But in fact the fragility it warns about only happens with NoMonoLocalBinds, so this patch switches off the warning if you have MonoLocalBinds (and suggests using it in the error message). See Note [Simplifiable given constraints] in TcValidity.
* Remove unused importSimon Peyton Jones2016-06-231-1/+0
|
* Give lookupGRE_Name a better APISimon Peyton Jones2016-06-2310-22/+28
| | | | | | | | | | lookupGRE_Name should return either zero or one GREs, never several. This is a consequence of INVARIANT 1 on GlobalRdrEnv. So it's better if it returns a Maybe; the panic on multiple results is put in one place, instead of being scattered or ignored. Just refactoring, no change in behaviour
* Expand given superclasses more eagerlySimon Peyton Jones2016-06-225-45/+76
| | | | | | | | | | | | | This patch fixes Trac #12175, another delicate corner case of Note [Instance and Given overlap] in TcInteract. In #12175 we were not expanding given superclasses eagerly enough. It was easy to fix, and is actually rather neater than before. See Note [Eagerly expand given superclasses] in TcCanonical. The main change is to move the eager expansion of given superclasses to canClassNC.
* Remove unused arg to tcSuperClassesSimon Peyton Jones2016-06-221-5/+4
| | | | | We don't need the FamInstEnvs argument any more. Just a tiny refactor.
* Improve error message in deriving( Functor )Simon Peyton Jones2016-06-221-3/+10
| | | | Fixes Trac #12163. Pretty simple.
* Comments onlySimon Peyton Jones2016-06-221-1/+0
|
* Make the Ord Module independent of Unique order (2nd try)Bartosz Nitka2016-06-222-33/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | The `Ord Module` instance currently uses `Unique`s for comparison. We don't want to use the `Unique` order because it can introduce nondeterminism. This switches `Ord ModuleName` and `Ord UnitId` to use lexicographic ordering making `Ord Module` deterministic transitively. I've run `nofib` and it doesn't make a measurable difference. See also Note [ModuleEnv determinism and performance]. This fixes #12191 - the regression, that the previous version of this patch had. Test Plan: ./validate run nofib: P112 Reviewers: simonmar, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2354 GHC Trac Issues: #4012, #12191
* More typos in comments [skip ci]Gabor Greif2016-06-2212-13/+13
|
* Typos in comments [skip ci]Gabor Greif2016-06-225-6/+6
|
* Hopefully fix all the rebase-induced breakageSimon Marlow2016-06-221-1/+1
|
* Fix build breakage due to rebaseSimon Marlow2016-06-221-1/+1
|
* Second attempt to fix sizeExprSimon Marlow2016-06-222-30/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Background: * sizeExpr was calculating expressions like ((e `cast` T) x) wrongly * Fixing it caused regressions in compile performance, and one nofib program (k-nucleotide) I managed to fix the source of the compiler regressions. I think it was due to traceTc not being inlined, which I fixed in a more robust way by putting an export list on TcRnMonad. The k-nucleotide regression is more difficult. I don't think anything is actually going wrong, but this program has been highly tuned and is quite sensitive to changing in inlining behaviour. I managed to recover most of the performance by manual lambda-lifting which makes it a bit less fragile, but the end result was a bit slower. I don't think this is disastrous, the program is pretty horrible to begin with and we could probably make a faster one by starting from scratch. Test Plan: validate, nofib Reviewers: simonpj, bgamari, niteria, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2338 GHC Trac Issues: #11564
* Make checkFamInstConsistency less expensiveBartosz Nitka2016-06-211-17/+15
| | | | | | | | | | | | | | | | | | | | | | Doing canonicalization on every comparison turned out to be very expensive. Caching the canonicalization through the smart `modulePair` constructor gives `8%` reduction in allocations on `haddock.compiler` and `8.5%` reduction in allocations on `haddock.Cabal`. Possibly other things as well, but it's really visible in Haddock. Test Plan: ./validate Reviewers: jstolarek, simonpj, austin, simonmar, bgamari Reviewed By: simonpj, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2350 GHC Trac Issues: #12191
* Delete commented-out codeSimon Peyton Jones2016-06-211-30/+0
| | | | | | | | | Richard: in a previous commit I combined the two case for decideQuantification This commit just deletes the old code. I'm afraid it'll leave you with a merge conflict though, with your stuff on generalisation.
* Don't quantify over Refl in a RULESimon Peyton Jones2016-06-211-6/+29
| | | | | | | This fixes Trac #12212. It's quite hard to provoke, but I've added a standalone test case that does so. The issue is explained in Note [Evidence foralls] in Specialise.