summaryrefslogtreecommitdiff
path: root/compiler/utils
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-work the naming story for the GHCi prompt (Trac #8649)Simon Peyton Jones2014-01-091-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic idea here is simple, and described in Note [The interactive package] in HscTypes, which starts thus: Note [The interactive package] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Type and class declarations at the command prompt are treated as if they were defined in modules interactive:Ghci1 interactive:Ghci2 ...etc... with each bunch of declarations using a new module, all sharing a common package 'interactive' (see Module.interactivePackageId, and PrelNames.mkInteractiveModule). This scheme deals well with shadowing. For example: ghci> data T = A ghci> data T = B ghci> :i A data Ghci1.T = A -- Defined at <interactive>:2:10 Here we must display info about constructor A, but its type T has been shadowed by the second declaration. But it has a respectable qualified name (Ghci1.T), and its source location says where it was defined. So the main invariant continues to hold, that in any session an original name M.T only refers to oe unique thing. (In a previous iteration both the T's above were called :Interactive.T, albeit with different uniques, which gave rise to all sorts of trouble.) This scheme deals nicely with the original problem. It allows us to eliminate a couple of grotseque hacks - Note [Outputable Orig RdrName] in HscTypes - Note [interactive name cache] in IfaceEnv (both these comments have gone, because the hacks they describe are no longer necessary). I was also able to simplify Outputable.QueryQualifyName, so that it takes a Module/OccName as args rather than a Name. However, matters are never simple, and this change took me an unreasonably long time to get right. There are some details in Note [The interactive package] in HscTypes.
* Clarify the default demand on demand environmentsJoachim Breitner2013-12-161-0/+28
| | | | by adding Notes and using easier to understand combinators.
* Mask async exceptions in forkM_Edsko de Vries2013-12-031-1/+3
| | | | See #8006 for the reason why. This is not a fix as such; more of a workaround.
* Remove unnecessary and deprecated inclusions of Typeable.hPatrick Palka2013-11-121-2/+0
| | | | | The build system would've complained loudly about these inclusions if it weren't for #8527.
* Remove old workaround for containers <= 0.3Patrick Palka2013-11-121-4/+0
|
* Placate clang (#8444, #8445)Austin Seipp2013-10-251-2/+2
| | | | | | | | Once again the whitespace rules (and the rules concerning expansion of tokens) have bitten us. Authored-by: Authored-by: Luke Iannini <lukexi@me.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Added comments to BooleanFormula to explain the expression simplifier. (#7633)Twan van Laarhoven2013-10-151-3/+47
|
* TyposKrzysztof Gogolewski2013-10-121-1/+1
|
* Globally replace "hackage.haskell.org" with "ghc.haskell.org"Simon Marlow2013-10-015-5/+5
|
* Discard unreachable code in the register allocator (#7574)Simon Marlow2013-09-231-5/+25
| | | | | | | | | | | | | | | | | | | The problem with unreachable code is that it might refer to undefined registers. This happens accidentally: a block can be orphaned by an optimisation, for example when the result of a comparsion becomes known. The register allocator panics when it finds an undefined register, because they shouldn't occur in generated code. So we need to also discard unreachable code to prevent this panic being triggered by optimisations. The register alloator already does a strongly-connected component analysis, so it ought to be easy to make it discard unreachable code as part of that traversal. It turns out that we need a different variant of the scc algorithm to do that (see Digraph), however the new variant also generates slightly better code by putting the blocks within a loop in a better order for register allocation.
* Comments onlyJan Stolarek2013-09-191-0/+1
|
* Restore old names of comparison primopsJan Stolarek2013-09-185-8/+299
| | | | | | | | | | | | In 6579a6c we removed existing comparison primops and introduced new ones returning Int# instead of Bool. This commit (and associated commits in array, base, dph, ghc-prim, integer-gmp, integer-simple, primitive, testsuite and template-haskell) restores old names of primops. This allows us to keep our API cleaner at the price of not having backwards compatibility. This patch also temporalily disables fix for #8317 (optimization of tagToEnum# at Core level). We need to fix #8326 first, otherwise our primops code will be very slow.
* Trailing whitespacesJan Stolarek2013-09-183-11/+11
|
* Implement checkable "minimal complete definitions" (#7633)Twan van Laarhoven2013-09-181-0/+167
| | | | | | | | | | | | | | This commit adds a `{-# MINIMAL #-}` pragma, which defines the possible minimal complete definitions for a class. The body of the pragma is a boolean formula of names. The old warning for missing methods is replaced with this new one. Note: The interface file format is changed to store the minimal complete definition. Authored-by: Twan van Laarhoven <twanvl@gmail.com> Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Outputable.isOrAre: "is" or "are" for correct grammarJoachim Breitner2013-09-131-1/+10
|
* Fix AMP warnings.Austin Seipp2013-09-111-1/+6
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Merge remote-tracking branch 'origin/master' into ghc-parmake-gsocghc-parmake-gsocPatrick Palka2013-09-081-0/+1
|\
| * Add basic support for GHCJSAustin Seipp2013-09-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch encompasses most of the basic infrastructure for GHCJS. It includes: * A new extension, -XJavaScriptFFI * A new architecture, ArchJavaScript * Parser and lexer support for 'foreign import javascript', only available under -XJavaScriptFFI, using ArchJavaScript. * As a knock-on, there is also a new 'WayCustom' constructor in DynFlags, so clients of the GHC API can add custom 'tags' to their built files. This should be useful for other users as well. The remaining changes are really just the resulting fallout, making sure all the cases are handled appropriately for DynFlags and Platform. Authored-by: Luite Stegeman <stegeman@gmail.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
| * Fix off-by-one error in FastString.getFastStringTable (#8110)Patrick Palka2013-08-301-1/+1
| | | | | | | | | | The function was reading past the end of the FastString table, causing the -dfaststring-stats option to behave unpredictably.
* | Binary: eradicate BinIO handlesPatrick Palka2013-08-261-44/+0
| | | | | | | | They are not used anywhere in the compiler.
* | Binary: Make lazyGet more thread-safePatrick Palka2013-08-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All values read lazily from the same BinHandle share the same mutable offset variable (_off_r). If two such lazy values are simultaneously evaluated, the two threads will step over each other when writing to _off_r. Fortunately, for BinMem handles, making lazyGet thread-safe is simple: just use a fresh off_r variable when deferring the call to getAt. For BinIO handles, a race condition still exists because IO handles contain their own mutable file pointer variable that gets clobbered in a similar way that _off_r would. But GHC doesn't use BinIO handles anywhere so this particular issue could be ignored for now.
* | FastString: make the string table thread-safePatrick Palka2013-08-261-86/+102
|/ | | | | While we're at it, consolidate duplicate code into a helper function and strictify a few arguments.
* Fix validation failure in Fingerprint.hscAustin Seipp2013-08-231-1/+1
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Fingerprint.getFileHash: Fix not reading file at all.Niklas Hambüchen2013-08-231-1/+8
| | | | | | This lead to the stage1 compiler calculating random iface hashes. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Fingerprint: Fix comment typoNiklas Hambüchen2013-08-231-1/+1
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Remove trailing whitespace from Fingerprint.hscAustin Seipp2013-08-221-1/+1
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Fix -Werror failure in Fingerprint.hscAustin Seipp2013-08-221-0/+3
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Fix interface hashes including time stamp of dependent files.Niklas Hambüchen2013-08-221-2/+29
| | | | | | | | | | | | | | | | | | | | | | | Fixes #8144. Before, the modification time of e.g. #included files (and everything that ends up as a UsageFile, e.g. via addDependentFile) was taken as input for the interface hash of a module. This lead to different hashes for identical inputs on every compilation. We now use file content hashes instead. This changes the interface file format. You will get "Binary.get(Usage): 50" when you try to do an incremental using .hi files that were created with a GHC 7.7 (only) older than this commit. To calculate the md5 hash (`Fingerprint`) of a file in constant space, there now is GHC.Fingerprint.getFileHash, and a fallback version for older GHCs that needs to load the file into memory completely (only used when compiling stage1 with an older GHC). Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Add a better implementation of dropTail, and use itSimon Peyton Jones2013-08-191-1/+9
|
* Implement "roles" into GHC.Richard Eisenberg2013-08-023-2/+15
| | | | | | | | | | | | | | | | Roles are a solution to the GeneralizedNewtypeDeriving type-safety problem. Roles were first described in the "Generative type abstraction" paper, by Stephanie Weirich, Dimitrios Vytiniotis, Simon PJ, and Steve Zdancewic. The implementation is a little different than that paper. For a quick primer, check out Note [Roles] in Coercion. Also see http://ghc.haskell.org/trac/ghc/wiki/Roles and http://ghc.haskell.org/trac/ghc/wiki/RolesImplementation For a more formal treatment, check out docs/core-spec/core-spec.pdf. This fixes Trac #1496, #4846, #7148.
* Add NegativeLiterals extensionIan Lynagh2013-07-311-1/+1
| | | | | | | | | | | I'd been meaning to do this for some time, but finally got around to it due to the overflowing literals warning. With that enabled, we were getting a warning for -128 :: Int8 as that is parsed as negate (fromInteger 128) which just happens to do the right thing, as negate (fromInteger 128) = negate (-128) = -128
* De-orphan a load of Binary instancesIan Lynagh2013-07-271-0/+141
|
* adding FastString.string_table to the sharedCAF/Globals.c mechanismNicolas Frisby2013-07-161-7/+60
|
* This reverts commit 163de25813d12764aa5ded1666af7c06fee0d67e and commit ↵Nicolas Frisby2013-07-161-25/+2
| | | | 279ac9f66a83203448b279ea478b2cc1dafbd35d.
* copy the plugin's FastStringTable changes back into the host compilerNicolas Frisby2013-07-041-2/+12
|
* include FastString.string_table in CoreMonad.reinitializeGlobalsNicolas Frisby2013-07-031-1/+14
|
* Use SDoc for all LLVM pretty-printingPeter Wortmann2013-06-271-0/+7
| | | | | | | This patch reworks some parts of the LLVM pretty-printing code that were still using Show and String. Now we should be using SDoc and Outputable throughout. Note that many get*Name functions become pp*Name here as a side-effect.
* Make sure that Pretty.text is inlined in stage 0,Simon Peyton Jones2013-06-242-1/+6
| | | | | | | | | | so that RULE text/str gets a chance to fire (Trac #7995). And make sure that Outputable.text is inlined, so that the underlying Pretty.text rule can fire. The thing is that literal strings only turn into unpackCString# in phase 1.
* Define chkAppend, and use itSimon Peyton Jones2013-05-301-1/+8
| | | | | | Somtimes we need (xs ++ ys) in situations where ys is almost always empty. Utils.chkAppend checks for that case first.
* Simplify kind generalisation, and fix Trac #7916Simon Peyton Jones2013-05-211-0/+3
| | | | | | | | | | | | | | | | | | | A buglet that exposed an opportunity for some welcome refactoring and simplification. Main changes * TcMType.zonkQuantifiedTyVars is replaced by quantifyTyVars, which does a bit more zonking (so that its clients do not need to) * TcHsType.kindGeneralise becomes a bit simpler, and hands off to quantifyTyVars * A bit of simplification of the hacky code in TcTyClsDcls.tcConDecl, where we figure out how to generalise the data constructor's type * Improve the error message from badExistential when a constructor has an existential type, by printing the offending type * Some consequential simplification in simplifyInfer.
* Don't use getPackageLinkOpts on iOS; fixes #7720.Ian Lynagh2013-04-271-0/+8
| | | | | On iOS, binaries are really static libraries, so we don't want to use flags like -lm when linking them.
* Remove some __HADDOCK__ CPPIan Lynagh2013-04-091-2/+0
| | | | I think these are all redundant, now that haddock uses the GHC API
* Detab modules with tabs on 5 lines or fewerIan Lynagh2013-04-064-38/+9
|
* Fix typosGabor Greif2013-04-061-2/+2
|
* Fix stage2 build on ARM.Austin Seipp2013-03-181-0/+4
| | | | | | LLVM supports PIC on ARM from what I can see. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Set the way to 'dynamic' when running GHCi if GHCi is dynamically linkedIan Lynagh2013-03-151-0/+1
|
* By default, use the dynamic way for programs in the GHC treeIan Lynagh2013-03-151-8/+1
| | | | | In particular, this means that GHCi will use DLLs, rather than loading object files itself.
* Remove some commented out SPECIALIZE pragmasIan Lynagh2013-03-101-20/+0
| | | | As far as I can see, they've never been enabled
* Fix pretty printing of human-readable integers (#7750)Patrick Palka2013-03-091-1/+4
|
* Add OSiOS, and define and use platformUsesFrameworks; part of #7720Ian Lynagh2013-03-021-1/+12
|