summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Make mkFastStringByteString pure and fix up usesDuncan Coutts2014-08-293-10/+10
| | | | It's morally pure, and we'll need it in a pure context.
* Add a ghc -show-packages mode to display ghc's view of the package envDuncan Coutts2014-08-292-24/+44
| | | | | | | | | You can use ghc -show-packages, in addition to any -package -package-conf -hide-package, etc flags and see just what ghc's package info looks like. The format is much like ghc-pkg show. Like the existing verbose tracing, but a specific mode. Re-introduce pretty printed package info (Cabal handled this previously).
* Remove a TODO that is now doneDuncan Coutts2014-08-291-4/+0
|
* Fix long lines and trailing whitespaceDuncan Coutts2014-08-294-11/+20
| | | | in the previous patches in this series
* Drop ghc library dep on CabalDuncan Coutts2014-08-291-1/+0
|
* Use ghc-local types for packages, rather than Cabal typesDuncan Coutts2014-08-294-99/+126
| | | | | | | | Also start using the new package db file format properly, by using the ghc-specific section. This is the main patch in the series for removing the compiler's dep on the Cabal lib.
* Introduce new file format for the package database binary cacheDuncan Coutts2014-08-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of the new format is to make it possible for the compiler to not depend on the Cabal library. The new cache file format contains more or less the same information duplicated in two different sections using different representations. One section is basically the same as what the package db contains now, a list of packages using the types defined in the Cabal library. This section is read back by ghc-pkg, and used for things like ghc-pkg dump which have to produce output using the Cabal InstalledPackageInfo text representation. The other section is a ghc-local type which contains a subset of the information from the Cabal InstalledPackageInfo -- just the bits that the compiler cares about. The trick is that the compiler can read this second section without needing to know the representation (or types) of the first part. The ghc-pkg tool knows about both representations and writes both. This patch introduces the new cache file format but does not yet use it properly. More patches to follow. (As of this patch, the compiler reads the part intended for ghc-pkg so it still depends on Cabal and the ghc-local package type is not yet fully defined.)
* Drop support for single-file style package databasesDuncan Coutts2014-08-291-11/+7
| | | | | | | | | | | | | | | | Historically the package db format was a single text file in Read/Show format containing [InstalledPackageInfo]. For several years now the default format has been a directory with one file per package, plus a binary cache. The old format cannot be supported under the new scheme where the compiler will not depend on the Cabal library (because it will not have access to the InstalledPackageInfo type) so we must drop support. It would still technically be possible to support a single text file style db (but containing a different type), but there does not seem to be any compelling reason to do so. (Part of preparitory work for removing the compiler's dep on Cabal)
* Improve "specImport discarding" messageSimon Peyton Jones2014-08-291-1/+2
|
* Define mapUnionVarSet, and use itSimon Peyton Jones2014-08-2912-36/+39
| | | | Call sites are much easier to understand than before
* Improve trimming of auto-rulesSimon Peyton Jones2014-08-291-105/+151
| | | | | | | | | | | | | | I hadn't got the new function trimAutoRules quite right, so we had a left-over rule which mentioned a local variable whose binding had been discarded. (Result: crash when compiling Haddock.) This patch merges trimAutoRules into an expanded version of findExternalRules, gets it right, and adds lots of comments. See Note [Finding external rules]. And indeed in one regression test we get to trim off more rules (and hence code) than before.
* PprC: cleanup: don't emit 'FB_' / 'FE_' in via-CSergei Trofimovich2014-08-291-7/+0
| | | | | | | No need to emit (now empty) those special markers. Markers were needed only in registerised -fvia-C mode. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Temporary fix to the crashSimon Peyton Jones2014-08-281-2/+2
| | | | | | | | ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.9.20140828 for x86_64-unknown-linux): nameModule $w$smiddle_sfx6 make[1]: *** [utils/haddock/dist/build/Haddock/Backends/Xhtml.dyn_o] Error 1
* White space onlySimon Peyton Jones2014-08-281-22/+22
|
* Remove dead lookup_dfun_id (merge-o)Simon Peyton Jones2014-08-281-6/+0
|
* Simple refactor of the case-of-case transformSimon Peyton Jones2014-08-281-17/+11
| | | | More modular, less code. No change in behaviour.
* Run float-inwards immediately before the strictness analyser.Simon Peyton Jones2014-08-281-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Doing so pushes bindings nearer their use site and hence makes them more likely to be strict. These bindings might only show up after the inlining from simplification. Example in fulsom, Csg.calc, where an arg of timesDouble thereby becomes strict. Very few programs are affected, but it's basically good news. Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- fft -0.2% +1.3% 0.06 0.06 -10.0% fulsom -0.0% -2.6% -4.3% -4.7% -6.7% simple +0.0% -0.8% 0.0% 0.0% 0.0% -------------------------------------------------------------------------------- Min -0.5% -2.6% -4.5% -4.7% -10.0% Max +0.1% +1.3% +3.3% +3.4% +2.6% Geometric Mean -0.0% -0.0% -0.6% -0.6% -0.2% The lossage in fft is the loss of detecting a common sub-expression, and can be fixed by doing earlier CSE. But that is in any case a bit of a fluke so I don't mind losing it in exchange for this more reliable gain.
* Comments onlySimon Peyton Jones2014-08-283-10/+34
|
* Make tidyProgram discard speculative specialisation rulesSimon Peyton Jones2014-08-283-6/+77
| | | | | | | The new function TidyPgm.trimAutoRules discards bindings and rules that were useful, but now have served their purpose. See Note [Trimming auto rules] in TidyPgm
* Fix an egregious bug in the NonRec case of bindFreeVarsSimon Peyton Jones2014-08-281-1/+1
| | | | | | We were missing the free variables of rules etc. It's correct for Rec but wrong for NonRec. I'm not sure how this bug hasn't bitten us before, but it cropped up when I was doing trimAutoRules.
* Add -fspecialise-aggressivelySimon Peyton Jones2014-08-283-43/+121
| | | | | | | | | | This flag specialises any imported overloaded function that has an unfolding, whether or not it was marked INLINEABLE. We get a lot of orphan SPEC rules as a result, but that doesn't matter provided we don't treat orphan auto-generated rules as causing the module itself to be an orphan module. See Note [Orphans and auto-generated rules] in MkIface.
* Don't float out (classop dict e1 e2)Simon Peyton Jones2014-08-283-17/+30
| | | | | | | | | | | A class op applied to a dictionary doesn't do much work, so it's not a great idea to float it out (except possibly to the top level. See Note [Floating over-saturated applications] in SetLevels I also renamed "floatOutPartialApplications" to "floatOutOverSatApps"; the former is deeply confusing, since there is no partial application involved -- quite the reverse, it is *over* saturated.
* Make worker/wrapper work on INLINEABLE thingsSimon Peyton Jones2014-08-283-47/+119
| | | | | | | | | | | | | | | | This fixes a long-standing bug: Trac #6056. The trouble was that INLINEABLE "used up" the unfolding for the Id, so it couldn't be worker/wrapper'd by the strictness analyser. This patch allows the w/w to go ahead, and makes the *worker* INLINEABLE instead, so it can later be specialised. However, that doesn't completely solve the problem, because the dictionary argument (which the specialiser treats specially) may be strict and hence unpacked by w/w, so now the worker won't be specilialised after all. Solution: never unpack dictionary arguments, which is done by the isClassTyCon test in WwLib.deepSplitProductType_maybe
* Make maybeUnfoldingTemplate respond to DFunUnfoldingsSimon Peyton Jones2014-08-281-2/+9
| | | | | | CoreSyn.maybeUnfoldingTemplate is used mainly when specialising, so make DFunUnfoldings respond to it makes it possible to specialise them properly.
* Kill unused setUnfoldingTemplateSimon Peyton Jones2014-08-281-4/+1
|
* Refactor unfoldingsSimon Peyton Jones2014-08-289-212/+294
| | | | | | | | | | | | | | | | | | | | There are two main refactorings here 1. Move the uf_arity field out of CoreUnfolding into UnfWhen It's a lot tidier there. If I've got this right, no behaviour should change. 2. Define specUnfolding and use it in DsBinds and Specialise a) commons-up some shared code b) makes sure that Specialise correctly specialises DFun unfoldings (which it didn't before) The two got put together because both ended up interacting in the specialiser. They cause zero difference to nofib.
* Less voluminous output when printing continuationsSimon Peyton Jones2014-08-281-1/+1
|
* driver: pass '-fPIC' option to assembler as wellSergei Trofimovich2014-08-271-0/+44
| | | | | | | | | | | | | | | | | | | | | | | Summary: Before the patch '-fPIC' was passed only to C compiler, but not to assembler itself. It led to runtime crash in GHC_DYNAMIC_PROGRAMS=YES mode on sparc32. Technical details are in 'Note [-fPIC for assembler]'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: validate on sparc Reviewers: simonmar, austin, kgardas Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D177
* UNREG: fix emission of large Integer literals in C codegenSergei Trofimovich2014-08-261-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On amd64/UNREG build there is many failing tests trying to deal with 'Integer' types. Looking at 'integerConversions' test I've observed invalid C code generated by GHC. Cmm code CInt a = -1; (a == -1) yields 'False' with optimisations enabled via the following C code: StgWord64 a = (StgWord32)0xFFFFffffFFFFffffu; (a == 0xFFFFffffFFFFffffu) The patch fixes it by shrinking emitted literals to required sizes: StgWord64 a = (StgWord32)0xFFFFffffu; (a == 0xFFFFffffu) Thanks to Reid Barton for tracking down and fixing the issue. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: validate on UNREG build (amd64, x86) Reviewers: simonmar, rwbarton, austin Subscribers: hvr, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D173
* Two buglets in record wild-cards (Trac #9436 and #9437)Simon Peyton Jones2014-08-253-14/+29
| | | | | | | of named fields, whereas the code in RnPat.rnHsRecFields is much better set up to do so. Both easily fixed.
* Check for un-saturated type family applicationsSimon Peyton Jones2014-08-251-1/+4
| | | | | | | | | | | | | | | | | | | | This patch corrects an egregious error introduced by: commit 022f8750edf6f413fba31293435dcc62600eab77 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Thu May 15 16:07:04 2014 +0100 Refactoring around TyCon.isSynTyCon * Document isSynTyCon better * Add isTypeSyonymTyCon for regular H98 type synonyms * Use isTypeSynonymTyCon rather than isSynTyCon where the former is really intended At this particular spot in TcValidity we really do mean isSynTyCon and not isTypeSynonymTyCon. Fixes Trac #9433
* Make Core Lint check for un-saturated type applicationsSimon Peyton Jones2014-08-251-4/+11
| | | | | | | | | Un-saturated type-family and type-synonym applications are detected in the front end, but for some reason Lint wasn't looking for them. I came across this when wondering why Trac #9433 didn't give a Core Lint error
* More refactoring in SpecConstrSimon Peyton Jones2014-08-251-49/+73
| | | | | | | | | | | This patch should make no change in behaviour. * Make RhsInfo into a record * Include ri_rhs_usg, which previously travelled around separately * Introduce specRec, specNonRec, and make them return [OneSpec] rather than SpecInfo
* Do not duplicate call information in SpecConstr (Trac #8852)Simon Peyton Jones2014-08-251-23/+49
| | | | | | | | | | This long-standing and egregious bug meant that call information was being gratuitously copied, leading to an exponential blowup in the number of calls to be examined when function definitions are deeply nested. That is what has been causing the blowup in SpecConstr's running time, not (as I had previously supposed) generating very large code. See Note [spec_usg includes rhs_usg]
* Introduce the Call data typesSimon Peyton Jones2014-08-251-3/+16
| | | | | This is just a small refactoring that makes the code a bit clearer, using a data type instead of a triple. We get better pretty-printing too.
* Use DumpStyle rather than UserStyle for pprTrace outputSimon Peyton Jones2014-08-251-2/+2
| | | | | | | | The main motivation is that user-style output assumes that everything has been tidied, not enough uniques are printed by default. The downside is that pprTrace output now has module prefixes which can be overwhelming, but -dsuppress-module-prefixes will suppress them.
* Add MO_AddIntC, MO_SubIntC MachOps and implement in X86 backendReid Barton2014-08-239-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | Summary: These MachOps are used by addIntC# and subIntC#, which in turn are used in integer-gmp when adding or subtracting small Integers. The following benchmark shows a ~6% speedup after this commit on x86_64 (building GHC with BuildFlavour=perf). {-# LANGUAGE MagicHash #-} import GHC.Exts import Criterion.Main count :: Int -> Integer count (I# n#) = go n# 0 where go :: Int# -> Integer -> Integer go 0# acc = acc go n# acc = go (n# -# 1#) $! acc + 1 main = defaultMain [bgroup "count" [bench "100" $ whnf count 100]] Differential Revision: https://phabricator.haskell.org/D140
* Do not zero out version number when processing wired-in packages.Edward Z. Yang2014-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, GHC would look for instances of wired-in packages in the in-memory package database and null out the version number. This was necessary when the sourcePackageId was used to determine the linker symbols; however, we now use a package key, so only that needs to be updated. Long-term, we can remove this hack by ensuring that Cabal actually records the proper package key in the database. This will also fix an unrelated hack elsewhere. Keeping version numbers means that wired in packages get rendered differently when output by GHC. This is the source of all the test-case output changes. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: hvr, austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D170
* basicTypes: detabify/dewhitespace IdInfoAustin Seipp2014-08-201-155/+148
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* basicTypes: detabify/dewhitespace NameEnvAustin Seipp2014-08-201-46/+38
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* basicTypes: detabify/dewhitespace NameSetAustin Seipp2014-08-201-67/+60
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* basicTypes: detabify/dewhitespace VarAustin Seipp2014-08-201-101/+94
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* hsSyn: detabify/dewhitespace HsLitAustin Seipp2014-08-201-60/+52
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* stranal: detabify/dewhitespace DmdAnalAustin Seipp2014-08-201-302/+301
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* deSugar: detabify/dewhitespace DsCCallAustin Seipp2014-08-201-107/+100
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* coreSyn: detabify/dewhitespace CoreSubstAustin Seipp2014-08-201-219/+212
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* coreSyn: detabify/dewhitespace CoreTidyAustin Seipp2014-08-201-75/+68
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* prelude: detabify/dewhitespace TysPrimAustin Seipp2014-08-201-188/+181
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* simplCore: detabify/dewhitespace LiberateCaseAustin Seipp2014-08-201-128/+120
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* simplCore: detabify/dewhitespace SetLevelsAustin Seipp2014-08-201-272/+264
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>