summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Do not init record accessors as exportedÖmer Sinan Ağacan2016-05-273-2/+17
| | | | | | | | | | | | | | | | This was causing redundant code generation when accessors are not actually exported, as they were being marked as "exported" at initialization. Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2270
* StgCmmExpr: Remove a redundant listÖmer Sinan Ağacan2016-05-271-1/+1
|
* Comments and white space onlySimon Peyton Jones2016-05-271-3/+5
|
* More fixes for unboxed tuplesSimon Peyton Jones2016-05-272-21/+76
| | | | | | | | | | | | | | | | | | This is a continuation of commit e9e61f18a548b70693f4ccd245bc56335c94b498 Date: Thu May 26 15:24:53 2016 +0100 Reduce special-casing for nullary unboxed tuple which related to Trac #12115. But typecheck/should_run/tcrun051 revealed that my patch was incomplete. This fixes it, by removing another special case in Type.repType. I had also missed a case in UnariseStg.unariseIdBinder. I took the opportunity to add explanatory notes Note [Unarisation] Note [Unarisation and nullary tuples] in UnariseStg
* StgCmmCon: Do not generate moves from unused fields to local variablesÖmer Sinan Ağacan2016-05-271-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Say we have a record like this: data Rec = Rec { f1 :: Int , f2 :: Int , f3 :: Int , f4 :: Int , f5 :: Int } Before this patch, the code generated for `f1` looked like this: f1_entry() {offset ... cJT: _sI6::P64 = R1; _sI7::P64 = P64[_sI6::P64 + 7]; _sI8::P64 = P64[_sI6::P64 + 15]; _sI9::P64 = P64[_sI6::P64 + 23]; _sIa::P64 = P64[_sI6::P64 + 31]; _sIb::P64 = P64[_sI6::P64 + 39]; R1 = _sI7::P64 & (-8); Sp = Sp + 8; call (I64[R1])(R1) args: 8, res: 0, upd: 8; } Note how all fields of the record are moved to local variables, even though they're never used. These moves make it to the final assembly: f1_info: ... _cJT: movq 7(%rbx),%rax movq 15(%rbx),%rcx movq 23(%rbx),%rcx movq 31(%rbx),%rcx movq 39(%rbx),%rbx movq %rax,%rbx andq $-8,%rbx addq $8,%rbp jmp *(%rbx) With this patch we stop generating these move instructions. Cmm becomes this: f1_entry() {offset ... cJT: _sI6::P64 = R1; _sI7::P64 = P64[_sI6::P64 + 7]; R1 = _sI7::P64 & (-8); Sp = Sp + 8; call (I64[R1])(R1) args: 8, res: 0, upd: 8; } Assembly becomes this: f1_info: ... _cJT: movq 7(%rbx),%rax movq %rax,%rbx andq $-8,%rbx addq $8,%rbp jmp *(%rbx) It turns out CmmSink already optimizes this, but it's better to generate better code in the first place. Reviewers: simonmar, simonpj, austin, bgamari Reviewed By: simonmar, simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2269
* Coverage.hs: Fix a duplicationÖmer Sinan Ağacan2016-05-261-5/+2
|
* StgCmmExpr: Fix a duplicationÖmer Sinan Ağacan2016-05-261-2/+2
|
* Reduce special-casing for nullary unboxed tupleSimon Peyton Jones2016-05-264-131/+143
| | | | | | | | | | | | | | | When we built the kind of a nullary unboxed tuple, we said, in TysWiredIn.mk_tuple: res_rep | arity == 0 = voidRepDataConTy -- See Note [Nullary unboxed tuple] in Type | otherwise = unboxedTupleRepDataConTy But this is bogus. The Note deals with what the 'unarise' transformation does, and up to that point it's simpler and more uniform to treat nullary unboxed tuples the same as all the others. Nicer now. And it fixes the Lint error in Trac #12115
* Fix bytecode gen to deal with rep-polymorphismSimon Peyton Jones2016-05-261-12/+25
| | | | | | | | | When faced runtime-rep-polymorphic code from a pattern-synonym matcher, the bytecode generator was treating the result as lifted, which it isn't. The fix is just to treat those rep-polymorphic continuations like unlifted types, and add a dummy arg. Trac #12007 is a case in point.
* Spelling in commentsGabor Greif2016-05-253-3/+3
|
* Fix: #12084 deprecate old profiling flagsSeraphime Kirkovski2016-05-242-14/+22
| | | | | | | | | | | | | | | | | | | | Change help message so it doesn't specify -auto-all. Make old profiling flags deprecated as they are no longer documented. Update Makefile and documentation accordingly. Update release notes for ghc 8.2 Test Plan: ./verify; `ghc --help` shouldn't specify the -auto-all flag. Furthermore `ghc -fprof -auto-all` should emit a warning Reviewed By: thomie, austin Differential Revision: https://phabricator.haskell.org/D2257 GHC Trac Issues: #12084 Update submodule nofib
* Remove 'deriving Typeable' statementsRyan Scott2016-05-2442-219/+129
| | | | | | | | | | | | | | | | | Summary: Deriving `Typeable` has been a no-op since GHC 7.10, and now that we require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable` statements in GHC. Test Plan: ./validate Reviewers: goldfire, austin, hvr, bgamari Reviewed By: austin, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2260
* Make Arrow desugaring deterministicBartosz Nitka2016-05-243-32/+71
| | | | | | | | | | | | | | | | | | | This kills two instances of varSetElems that turned out to be nondeterministic. I've tried to untangle this before, but it's a bit hard with the fixDs in the middle. Fortunately I now have a test case that proves that we need determinism here. Test Plan: ./validate, new testcase Reviewers: simonpj, simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2258 GHC Trac Issues: #4012
* Document some benign nondeterminismBartosz Nitka2016-05-2419-71/+93
| | | | | | | | | | | | | | | | | | I've changed the functions to their nonDet equivalents and explained why they're OK there. This allowed me to remove foldNameSet, foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly. Test Plan: ./validate, there should be no change in behavior Reviewers: simonpj, simonmar, austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2244 GHC Trac Issues: #4012
* Add support for unicode TH quotes (#11743)Josh Price2016-05-242-29/+45
| | | | | | | | | | | | | | | | | | | I've also added cases for `IToparenbar` and `ITcparenbar` (aka banana brackets) to `isUnicode`. Document unicode TH quote alternatives (#11743) Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2185 GHC Trac Issues: #11743
* SpellingGabor Greif2016-05-241-1/+1
|
* Comments onlySimon Peyton Jones2016-05-241-1/+2
|
* Remove unused Type.splitFunTysNSimon Peyton Jones2016-05-241-10/+1
|
* Spelling in commentSimon Peyton Jones2016-05-241-1/+1
|
* Don't split the arg types in a PatSyn signatureSimon Peyton Jones2016-05-244-100/+127
| | | | | | | | | | | | | | | | | This patch fixes Trac #11977, and #12108, rather satisfactorily maily by deleting code! pattern P :: Eq a => a -> a -> Int The idea is simply /not/ to split the bit after the '=>' into the pattern argument types, but to keep the (a->a->Int) part un-decomposed, in the patsig_body_ty field of a TcPatSynInfo. There is one awkward wrinkle, which is that we can't split the implicitly-bound type variables into existential and universal until we know which types are arguments and which are part of the result. So we postpone the decision until we have the declaration in hand. See TcPatSyn Note [The pattern-synonym signature splitting rule]
* Revert "compiler/iface: compress .hi files"Ben Gamari2016-05-236-2031/+19
| | | | | | | | | | | | | | | | | | | | | This appears to cause validation issues on, TEST="T11108 T9071 T11076 T7600 T7672 T8329 T10420 T10322 T8308 T4114a T4114c T10602 T10110 T9204 T2435 T9838 T4114d T10233 T8696 T1735 T5281 T6056 T10134 T9580 T6018 T9762 T8103" With compiler panics of the form, Compile failed (status 256) errors were: ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160523 for x86_64-unknown-linux): Binary.readBinMem: decompression failed CallStack (from HasCallStack): error, called at compiler/utils/Binary.hs:192:16 in ghc:Binary Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug This reverts commit d9cb7a8a94daa4d20aa042cd053e20b491315633.
* Fix build by removing unused import.Matthew Pickering2016-05-231-1/+1
|
* Allow unlifted types in pattern synonym result typeMatthew Pickering2016-05-231-1/+3
| | | | | | | | | | | | | | Fixes #12094 Test Plan: ./validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2255 GHC Trac Issues: #12094
* Use `setSession` instead of `modifySession` when setting `HscEnv`Ömer Sinan Ağacan2016-05-223-10/+10
| | | | | | | | | | Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2253
* Fix deriving Ord when RebindableSyntax is enabledAndrew Farmer2016-05-212-5/+12
| | | | | | | | | | | | | | | | | | | | | | | Deriving clauses (Ord especially) generated if-expressions with nlHsIf which were subject to RebindableSyntax. This changes nlHsIf to generate concrete if-expressions. There was also an error about calling tagToEnum# at a polymorphic type, which is not allowed. Fixing nlHsIf didn't fix this for some reason, so I generated a type ascription around the call to tagToEnum#. Not sure why the typechecker could not figure this out. Test Plan: Added a test, ran validate. Reviewers: simonpj, simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2247 GHC Trac Issues: #12080
* compiler/iface: compress .hi filesAustin Seipp2016-05-216-19/+2031
| | | | | | | | | | | | | | | | | | | Compress all interface files generated by the compiler with LZ4. While being only a tiny amount of code, LZ4 is both fast at compression and decompression, and has good compression ratios. Non-scientific size test: size of stage2 compiler .hi files: `find ./compiler/stage2 -type f -iname '*.hi' -exec du -ch {} + | grep total$` Without this patch: 22MB of .hi files for stage2. With this patch: 9.2MB of .hi files for stage2. Signed-off-by: Austin Seipp <austin@well-typed.com> Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1159
* FunDep printer: Fix unicode arrowÖmer Sinan Ağacan2016-05-201-1/+1
| | | | | | | | | | | | | | | The arrow should be printed in unicode arrow syntax when -fprint-unicode-syntax is used. Reviewers: austin, bgamari, thomie Reviewed By: thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2243 GHC Trac Issues: #11825
* Give lifted primitive types a representationBen Gamari2016-05-191-1/+2
| | | | | | | | | | | | | | | | As of D1774 everything in GHC.Prim has a representation generated for it by TcTypeable (see #11120). Unfortunately I evidently missed propagating this change to lifted primitive types. This patch fixes this (#12082). Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2240 GHC Trac Issues: #12082
* Comments onlySimon Peyton Jones2016-05-191-0/+1
|
* Comments onlySimon Peyton Jones2016-05-191-0/+3
|
* Improve pretty-printing of equalitiesSimon Peyton Jones2016-05-191-57/+50
| | | | | The previous pretty-printer didn't account for partially applied equalities, causing Trac #12041
* Fix Trac #12051Simon Peyton Jones2016-05-192-37/+51
| | | | | A minor parser issue, allowing a mal-formed data constructor through.
* Kill varEnvElts in tcPragExprBartosz Nitka2016-05-185-19/+29
| | | | | | | | | | | | | | | | | I had to refactor some things to take VarSet instead of [Var], but I think it's more precise this way. Test Plan: ./validate Reviewers: simonmar, simonpj, austin, bgamari, goldfire Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2227 GHC Trac Issues: #4012
* Kill varSetElems in tidyFreeTyCoVarsBartosz Nitka2016-05-184-13/+13
| | | | | | | | | | | | | | | | | | | | I haven't observed this to have an effect on nondeterminism, but tidyOccName appears to modify the TidyOccEnv in a way dependent on the order of inputs. It's easy enough to change it to be deterministic to be on the safe side. Test Plan: ./validate Reviewers: simonmar, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2238 GHC Trac Issues: #4012
* CLabel: Catch #11155 during C-- pretty-printingBen Gamari2016-05-181-4/+17
| | | | | | | | | | | | | | | | | | | | | In #11555 we ended up generating references to the non-existence stg_ap_0_upd. Here we add asserts to verify that we don't generate references to non-existent selector or application symbols. It would likely also make sense to add further asserts during code generation, so we can catch the issue even closer to its source. Test Plan: Validate Reviewers: simonmar, austin, ezyang Reviewed By: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2230 GHC Trac Issues: #11155
* rts: Add isPinnedByteArray# primopBen Gamari2016-05-181-0/+5
| | | | | | | | | | | | | | | | | Adds a primitive operation to determine whether a particular `MutableByteArray#` is backed by a pinned buffer. Test Plan: Validate with included testcase Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2217 GHC Trac Issues: #12059
* Rework parser to allow use with DynFlagsDave Laing2016-05-1810-119/+222
| | | | | | | | | | | | | | | | | Split out the options needed by the parser from DynFlags, making the parser more friendly to standalone usage. Test Plan: validate Reviewers: simonmar, alanz, bgamari, austin, thomie Reviewed By: simonmar, alanz, bgamari, thomie Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2208 GHC Trac Issues: #10961
* Fix histograms for ticky codeMateusz Lenik2016-05-182-27/+12
| | | | | | | | | | | | | | | | | | | | This patch fixes Cmm generation required to produce histograms when compiling with -ticky flag, strips dead code from rts/Ticky.c and reworks it to use a shared constant in both C and Haskell code. Fixes #8308. Test Plan: T8308 Reviewers: jstolarek, simonpj, austin Reviewed By: simonpj Subscribers: mpickering, simonpj, bgamari, mlen, thomie, jstolarek Differential Revision: https://phabricator.haskell.org/D931 GHC Trac Issues: #8308
* Make inert_model and inert_eqs deterministic setsBartosz Nitka2016-05-185-36/+78
| | | | | | | | | | | | | | | | | | | | The order inert_model and intert_eqs fold affects the order that the typechecker looks at things. I've been able to experimentally confirm that the order of equalities and the order of the model matter for determinism. This is just a straigthforward replacement of nondeterministic VarEnv for deterministic DVarEnv. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2232 GHC Trac Issues: #4012
* Document determinism in shortOutIndirectionsBartosz Nitka2016-05-171-1/+5
| | | | | | | | | | | | | | | | | varEnvElts didn't introduce nondeterminism here. This makes it obvious that it could and explains why it doesn't. Test Plan: ./validate Reviewers: bgamari, simonmar, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2228 GHC Trac Issues: #4012
* Kill varSetElems in tcInferPatSynDeclBartosz Nitka2016-05-161-16/+26
| | | | | | | | | | | | | | | | | | | varSetElems introduces unnecessary non-determinism and while I didn't estabilish experimentally that this matters here I'm convinced that it will, because I expect pattern synonyms to end up in interface files. Test Plan: ./validate Reviewers: austin, simonmar, bgamari, mpickering, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2206 GHC Trac Issues: #4012
* Move Extension type to ghc-boot-thBen Gamari2016-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | This creates a new package, `ghc-boot-th`, to contain the `Extension` type, which now lives in `GHC.LanguageExtension.Type`. This ensures that the transitive dependency set of the `template-haskell` package remains minimal. The `GHC.LanguageExtensions.Type` module is also re-exported by `ghc-boot`, which provides an orphan `binary` instance as well. Test Plan: Validate Reviewers: goldfire, thomie, hvr, austin Reviewed By: thomie Subscribers: RyanGlScott, thomie, erikd, ezyang Differential Revision: https://phabricator.haskell.org/D2224
* PPC NCG: Fix pretty printing of st[wd]ux instr.Peter Trommler2016-05-161-1/+2
| | | | | | | | | | | | | | | | | Printing STU was mixed up. The tab character must appear after the 'x'. Test Plan: validate on powerpc Reviewers: bgamari, austin, erikd Reviewed By: austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2214 GHC Trac Issues: #12054
* Fix a performance issue with -fprint-expanded-synonymsÖmer Sinan Ağacan2016-05-151-79/+117
| | | | | | | | | | | | | | | | | | | | | | | | The type synonym expander was doing redundant work by looking at same types again and again. This patch fixes the loop code when both of the types can be expanded, to do `O(min(n, m))` comparisons and `O(n + m)` expansions, where `n` is expansions of the first type and `m` is expansions of the second type. Reported by sjcjoosten in T10547. Test Plan: Added a regression test that was taking several minutes to type check before this patch. Reviewers: bgamari, simonpj, austin, ezyang Reviewed By: bgamari, simonpj, austin, ezyang Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2198 GHC Trac Issues: #10547
* Refactor some ppr functions to use pprUFMBartosz Nitka2016-05-1212-20/+27
| | | | | | | | | | | | | | | | | Nondeterminism doesn't matter in these places and pprUFM makes it obvious. I've flipped the order of arguments for convenience. Test Plan: ./validate Reviewers: simonmar, bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2205 GHC Trac Issues: #4012
* Kill varEnvElts in specImportsBartosz Nitka2016-05-123-12/+73
| | | | | | | | | | | | | | | | | We need the order of specialized binds and rules to be deterministic, so we use a deterministic set here. Test Plan: ./validate Reviewers: simonmar, bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2197 GHC Trac Issues: #4012
* Document zonkTyCoVarsAndFV determinismBartosz Nitka2016-05-121-1/+6
| | | | | | | | | | | | | | | | | I've changed it to use nonDetEltsUFM and documented why it's OK. Test Plan: it builds Reviewers: bgamari, austin, simonmar, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2204 GHC Trac Issues: #4012
* Allow putting Haddocks on derived instancesRyan Scott2016-05-121-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | Currently, one can document top-level instance declarations, but derived instances (both those in `deriving` clauses and standalone `deriving` instances) do not enjoy the same privilege. This makes the necessary changes to the parser to enable attaching Haddock comments for derived instances. Updates haddock submodule. Fixes #11768. Test Plan: ./validate Reviewers: hvr, bgamari, austin Reviewed By: austin Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2175 GHC Trac Issues: #11768
* Make Generic1 poly-kindedRyanGlScott2016-05-122-67/+137
| | | | | | | | | | | | | | | | | | | | | | | This generalizes the `Generic1` typeclass to be of kind `k -> *`, and this also makes the relevant datatypes and typeclasses in `GHC.Generics` poly-kinded. If `PolyKinds` is enabled, `DeriveGeneric` derives `Generic1` instances such that they use the most general kind possible. Otherwise, deriving `Generic1` defaults to make an instance where the argument is of kind `* -> *` (the current behavior). Fixes #10604. Depends on D2117. Test Plan: ./validate Reviewers: kosmikus, dreixel, goldfire, austin, hvr, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie, ekmett Differential Revision: https://phabricator.haskell.org/D2168 GHC Trac Issues: #10604
* Fix deriveTyData's kind unification when two kind variables are unifiedRyanGlScott2016-05-123-7/+67
| | | | | | | | | | | | | | | | | | | | | | | | | When `deriveTyData` attempts to unify two kind variables (which can happen if both the typeclass and the datatype are poly-kinded), it mistakenly adds an extra mapping to its substitution which causes the unification to fail when applying the substitution. This can be prevented by checking both the domain and the range of the original substitution to see which kind variables shouldn't be put into the domain of the substitution. A more in-depth explanation is included in `Note [Unification of two kind variables in deriving]`. Fixes #11837. Test Plan: ./validate Reviewers: simonpj, hvr, goldfire, niteria, austin, bgamari Reviewed By: bgamari Subscribers: niteria, thomie Differential Revision: https://phabricator.haskell.org/D2117 GHC Trac Issues: #11837