summaryrefslogtreecommitdiff
path: root/ghc
Commit message (Collapse)AuthorAgeFilesLines
* Disable -XRebindableSyntax when running internal GHCi expressionsRyan Scott2017-10-191-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It's well known that `-XRebindableSyntax` doesn't play nicely with some of the internal expressions that GHCi runs. #13385 was one example where this problem arose, which was fixed at the time by simply avoiding the use of `do`-notation in these internal GHCi expressions. That seemed to work, but it was a technique that proved not to scale, as #14342 demonstrated //another// example where `-XRebindableSyntax` can bite. Instead of delicately arranging the internal GHCi expressions to avoid anything that might be covered under `-XRebindableSyntax`, this patch takes the much more direct approach of disabling `-XRebindableSyntax` entirely when running any internal GHCi expression. This shouldn't hurt, since nothing internal to GHCi was taking advantage of the extension in the first place, and moreover, we can have greater confidence that some other obscure `-XRebindableSyntax` corner case won't pop up in the future. As an added bonus, this lets us once again use `do`-notation in the code that had to be changed when #13385 was (hackily) fixed before. Test Plan: make test TEST=T14342 Reviewers: bgamari, austin Subscribers: rwbarton, thomie GHC Trac Issues: #14342 Differential Revision: https://phabricator.haskell.org/D4086
* Reexport Semigroup's <> operator from Prelude (#14191)Herbert Valerio Riedel2017-09-224-2/+4
| | | | | | | This completes the 2nd phase of the Semigroup=>Monoid Proposal (SMP) initiated in 8ae263ceb3566a7c82336400b09cb8f381217405. This updates a couple submodules to address <> naming clashes.
* Canonicalise MonoidFail instances in GHCHerbert Valerio Riedel2017-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | IOW, code compiles -Wnoncanonical-monoidfail-instances clean now This is easy now since we require GHC 8.0/base-4.9 or later for bootstrapping. Note that we can easily enable `MonadFail` via default-extensions: MonadFailDesugaring in compiler/ghc.cabal.in which currently would point out that NatM doesn't have a proper `fail` method, even though failable patterns are made use of: compiler/nativeGen/SPARC/CodeGen.hs:425:25: error: * No instance for (Control.Monad.Fail.MonadFail NatM) arising from a do statement with the failable pattern ‘(dyn_c, [dyn_r])’
* Canonicalise Monoid instances in GHCHerbert Valerio Riedel2017-09-091-0/+3
| | | | IOW, code compiles -Wnoncanonical-monoid-instances clean now
* Clean up opt and llcMoritz Angermann2017-09-062-2/+7
| | | | | | | | | | | | | | | | | | | | | The LLVM backend shells out to LLVMs `opt` and `llc` tools. This clean up introduces a shared data structure to carry the arguments we pass to each tool so that corresponding flags are next to each other. It drops the hard coded data layouts in favor of using `-mtriple` and have LLVM infer them. Furthermore we add `clang` as a proper tool, so we don't rely on assuming that `clang` is called `clang` on the `PATH` when using `clang` as the assembler. Finally this diff also changes the type of `optLevel` from `Int` to `Word`, as we do not have negative optimization levels. Reviewers: erikd, hvr, austin, rwbarton, bgamari, kavon Reviewed By: kavon Subscribers: michalt, Ericson2314, ryantrinkle, dfeuer, carter, simonpj, kavon, simonmar, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3352
* fix typo (expreesions -> expressions)Chris Martin2017-08-221-1/+1
|
* Drop GHC 7.10 compatibilityRyan Scott2017-08-011-2/+0
| | | | | | | | | | | | | | | | GHC 8.2.1 is out, so now GHC's support window only extends back to GHC 8.0. This means we can delete gobs of code that was only used for GHC 7.10 support. Hooray! Test Plan: ./validate Reviewers: hvr, bgamari, austin, goldfire, simonmar Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3781
* Make module membership on ModuleGraph fasterBartosz Nitka2017-07-182-11/+14
| | | | | | | | | | | | | | | | | | | When loading/reloading with a large number of modules (>5000) the cost of linear lookups becomes significant. The changes here made `:reload` go from 6s to 1s on my test case. The bottlenecks were `needsLinker` in `DriverPipeline` and `getModLoop` in `GhcMake`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D3703
* Make ':info Coercible' display an arbitrary string (fixes #12390)Patrick Dougherty2017-07-111-6/+8
| | | | | | | | | | | | | | | | | | | | This change enables the addition of an arbitrary string to the output of GHCi's ':info'. It was made for Coercible in particular but could be extended if desired. Updates haddock submodule. Test Plan: Modified test 'ghci059' to match new output. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: goldfire, rwbarton, thomie GHC Trac Issues: #12390 Differential Revision: https://phabricator.haskell.org/D3634
* Revert "Make module membership on ModuleGraph faster"Ben Gamari2017-06-272-14/+11
| | | | | | I had not intended on merging this. This reverts commit b0708588e87554899c2efc80a2d3eba353dbe926.
* Make module membership on ModuleGraph fasterBartosz Nitka2017-06-272-11/+14
| | | | | | | | | | | | | | | | | | | When loading/reloading with a large number of modules (>5000) the cost of linear lookups becomes significant. The changes here made `:reload` go from 6s to 1s on my test case. The bottlenecks were `needsLinker` in `DriverPipeline` and `getModLoop` in `GhcMake`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3646
* Show only the number of modules in ghciFrancesco Mazzoli2017-06-211-18/+9
| | | | | | | | | | Reviewers: bgamari, austin, simonmar Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3651
* Make -w less aggressive (Trac #12056)Sean Gillespie2017-06-121-4/+4
| | | | | | | | | | | | | | | Previously -w combined with -Wunrecognised-warning-flags would not report unrecognized flags. Reviewers: austin, bgamari, dfeuer Reviewed By: bgamari Subscribers: dfeuer, rwbarton, thomie GHC Trac Issues: #12056 Differential Revision: https://phabricator.haskell.org/D3581
* Refactor temp files cleanupDouglas Wilson2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove filesToNotIntermediateClean from DynFlags, create a data type FilesToClean, and change filesToClean in DynFlags to be a FilesToClean. Modify SysTools.newTempName and the Temporary constructor of PipelineMonad.PipelineOutput to take a TempFileLifetime, which specifies whether a temp file should live until the end of GhcMonad.withSession, or until the next time cleanIntermediateTempFiles is called. These changes allow the cleaning of intermediate files in GhcMake to be much more efficient. HscTypes.hptObjs is removed as it is no longer used. A new performance test T13701 is added, which passes both with and without -keep-tmp-files. The test fails by 25% without the patch, and passes when -keep-tmp-files is added. Note that there are still at two hotspots caused by algorithms quadratic in the number of modules, however neither of them allocate. They are: * DriverPipeline.compileOne'.needsLinker * GhcMake.getModLoop DriverPipeline.compileOne'.needsLinker is changed slightly to improve the situation. I don't like adding these Types to DynFlags, but they need to be seen by Dynflags, SysTools and PipelineMonad. The alternative seems to be to create a new module. Reviewers: austin, hvr, bgamari, dfeuer, niteria, simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #13701 Differential Revision: https://phabricator.haskell.org/D3620
* Udate hsSyn AST to use Trees that GrowAlan Zimmerman2017-06-063-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow This commit prepares the ground for a full extensible AST, by replacing the type parameter for the hsSyn data types with a set of indices into type families, data GhcPs -- ^ Index for GHC parser output data GhcRn -- ^ Index for GHC renamer output data GhcTc -- ^ Index for GHC typechecker output These are now used instead of `RdrName`, `Name` and `Id`/`TcId`/`Var` Where the original name type is required in a polymorphic context, this is accessible via the IdP type family, defined as type family IdP p type instance IdP GhcPs = RdrName type instance IdP GhcRn = Name type instance IdP GhcTc = Id These types are declared in the new 'hsSyn/HsExtension.hs' module. To gain a better understanding of the extension mechanism, it has been applied to `HsLit` only, also replacing the `SourceText` fields in them with extension types. To preserve extension generality, a type class is introduced to capture the `SourceText` interface, which must be honoured by all of the extension points which originally had a `SourceText`. The class is defined as class HasSourceText a where -- Provide setters to mimic existing constructors noSourceText :: a sourceText :: String -> a setSourceText :: SourceText -> a getSourceText :: a -> SourceText And the constraint is captured in `SourceTextX`, which is a constraint type listing all the extension points that make use of the class. Updating Haddock submodule to match. Test Plan: ./validate Reviewers: simonpj, shayan-najd, goldfire, austin, bgamari Subscribers: rwbarton, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D3609
* Use lengthIs and friends in more placesRyan Scott2017-06-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | While investigating #12545, I discovered several places in the code that performed length-checks like so: ``` length ts == 4 ``` This is not ideal, since the length of `ts` could be much longer than 4, and we'd be doing way more work than necessary! There are already a slew of helper functions in `Util` such as `lengthIs` that are designed to do this efficiently, so I found every place where they ought to be used and did just that. I also defined a couple more utility functions for list length that were common patterns (e.g., `ltLength`). Test Plan: ./validate Reviewers: austin, hvr, goldfire, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: goldfire, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3622
* Make GHCi work when RebindableSyntax is enabledRyan Scott2017-06-021-5/+7
| | | | | | | | | | | | | | | | | | | | Previously, we were running some blocks of code at the start of every GHCi sessions which use do-notation, something which doesn't work well if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the code to avoid the use of do-notation so that `-XRebindableSyntax` won't reject it. Test Plan: make test TEST=T13385 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13385 Differential Revision: https://phabricator.haskell.org/D3621
* Fix crash in isModuleInterpreted for HsBoot (fixes #13591)Lennart Spitzner2017-05-121-1/+1
| | | | | | | | Rename isModuleInterpreted to moduleIsBootOrNotObjectLinkable because a) there already is a moduleIsInterpreted function in the same module b) I have no idea if the (new) semantic of the bool returned matches some understanding of "is interpreted".
* Pass -ffrontend-opt arguments to frontend plugin in the correct orderdoug2017-05-041-1/+2
| | | | | | | | | | | | | | | | | | | Previously they were passed in the reverse order that they're specified on the command line. Add a haddock to frontendPluginOpts in DynFlags.hs. Modify test frontend01 to cover the case of multiple -ffrontend-opt. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13632 Differential Revision: https://phabricator.haskell.org/D3520
* Prefer #if defined to #ifdefBen Gamari2017-04-283-11/+11
| | | | Our new CPP linter enforces this.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-281-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* Bump process to 1.6Ben Gamari2017-04-271-1/+1
| | | | Also bumps Cabal submodule due to version bound bump.
* Don't setProgramDynFlags on every :loadSimon Marlow2017-04-251-19/+27
| | | | | | | | | | | | | | | | | | | | Summary: setProgramDynFlags invalidates the whole module graph, forcing everything to be re-summarised (including preprocessing) on every :reload. Looks like this was a bad regression in 8.0, but we didn't notice because there was no test for it. Now there is! Test Plan: * validate * new unit test Reviewers: bgamari, triple, austin, niteria, erikd, jme Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3398
* utils: Lazily decode UTF8 stringsBen Gamari2017-04-171-2/+1
| | | | | | | | | | Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13527 Differential Revision: https://phabricator.haskell.org/D3442
* Remove GhcDynamic (in favor of DYNAMIC_GHC_PROGRAMS)Reid Barton2017-04-121-3/+2
| | | | | | | | | | | | | | | | | | | | | | | DYNAMIC_GHC_PROGRAMS and GhcDynamic both tried to control whether the ghc binary was built as a dynamic executable, with confusing results. In particular, setting GhcDynamic=NO has no effect on systems where DYNAMIC_GHC_PROGRAMS defaults to YES. DYNAMIC_GHC_PROGRAMS is more fully-featured (it ensures that the correct flavor of the libraries is built, for example) so let's keep it and remove GhcDynamic to reduce confusion. This effectively reverts commit 3c6190b0. Test Plan: tested locally; harbormaster Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3428
* Typos in comments [ci skip]Gabor Greif2017-04-111-2/+2
|
* Revert "Enable new warning for fragile/incorrect CPP #if usage"Ben Gamari2017-04-051-1/+1
| | | | | | | | This is causing too much platform dependent breakage at the moment. We will need a more rigorous testing strategy before this can be merged again. This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-051-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* :cd affects the iserv process tooSimon Marlow2017-04-021-0/+5
| | | | | | | | | | | | Test Plan: validate Reviewers: angerman, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3395
* Optimise common cases of GHC.setProgramDynFlagsSimon Marlow2017-04-011-7/+0
| | | | | | | | | | | | | | | | | | * If the package flags haven't changed, don't do initPackages (which might take multiple seconds in extreme cases) * Provide a way to change the log_action without invalidating the summary cache. Test Plan: validate Reviewers: niteria, bgamari, austin, erikd, ezyang Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3392
* Spelling in comments only [ci skip]Gabor Greif2017-03-281-1/+1
|
* Allow colors to be customizedPhil Ruffwind2017-03-231-1/+1
| | | | | | | | | | | | | | | | | | Allow customization of diagnostic colors through the GHC_COLORS environment variable. Some color-related code have been refactored to PprColour to reduce the circular dependence between DynFlags, Outputable, ErrUtils. Some color functions that were part of Outputable but were never used have been deleted. Test Plan: validate Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3364
* Eliminate ListSetOps from imp_trust_pkgsDavid Feuer2017-03-021-6/+7
| | | | | | | | | | | | | | Eliminate ListSetOps from imp_trust_pkgs and imp_dep_pkgs Replace Map with NameEnv in TmOracle Reviewers: austin, dfeuer, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3113
* Try submodule bumps againBen Gamari2017-02-281-1/+1
| | | | | | Bumps containers, time, and unix submodules. This reverts commit c347a121b07d22fb91172337407986b6541e319d.
* Have --backpack complain if multiple files are passed.Edward Z. Yang2017-02-231-6/+6
| | | | | | | | | | | | | | | Summary: At the moment it silently swallows the actual arguments; not good! Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3173
* Revert recent submodule bumpsBen Gamari2017-02-221-1/+1
| | | | | | | | They broke everything and the solution will be non-trivial. This reverts commit 8ccbc2e5252abd4fa67d155d4fff489ee9929906. This reverts commit c8d995db5d743358b0583fe97f8113bf9047641e. This reverts commit 7153370288e6075c4f8c996ff02227e48805da06.
* Bump time submodule to 1.8Ben Gamari2017-02-201-1/+1
| | | | | This unfortunately had quite a number of knock-on effects, including a need for new releases of directory and unix.
* TH-spliced class instances are pretty-printed incorrectly post-#3384Alan Zimmerman2017-02-101-1/+2
| | | | | | | | | | | | | | | | Summary: The HsSyn prettyprinter tests patch 499e43824bda967546ebf95ee33ec1f84a114a7c broke the pretty-printing of Template Haskell-spliced class instances. Test Plan: ./validate Reviewers: RyanGlScott, austin, goldfire, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3043
* Tweaks and typos in manual, note refs, commentsGabor Greif2017-02-091-1/+1
|
* Ditch static flagsSylvain Henry2017-02-021-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440
* Bump Win32 version.Ben Gamari2017-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | Bump the version of `Win32` to `2.5.0.0` which is a major update and includes fixes for wrong alignments and wrong 64-bit types. Strangely enough this also seems to resolve #12713, where `T10858` was failing due to too-low allocations. The underlying type aliases have changed, so there is a potential for user programs not to compile anymore, but the types were incorrect. This also requires a bump in the `directory`, `Cabal`, and `process` submodules. Original author: Tamar Christina <tamar@zhox.com> Test Plan: ./validate Reviewers: bgamari, RyanGlScott, austin Subscribers: hvr, RyanGlScott, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2938
* Show explicit quantifiers in conflicting definitions errorPhil de Joux2017-01-201-4/+5
| | | | | | | | | | | | | | | | This fixes #12441, where definitions in a Haskell module and its boot file which differed only in their quantifiers produced a confusing error message. Here we teach GHC to always show quantifiers for these errors. Reviewers: goldfire, simonmar, erikd, austin, hvr, bgamari Reviewed By: bgamari Subscribers: snowleopard, simonpj, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2734 GHC Trac Issues: #12441
* Improve suggestion for misspelled flag including '=' (fixes #11789)Daishi Nakajima2017-01-181-1/+10
| | | | | | | | | | | | | | | | | | | | | Test Plan: Added 2 test cases, verified that ghc can suggest in the following cases: - for misspelled flag containing '=', ghc suggests flags that doesn't contain '=' - for misspelled flag containing '=', ghc suggests flags that contains '=' Reviewers: austin, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: dfeuer, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2978 GHC Trac Issues: #11789
* Support for abi-depends for computing shadowing.Edward Z. Yang2016-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a complete fix based off of ed7af26606b3a605a4511065ca1a43b1c0f3b51d for handling shadowing and out-of-order -package-db flags simultaneously. The general strategy is we first put all databases together, overriding packages as necessary. Once this is done, we successfully prune out broken packages, including packages which depend on a package whose ABI differs from the ABI we need. Our check gracefully degrades in the absence of abi-depends, as we only check deps which are recorded in abi-depends. Contains time and Cabal submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: niteria, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2846 GHC Trac Issues: #12485
* base: Bump version to 4.10.0.0Ben Gamari2016-12-151-1/+1
| | | | Updates a number of submodules.
* hschooks.c: Fix long lineBen Gamari2016-12-081-1/+4
|
* Use C99's boolBen Gamari2016-11-291-1/+1
| | | | | | | | | | | | Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
* hschooks.c: Ensure correct header file is includedBen Gamari2016-11-291-1/+8
| | | | | | | | | | | | | | | | Consider the case of building a stage1 compiler. `hschooks.c` will be built by stage0 `ghc` and linked against the `stage0` RTS. Despite this it was #including the stage1 `Rts.h`. There is, of course, no guarantee that this is ABI-compatible with the stage0 RTS and when they diverge Bad Things happen (e.g. bells ringing at inappropriate times in D2699). Test Plan: Validate Reviewers: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2763
* ghc/hschooks.c: Fix include path of Rts.hBen Gamari2016-11-221-1/+1
| | | | | | | | | | | | | | | We need to ensure that we don't include Rts.h from bootstrap compiler. See #12796. Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2698 GHC Trac Issues: #12796
* Generalise the implicit prelude importSimon Marlow2016-11-162-18/+66
| | | | | | | | | | | | Now it's possible to have two lists of imports: * extra_imports are imports that are always added to the context * prelude_imports are imports that are added if we don't have any open modules in scope. No UI changes or new commands are added for now. This was functionality that we needed in our customized GHCi at Facebook, so I wanted to get it upstream to reduce the differences between our version and the upstream version.