summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Per-thread allocation counters and limitsSimon Marlow2014-11-126-99/+293
| | | | | | | | This reverts commit f0fcc41d755876a1b02d1c7c79f57515059f6417. New changes: now works on 32-bit platforms too. I added some basic support for 64-bit subtraction and comparison operations to the x86 NCG.
* Implement new integer-gmp2 from scratch (re #9281)Herbert Valerio Riedel2014-11-124-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done as a separate `integer-gmp2` backend library because it turned out to become a complete rewrite from scratch. Due to the different (over)allocation scheme and potentially different accounting (via the new `{shrink,resize}MutableByteArray#` primitives), some of the nofib benchmarks actually results in increased allocation numbers (but not necessarily an increase in runtime!). I believe the allocation numbers could improve if `{resize,shrink}MutableByteArray#` could be optimised to reallocate in-place more efficiently. Here are the more apparent changes in the latest nofib comparision between `integer-gmp` and `integer-gmp2`: ------------------------------------------------------------------ Program Size Allocs Runtime Elapsed TotalMem ------------------------------------------------------------------ ... bernouilli +1.6% +15.3% 0.132 0.132 0.0% ... cryptarithm1 -2.2% 0.0% -9.7% -9.7% 0.0% ... fasta -0.7% -0.0% +10.9% +10.9% 0.0% ... kahan +0.6% +38.9% 0.169 0.169 0.0% ... lcss -0.7% -0.0% -6.4% -6.4% 0.0% ... mandel +1.6% +33.6% 0.049 0.049 0.0% ... pidigits +0.8% +8.5% +3.9% +3.9% 0.0% power +1.4% -23.8% -18.6% -18.6% -16.7% ... primetest +1.3% +50.1% 0.085 0.085 0.0% ... rsa +1.6% +53.4% 0.026 0.026 0.0% ... scs +1.2% +6.6% +6.5% +6.6% +14.3% ... symalg +1.0% +9.5% 0.010 0.010 0.0% ... transform -0.6% -0.0% -5.9% -5.9% 0.0% ... ------------------------------------------------------------------ Min -2.3% -23.8% -18.6% -18.6% -16.7% Max +1.6% +53.4% +10.9% +10.9% +14.3% Geometric Mean -0.3% +1.9% -0.8% -0.8% +0.0% (see P35 / https://phabricator.haskell.org/P35 for full report) By default, `INTEGER_LIBRARY=integer-gmp2` is active now, which results in the package `integer-gmp-1.0.0.0` being registered in the package db. The previous `integer-gmp-0.5.1.0` can be restored by setting `INTEGER_LIBRARY=integer-gmp` (but will probably be removed altogether for GHC 7.12). In-tree GMP support has been stolen from the old `integer-gmp` (while unpatching the custom memory-allocators, as well as forcing `-fPIC`) A minor hack to `ghc-cabal` was necessary in order to support two different `integer-gmp` packages (in different folders) with the same package key. There will be a couple of follow-up commits re-implementing some features that were dropped to keep D82 minimal, as well as further clean-ups/improvements. More information can be found via #9281 and https://ghc.haskell.org/trac/ghc/wiki/Design/IntegerGmp2 Reviewed By: austin, rwbarton, simonmar Differential Revision: https://phabricator.haskell.org/D82
* Comments onlySimon Peyton Jones2014-11-111-0/+3
|
* Comments only (on recursive dictionaries)Simon Peyton Jones2014-11-112-40/+58
|
* Group PatSyn req/prov arguments together so that they're not all over the placeDr. ERDI Gergo2014-11-084-29/+28
|
* In pattern synonym matchers, support unboxed continuation results (fixes #9783).Dr. ERDI Gergo2014-11-083-22/+42
| | | | | | | | | | | | | | | | | | | | | | | | This requires ensuring the continuations have arguments by adding a dummy Void# argument when needed. This is so that matching on a pattern synonym is lazy even when the result is unboxed, e.g. pattern P = () f P = 0# In this case, without dummy arguments, the generated matcher's type would be $mP :: forall (r :: ?). () -> r -> r -> r which is called in `f` at type `() -> Int# -> Int# -> Int#`, so it would be strict, in particular, in the failure continuation of `patError`. We work around this by making sure both continuations have arguments: $mP :: forall (r :: ?). () -> (Void# -> r) -> (Void# -> r) -> r Of course, if `P` (and thus, the success continuation) has any arguments, we are only adding the extra dummy argument to the failure continuation.
* Miscellaneous documentation for the Finder.Edward Z. Yang2014-11-071-2/+22
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Typofix.Edward Z. Yang2014-11-071-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* small parser/lexer cleanupYuri de Wit2014-11-074-571/+571
| | | | | | | | | | | | | | | | | | Summary: The last three '#define ...' macros were removed from Parser.y.pp and this file was renamed to Parser.y. This basically got rid of a CPP step in the build. Also converted two modules in compiler/parser/ from .lhs to .hs. Test Plan: Does it build? Yes, I performed a full build here and things are looking good. Reviewers: austin Reviewed By: austin Subscribers: adamse, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D411
* Improve Applicative definitionsDavid Feuer2014-11-072-1/+3
| | | | | | | | | | | | | | | | | | | | | Generally clean up things relating to Applicative and Monad in `GHC.Base` and `Control.Applicative` to make `Applicative` feel like a bit more of a first-class citizen rather than just playing second fiddle to `Monad`. Use `coerce` and GND to improve performance and clarity. Change the default definition of `(*>)` to use `(<$)`, in case the `Functor` instance optimizes that. Moreover, some manually written instances are made into compiler-derived instances. Finally, this also adds a few AMP-related laws to the `Applicative` docstring. NOTE: These changes result in a 13% decrease in allocation for T9020 Reviewed By: ekmett, hvr Differential Revision: https://phabricator.haskell.org/D432
* Warn for Safe Haskell when -XOverlappingInstances orDavid Terei2014-11-062-14/+32
| | | | -XIncoherentInstances turned on.
* Better error messages for new per-instance overlap flags and SafeDavid Terei2014-11-061-1/+9
| | | | Haskell.
* Refactor the code that prevents recursion among Coercible constraintsSimon Peyton Jones2014-11-063-46/+44
| | | | | | | | | | | | | | The main description is in Note [Preventing recursive dictionaries] in TcRnTypes, which applies only to Coercible dictionaries. But it was a bit of a mess: - It wasn't applied consistently - It was being applied to non-Coercible dictionaries in some places This patch tidies it up. This hack will largely go away when Richard starts treating Coercible constraints more like equalities than like dictionaries.
* Wibbles to notesSimon Peyton Jones2014-11-061-33/+2
|
* Allow the solved dictionaries to propagate from outside inSimon Peyton Jones2014-11-061-3/+26
| | | | | See Note [Propagate solved dictionaries] in TcSMonad. This can signficantly reduce the number of solver steps.
* Minor refacoring and trace-message printingSimon Peyton Jones2014-11-062-24/+25
|
* Switch off lazy flattening (fix Trac #3064)Simon Peyton Jones2014-11-063-10/+42
| | | | | | | | See Note [Lazy flattening] in TcFlatten. Lazy flattening was an apparently good idea which actually made the type inference engine go a LOTS slower in T3064. So I switched it off again.
* Comments and white space onlySimon Peyton Jones2014-11-061-1/+1
|
* Make tyConsOfType return a (NameEnv TyCon) rather than [TyCon]Simon Peyton Jones2014-11-064-13/+14
| | | | A little refactoring
* Remove unused tyConsOfDataConSimon Peyton Jones2014-11-062-15/+1
|
* Move expansion of 'assert' from renamer to typecheckerSimon Peyton Jones2014-11-062-64/+60
| | | | | This improves error messages when there is a type error, fixing Trac #9774
* Update User's Guide, cleanup DynFlagsJan Stolarek2014-11-063-251/+296
|
* Remove -ddump-core-pipeline flagJan Stolarek2014-11-063-7/+1
|
* Remove -ddump-simpl-phases flagJan Stolarek2014-11-063-50/+14
|
* Fix a couple of bugs in the way info tables are generated for 64-bit platformsSimon Marlow2014-11-052-15/+25
| | | | | | | | | | 1. The offset was a full word, but it should actually be a 32-bit offset on 64-bit platforms. 2. The con_desc string was allocated separately, which meant that it might be out of range for a 32-bit offset. These bugs meant that +RTS -Di (interpreter debugging) would sometimes crash on 64-bit.
* Remove redundant contexts from Foldable methodsDavid Feuer2014-11-051-17/+3
| | | | | | | | | | | New `Foldable` methods accidentally had `Foldable` contexts, which led to type roles being assigned incorrectly and preventing GND from deriving `Foldable` instances. Removing those fixes #9761. Moreover, this patch takes advantage of this fix by deriving `Foldable` (and `Eq`) for `UniqFM`. Differential Revision: https://phabricator.haskell.org/D425
* A little refactoring of HsSplice and friendsSimon Peyton Jones2014-11-048-96/+134
| | | | | | | Plus adding comments. The most substantive change is that PendingTcSplice becomes a proper data type rather than a pair; and PendingRnSplice uses it
* Simon's major commit to re-engineer the constraint solverSimon Peyton Jones2014-11-0413-2218/+2842
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driving change is this: * The canonical CFunEqCan constraints now have the form [G] F xis ~ fsk [W] F xis ~ fmv where fsk is a flatten-skolem, and fmv is a flatten-meta-variable Think of them as the name of the type-function application See Note [The flattening story] in TcFlatten. A flatten-meta-variable is distinguishable by its MetaInfo of FlatMetaTv This in turn led to an enormous cascade of other changes, which simplify and modularise the constraint solver. In particular: * Basic data types * I got rid of inert_solved_funeqs altogether. It serves no useful role that inert_flat_cache does not solve. * I added wl_implics to the WorkList, as a convenient place to accumulate newly-emitted implications; see Note [Residual implications] in TcSMonad. * I eliminated tcs_ty_binds altogether. These were the bindings for unification variables that we have now solved by unification. We kept them in a finite map and did the side-effecting unification later. But in cannonicalisation we had to look up in the side-effected mutable tyvars anyway, so nothing was being gained. Our original idea was that the solver would be pure, and would be a no-op if you discarded its results, but this was already not-true for implications since we update their evidence bindings in an imperative way. So rather than the uneasy compromise, it's now clearly imperative! * I split out the flatten/unflatten code into a new module, TcFlatten * I simplified and articulated explicitly the (rather hazy) invariants for the inert substitution inert_eqs. See Note [eqCanRewrite] and See Note [Applying the inert substitution] in TcFlatten * Unflattening is now done (by TcFlatten.unflatten) after solveFlats, before solving nested implications. This turned out to simplify a lot of code. Previously, unflattening was done as part of zonking, at the very very end. * Eager unflattening allowed me to remove the unpleasant ic_fsks field of an Implication (hurrah) * Eager unflattening made the TcSimplify.floatEqualities function much simpler (just float equalities looking like a ~ ty, where a is an untouchable meta-tyvar). * Likewise the idea of "pushing wanteds in as givens" could be completely eliminated. * I radically simplified the code that determines when there are 'given' equalities, and hence whether we can float 'wanted' equalies out. See TcSMonad.getNoGivenEqs, and Note [When does an implication have given equalities?]. This allowed me to get rid of the unpleasant inert_no_eqs flag in InertCans. * As part of this given-equality stuff, I fixed Trac #9211. See Note [Let-bound skolems] in TcSMonad * Orientation of tyvar/tyvar equalities (a ~ b) was partly done during canonicalisation, but then repeated in the spontaneous-solve stage (trySpontaneousSolveTwoWay). Now it is done exclusively during canonicalisation, which keeps all the code in one place. See Note [Canonical orientation for tyvar/tyvar equality constraints] in TcCanonical
* Add flattening-notesSimon Peyton Jones2014-11-041-0/+49
|
* Comments onlySimon Peyton Jones2014-11-041-1/+2
|
* Fix the superclass-cycle detection code (Trac #9739)Simon Peyton Jones2014-11-042-19/+23
| | | | | | | We were falling into an infinite loop when doing the ambiguity check on a class method, even though we had previously detected a superclass cycle. There was code to deal with this, but it wasn't right.
* Add comments explaining ProbOneShotSimon Peyton Jones2014-11-044-44/+79
|
* Improve error message for a handwritten Typeable instanceSimon Peyton Jones2014-11-041-18/+24
|
* Define ctEvLoc and ctEvCoercion, and use themSimon Peyton Jones2014-11-042-5/+15
|
* Minor refactoring (no change in functionality)Simon Peyton Jones2014-11-041-3/+3
|
* Don't filter out allegedly-irrelevant bindings with -dppr-debugSimon Peyton Jones2014-11-041-1/+3
|
* Only report "could not deduce s~t from ..." for givens that include equalitiesSimon Peyton Jones2014-11-041-6/+8
| | | | | This just simplifies the error message in cases where there are no useful equalities in the context
* When reporting the context of given constraints, stop when you find oneSimon Peyton Jones2014-11-041-6/+17
| | | | | | that binds a variable mentioned in the wanted There is really no point in reporting ones further out; they can't be useful
* Typechecker debug tracing onlySimon Peyton Jones2014-11-044-32/+39
|
* Normalise the type of an inferred let-bindingSimon Peyton Jones2014-11-042-12/+21
| | | | | | | | | | | With the new constraint solver, we don't guarantee to fully-normalise all constraints (if doing so is not necessary to solve them). So we may end up with an inferred type like f :: [F Int] -> Bool which could be simplifed to f :: [Char] -> Bool if there is a suitable family instance declaration. This patch does this normalisation, in TcBinds.mkExport
* Get the Untouchables level right in simplifyInferSimon Peyton Jones2014-11-045-126/+179
| | | | | | | | Previously we could get constraints in which the untouchables-level did not strictly increase, which is one of the main invariants! This patch also simplifies and modularises the tricky case of generalising an inferred let-binding
* Refactor the treatment of lexically-scoped type variables for instance ↵Simon Peyton Jones2014-11-044-21/+28
| | | | | | | | | | | | | | declarations Previously the univerally-quantified variables of the DFun were also (bizarrely) used as the lexically-scoped variables of the instance declaration. So, for example, the DFun's type could not be alpha-renamed. This was an odd restriction, which has bitten me several times. This patch does the Right Thing, by adding an ib_tyvars field to the InstBindings record, which captures the lexically scoped variables. Easy, robust, nice. (I think this record probably didn't exist originally, hence the hack.)
* Refactor skolemising, and newClsInstSimon Peyton Jones2014-11-045-103/+117
| | | | | | | | | This makes newClsInst (was mkInstance) look more like newFamInst, and simplifies the plumbing of the overlap flag, and ensures that freshening (required by the InstEnv stuff) happens in one place. On the way I also tided up the rather ragged family of tcInstSkolTyVars and friends. The result at least has more uniform naming.
* Rename setRole_maybe to downgradeRole_maybeSimon Peyton Jones2014-11-041-18/+18
| | | | This change is just for naming uniformity with the existing downgradeRole
* Simplify the API for tcInstTyVars, and make it more consistent with other ↵Simon Peyton Jones2014-11-045-31/+33
| | | | similar functions
* Fix reduceTyFamApp_maybeSimon Peyton Jones2014-11-041-12/+34
| | | | | This function previously would expand *data* families even when it was asked for a *Nominal* coercion. This patch fixes it, and adds comments.
* White space onlySimon Peyton Jones2014-11-045-52/+60
|
* Add the unfolding and inline-pragma for DFuns in DsBinds, not TcInstDclsSimon Peyton Jones2014-11-042-23/+28
| | | | | This is a straight refactoring that puts the generation of unfolding info in one place, which is a lot tidier
* Simplify the generation of superclass constraints in tcInstDecl2Simon Peyton Jones2014-11-041-9/+10
| | | | | The simplified function is tcSuperClasses; no need for an implication constraint here
* Some refactoring around endPass and debug dumpingSimon Peyton Jones2014-11-0413-117/+157
| | | | | I forget all the details, but I spent some time trying to understand the current setup, and tried to simplify it a bit