summaryrefslogtreecommitdiff
path: root/compiler/utils
Commit message (Collapse)AuthorAgeFilesLines
* Some refactoring and simplification in TcInteract.occurChecksimonpj@microsoft.com2010-10-071-5/+8
|
* Implement auto-specialisation of imported Idssimonpj@microsoft.com2010-10-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This big-ish patch arranges that if an Id 'f' is * Type-class overloaded f :: Ord a => [a] -> [a] * Defined with an INLINABLE pragma {-# INLINABLE f #-} * Exported from its defining module 'D' then in any module 'U' that imports D 1. Any call of 'f' at a fixed type will generate (a) a specialised version of f in U (b) a RULE that rewrites unspecialised calls to the specialised on e.g. if the call is (f Int dOrdInt xs) then the specialiser will generate $sfInt :: [Int] -> [Int] $sfInt = <code for f, imported from D, specialised> {-# RULE forall d. f Int d = $sfInt #-} 2. In addition, you can give an explicit {-# SPECIALISE -#} pragma for the imported Id {-# SPECIALISE f :: [Bool] -> [Bool] #-} This too generates a local specialised definition, and the corresponding RULE The new RULES are exported from module 'U', so that any module importing U will see the specialised versions of 'f', and will not re-specialise them. There's a flag -fwarn-auto-orphan that warns you if the auto-generated RULES are orphan rules. It's not in -Wall, mainly to avoid lots of error messages with existing packages. Main implementation changes - A new flag on a CoreRule to say if it was auto-generated. This is persisted across interface files, so there's a small change in interface file format. - Quite a bit of fiddling with plumbing, to get the {-# SPECIALISE #-} pragmas for imported Ids. In particular, a new field tgc_imp_specs in TcGblEnv, to keep the specialise pragmas for imported Ids between the typechecker and the desugarer. - Some new code (although surprisingly little) in Specialise, to deal with calls of imported Ids
* remove unnecessary/broken definition of mask_Simon Marlow2010-10-021-5/+0
|
* Remove (most of) the FiniteMap wrapperIan Lynagh2010-09-142-194/+25
| | | | | | | | We still have insertList, insertListWith, deleteList which aren't in Data.Map, and foldRightWithKey which works around the fold(r)WithKey addition and deprecation.
* Super-monster patch implementing the new typechecker -- at lastsimonpj@microsoft.com2010-09-133-5/+57
| | | | | | | | | This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
* avoid Foreign.unsafePerformIORoss Paterson2010-09-091-1/+1
|
* update for containers-0.4Simon Marlow2010-09-031-0/+4
|
* Send ghc progress output to stdout; fixes #3636Ian Lynagh2010-08-081-1/+4
|
* NCG: Don't worry about trying to re-freeze missing coalescencesbenl@ouroborus.net2010-07-021-5/+4
|
* adapt to the new async exceptions APISimon Marlow2010-07-091-15/+36
|
* Fix panic when running "ghc -H"; trac #3364Ian Lynagh2010-06-241-1/+4
| | | | | | The problem is that showing SDoc's looks at the static flags global variables, but those are panics while we are parsing the static flags. We work around this by explicitly using a fixed prettyprinter style.
* Use UserInterrupt rather than our own Interrupted exception (#4100)Simon Marlow2010-06-021-6/+2
|
* looksLikeModuleName: allow apostrophe in module names (#4051)Simon Marlow2010-05-101-1/+1
|
* Fix build with GHC 6.10Ian Lynagh2010-05-041-0/+13
| | | | | In GHC 6.10, intersectionWith is (a -> b -> a) instead of (a -> b -> c), so we need to jump through some hoops to get the more general type.
* Replace FiniteMap and UniqFM with counterparts from containers.Milan Straka2010-05-033-1474/+203
| | | | | | | | | | | | | | | The original interfaces are kept. There is small performance improvement: - when compiling for five nofib, we get following speedups: Average ----- -2.5% Average ----- -0.6% Average ----- -0.5% Average ----- -5.5% Average ----- -10.3% - when compiling HPC ten times, we get: switches oldmaps newmaps -O -fasm 117.402s 116.081s (98.87%) -O -fasm -fregs-graph 119.993s 118.735s (98.95%) -O -fasm -fregs-iterative 120.191s 118.607s (98.68%)
* Spelling correction for LANGUAGE pragmasMax Bolingbroke2010-04-132-3/+106
|
* The bootstrapping compiler is now required to be > 609Ian Lynagh2010-04-092-8/+0
|
* Add Data and Typeable instances to HsSynDavid Waern2010-03-303-2/+51
| | | | | The instances (and deriving declarations) have been taken from the ghc-syb package.
* Remove LazyUniqFM; fixes trac #3880Ian Lynagh2010-03-201-342/+0
|
* Add fmapMaybeM and fmapEitherMsimonpj@microsoft.com2010-03-041-0/+11
|
* a faster appendFSich@christoph-bauer.net2010-02-271-1/+12
|
* Remove redundant importsimonpj@microsoft.com2010-02-081-1/+0
|
* fix warning on WindowsSimon Marlow2010-01-271-2/+1
|
* catch SIGHUP and SIGTERM and raise an exception (#3656)Simon Marlow2010-01-271-3/+18
|
* locateOneObj: don't look for dynamic libs in static modeSimon Marlow2010-01-031-5/+5
| | | | | also replace picIsOn with isDynamicGhcLib, as __PIC__ is not the correct test for whether the GHC library is dynamically linked.
* Substantial improvements to coercion optimisationsimonpj@microsoft.com2010-01-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The main purpose of this patch is to add a bunch of new rules to the coercion optimiser. They are documented in the (revised) Appendix of the System FC paper. Some code has moved about: - OptCoercion is now a separate module, mainly because it now uses tcMatchTy, which is defined in Unify, so OptCoercion must live higehr up in the hierarchy - Functions that manipulate Kinds has moved from Type.lhs to Coercion.lhs. Reason: the function typeKind now needs to call coercionKind. And in any case, a Kind is a flavour of Type, so it builds on top of Type; indeed Coercions and Kinds are both flavours of Type. This change required fiddling with a number of imports, hence the one-line changes to otherwise-unrelated modules - The representation of CoTyCons in TyCon has changed. Instead of an extensional representation (a kind checker) there is now an intensional representation (namely TyCon.CoTyConDesc). This was needed for one of the new coercion optimisations.
* Rolling back: Make FastString thread-safe.Simon Marlow2009-12-311-45/+84
| | | | | | | | | | This patch was the cause of the compile-time performance regression in #3796. My guess is that it is due to the use of unsafePerformIO which traverses the stack up to the first update frame, and perhaps we have a deep stack when reading the dictionary from a .hi file. In any case, since we're not relying on thread safety for FastStrings, I think the safest thing to do is back this out until we can investigate further.
* Make warning printing a bit less noisysimonpj@microsoft.com2009-12-181-1/+1
| | | | Use -dppr-debug to make it noisy again
* Add splitUFM to UniqFM (used in a forthcoming patch)simonpj@microsoft.com2009-12-041-3/+23
| | | | | splitUFM :: Uniquable key => UniqFM elt -> key -> (UniqFM elt, Maybe elt, UniqFM elt) -- Splits a UFM into things less than, equal to, and greater than the key
* Add lengthBag to Bag (using in forthcoming patch)simonpj@microsoft.com2009-12-041-1/+7
|
* Add an ID monad to MonadUtils (used in kind checking)simonpj@microsoft.com2009-11-121-0/+18
|
* Make `consBag` infixr, and `snocBag` infixlsimonpj@microsoft.com2009-10-291-0/+3
|
* Add Outputable.blankLine and use itsimonpj@microsoft.com2009-10-291-19/+21
|
* Use braces rather than angle-brackets in debug-printing for Bagssimonpj@microsoft.com2009-10-231-1/+1
|
* Use the standard library versions of elem and notElemIan Lynagh2009-10-051-21/+12
| | | | rather than our own copies
* Fix part of #3398: pretty-printing always goes via the I/O library encodingSimon Marlow2009-08-261-5/+3
| | | | | | | | | That is, unless we're printing in LeftMode, where we bypass encoding for speed. This is safe, because LeftMode is used for outputting C or asm, where everyting is Z-encoded and hence ASCII. Error messages and other compiler output containing Unicode will now appear correctly according to the locale settings.
* Make FastString thread-safe.Thomas Schilling2009-08-241-84/+45
| | | | | | | | | This is needed both for per-session parallelism and for allowing multiple concurrent sessions in the same process. With the help of atomicModifyIORef and unsafePerformIO it is also quite fast--an MVar would most likely be slower. On a full compilation of Cabal's head branch it was about 1-2 percent slower, but then overall compilation times varied by about 4 percent, so I think it's worth it.
* Use explicit Word32/Int32 in place of Int in the on-disk .hi fileSimon Marlow2009-08-211-3/+3
| | | | | For: FastStrings, Names, and Bin values. This makes .hi files smaller on 64-bit platforms, while also making the format a bit more robust.
* Make consIORef atomic.Thomas Schilling2009-08-221-4/+2
|
* Make -dppr-debug print locations in HsSynsimonpj@microsoft.com2009-08-201-1/+8
| | | | | | | | | | Show SrcSpans for Located things might be overkill, but it's sometimes useful. I also added ppWhen, ppUnless :: Bool -> SDoc -> SDoc to Outputable
* generalise the type of "on"Simon Marlow2009-08-201-1/+1
|
* Make the dynamic linker thread-safe.Thomas Schilling2009-08-171-1/+10
| | | | | | | | | | | | The current implementation is rather pessimistic. The persistent linker state is now an MVar and all exported Linker functions are wrapped in modifyMVar calls. This is serves as a big lock around all linker functions. There might be a chance for more concurrency in a few places. E.g., extending the closure environment and loading packages might be independent in some cases. But for now it's better to be on the safe side.
* Make updates to the external package state atomic.Thomas Schilling2009-08-161-2/+15
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* Make the types we use when creating GHCi bytecode better match realityIan Lynagh2009-07-291-0/+3
| | | | | We were keeping things as Int, and then converting them to Word16 at the last minute, when really they ought to have been Word16 all along.
* Add an (Outputable Word16) instanceIan Lynagh2009-07-281-1/+4
|
* Remove GHC's haskell98 dependencyIan Lynagh2009-07-241-2/+1
|
* Fix Trac #3012: allow more free-wheeling in standalone derivingsimonpj@microsoft.com2009-07-231-3/+3
| | | | | | | | | | | | | | | | | | In standalone deriving, we now do *not* check side conditions. We simply generate the code and typecheck it. If there's a type error, it's the programmer's problem. This means that you can do 'deriving instance Show (T a)', where T is a GADT, for example, provided of course that the boilerplate code does in fact typecheck. I put some work into getting a decent error message. In particular if there's a type error in a method, GHC will show the entire code for that method (since, after all, the user did not write it). Most of the changes are to achieve that goal. Still to come: changes in the documentation.
* Add fmapM_maybe :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b)simonpj@microsoft.com2009-07-231-0/+9
| | | | | | This function isn't used at the moment, but Max added it, and it looks useful.
* Always serialise Int as 64bit values; fixes trac #3041Ian Lynagh2009-07-171-9/+0
| | | | | | This means that, provided the values are small enough, files serialized are portable between architectures. In particular, .haddock files are portable.