summaryrefslogtreecommitdiff
path: root/compiler/utils
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'coloured-core' of https://github.com/nominolo/ghc into ↵coloured-coreIan Lynagh2011-05-082-99/+189
|\ | | | | | | coloured-core
| * Make SDoc an abstract type.Thomas Schilling2011-04-101-110/+118
| |
| * Start support for coloured SDoc output.Thomas Schilling2011-04-071-36/+113
| | | | | | | | | | | | | | The SDoc type now passes around an abstract SDocContext rather than just a PprStyle which required touching a few more files. This should also make it easier to integrate DynFlags passing, so that we can get rid of global variables.
| * Add zeroWidthText to Pretty.Thomas Schilling2011-04-031-1/+6
| |
* | Move Platform from compiler/nativeGen to compiler/utilsIan Lynagh2011-05-071-0/+104
| | | | | | | | We want to use it across the whole compiler now
* | Derive some Typeable instancesIan Lynagh2011-04-241-2/+1
| | | | | | | | | | We were using the Typeable.hs macros, but for no good reason as far as I can tell.
* | Rename "extra-gcc-opts" to "settings", and start generalising itIan Lynagh2011-04-211-0/+14
| |
* | Add pprDefiniteTrace and use itSimon Peyton Jones2011-04-201-1/+4
| | | | | | | | | | | | The point here is that a very few uses of pprTrace are controlled by a flag like -ddump-inlinings or -ddump-rule-firings, and we want to see that output even with -dno-debug-output
* | Add adjustUFM, adjustUFM_Directly and joinUFM to UniqFM.Edward Z. Yang2011-04-132-8/+30
| | | | | | | | | | | | | | Renamed adjustUFM in GraphOps to adjustUFM_C, to account for alternate argument order. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Implement mapUFM_Directly.Edward Z. Yang2011-04-111-1/+3
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* | Force re-linking if the options have changed (#4451)Simon Marlow2011-04-081-2/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common sequence of commands (at least for me) is this: $ ghc hello 1 of 1] Compiling Main ( hello.hs, hello.o ) Linking hello ... $ ./hello +RTS -s hello: Most RTS options are disabled. Link with -rtsopts to enable them. $ ghc hello -rtsopts $ grr, nothing happened. I could use -fforce-recomp, but if this was a large program I probably don't want to recompile it all again, so: $ rm hello removed `hello' $ ghc hello -rtsopts Linking hello ... $ ./hello +RTS -s ./hello +RTS -s Hello World! 51,264 bytes allocated in the heap 2,904 bytes copied during GC 43,808 bytes maximum residency (1 sample(s)) 17,632 bytes maximum slop etc. With this patch, GHC notices when the options have changed and forces a relink, so you don't need to rm the binary or use -fforce-recomp. This is done by adding the pertinent stuff to the binary in a special section called ".debug-ghc-link-info": $ readelf -p .debug-ghc-link-info ./hello String dump of section 'ghc-linker-opts': [ 0] (["-lHSbase-4.3.1.0","-lHSinteger-gmp-0.2.0.2","-lgmp","-lHSghc-prim-0.2.0.0","-lHSrts","-lm","-lrt","-ldl","-u","ghczmprim_GHCziTypes_Izh_static_info","-u","ghczmprim_GHCziTypes_Czh_static_info","-u","ghczmprim_GHCziTypes_Fzh_static_info","-u","ghczmprim_GHCziTypes_Dzh_static_info","-u","base_GHCziPtr_Ptr_static_info","-u","base_GHCziWord_Wzh_static_info","-u","base_GHCziInt_I8zh_static_info","-u","base_GHCziInt_I16zh_static_info","-u","base_GHCziInt_I32zh_static_info","-u","base_GHCziInt_I64zh_static_info","-u","base_GHCziWord_W8zh_static_info","-u","base_GHCziWord_W16zh_static_info","-u","base_GHCziWord_W32zh_static_info","-u","base_GHCziWord_W64zh_static_info","-u","base_GHCziStable_StablePtr_static_info","-u","ghczmprim_GHCziTypes_Izh_con_info","-u","ghczmprim_GHCziTypes_Czh_con_info","-u","ghczmprim_GHCziTypes_Fzh_con_info","-u","ghczmprim_GHCziTypes_Dzh_con_info","-u","base_GHCziPtr_Ptr_con_info","-u","base_GHCziPtr_FunPtr_con_info","-u","base_GHCziStable_StablePtr_con_info","-u","ghczmprim_GHCziTypes_False_closure","-u","ghczmprim_GHCziTypes_True_closure","-u","base_GHCziPack_unpackCString_closure","-u","base_GHCziIOziException_stackOverflow_closure","-u","base_GHCziIOziException_heapOverflow_closure","-u","base_ControlziExceptionziBase_nonTermination_closure","-u","base_GHCziIOziException_blockedIndefinitelyOnMVar_closure","-u","base_GHCziIOziException_blockedIndefinitelyOnSTM_closure","-u","base_ControlziExceptionziBase_nestedAtomically_closure","-u","base_GHCziWeak_runFinalizzerBatch_closure","-u","base_GHCziTopHandler_runIO_closure","-u","base_GHCziTopHandler_runNonIO_closure","-u","base_GHCziConcziIO_ensureIOManagerIsRunning_closure","-u","base_GHCziConcziSync_runSparks_closure","-u","base_GHCziConcziSignal_runHandlers_closure","-lHSffi"],Nothing,RtsOptsAll,False,[],[]) And GHC itself uses the readelf command to extract it when deciding whether to relink. The reason for the name ".debug-ghc-link-info" is that sections beginning with ".debug" are removed automatically by strip. This currently only works on Linux; Windows and OS X still have the old behaviour.
* Added a VECTORISE pragmaManuel M T Chakravarty2011-02-201-1/+7
| | | | | | | | | | | | | | | - Added a pragma {-# VECTORISE var = exp #-} that prevents the vectoriser from vectorising the definition of 'var'. Instead it uses the binding '$v_var = exp' to vectorise 'var'. The vectoriser checks that the Core type of 'exp' matches the vectorised Core type of 'var'. (It would be quite complicated to perform that check in the type checker as the vectorisation of a type needs the state of the VM monad.) - Added parts of a related VECTORISE SCALAR pragma - Documented -ddump-vect - Added -ddump-vt-trace - Some clean up
* Bleat a bit more informatively in unionListssimonpj@microsoft.com2011-01-261-2/+6
|
* Major refactoring of the type inference enginesimonpj@microsoft.com2011-01-121-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch embodies many, many changes to the contraint solver, which make it simpler, more robust, and more beautiful. But it has taken me ages to get right. The forcing issue was some obscure programs involving recursive dictionaries, but these eventually led to a massive refactoring sweep. Main changes are: * No more "frozen errors" in the monad. Instead "insoluble constraints" are now part of the WantedConstraints type. * The WantedConstraint type is a product of bags, instead of (as before) a bag of sums. This eliminates a good deal of tagging and untagging. * This same WantedConstraints data type is used - As the way that constraints are gathered - As a field of an implication constraint - As both argument and result of solveWanted - As the argument to reportUnsolved * We do not generate any evidence for Derived constraints. They are purely there to allow "impovement" by unifying unification variables. * In consequence, nothing is ever *rewritten* by a Derived constraint. This removes, by construction, all the horrible potential recursive-dictionary loops that were making us tear our hair out. No more isGoodRecEv search either. Hurrah! * We add the superclass Derived constraints during canonicalisation, after checking for duplicates. So fewer superclass constraints are generated than before. * Skolem tc-tyvars no longer carry SkolemInfo. Instead, the SkolemInfo lives in the GivenLoc of the Implication, where it can be tidied, zonked, and substituted nicely. This alone is a major improvement. * Tidying is improved, so that we tend to get t1, t2, t3, rather than t1, t11, t111, etc Moreover, unification variables are always printed with a digit (thus a0, a1, etc), so that plain 'a' is available for a skolem arising from a type signature etc. In this way, (a) We quietly say which variables are unification variables, for those who know and care (b) Types tend to get printed as the user expects. If he writes f :: a -> a f = ...blah... then types involving 'a' get printed with 'a', rather than some tidied variant. * There are significant improvements in error messages, notably in the "Cannot deduce X from Y" messages.
* Make fuzzy matching a little less eager for short identifierssimonpj@microsoft.com2011-01-071-3/+12
| | | | | For single-character identifiers we now don't make any suggestions See comments in Util.fuzzyLookup
* Add fuzzyLookup, a variant of fuzzyMatchsimonpj@microsoft.com2010-12-221-36/+73
| | | | Plus, I changed quite a bit of layout to make the lines shorter.
* Replace uses of the old catch function with the new oneIan Lynagh2010-12-181-4/+5
|
* Remove code that is dead now that we need >= 6.12 to buildIan Lynagh2010-12-158-64/+1
|
* Add -dppr-colsN to set width of dumpsBen Lippmeier2010-12-081-2/+2
|
* Tweak the "sorry" message a bitSimon Marlow2010-12-081-1/+1
| | | | | - "sorry! (this is work in progress)\n" + "sorry! (unimplemented feature or known bug)\n"
* More modules that need LANGUAGE BangPatternssimonpj@microsoft.com2010-11-122-0/+2
|
* Add LANGUAGE BangPatterns to modules that use themsimonpj@microsoft.com2010-11-123-0/+3
|
* Fix multi-line string (minor glitch in stage-1 compiler)simonpj@microsoft.com2010-11-111-2/+2
|
* Fix a #if testIan Lynagh2010-11-021-1/+1
| | | | showMultiLineString is only in >= 7.1.
* Cleanup comments and formatting onlybenl@ouroborus.net2010-10-291-87/+108
|
* Nicer error message for #3782benl@ouroborus.net2010-10-292-13/+29
| | | | | | | | | | | | | | | | | | It now says: ghc-stage2: sorry! (this is work in progress) (GHC version 7.1.20101028 for i386-apple-darwin): Vectorise.Builtins.indexBuiltin DPH builtin function 'sumTyCon' of size '11' is not yet implemented. This function does not appear in your source program, but it is needed to compile your code in the backend. This is a known, current limitation of DPH. If you want it to to work you should send mail to cvs-ghc@haskell.org and ask what you can do to help (it might involve some GHC hacking). I added 'pprSorry' that behaves like 'pprPanic' except it say sorry! instead of panic!, and doesn't ask the user to report a bug.
* Refactoring and tidyup of HscMain and related things (also fix #1666)Simon Marlow2010-10-272-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying to fix #1666 (-Werror aborts too early) I decided to some tidyup in GHC/DriverPipeline/HscMain. - The GhcMonad overloading is gone from DriverPipeline and HscMain now. GhcMonad is now defined in a module of its own, and only used in the top-level GHC layer. DriverPipeline and HscMain use the plain IO monad and take HscEnv as an argument. - WarnLogMonad is gone. printExceptionAndWarnings is now called printException (the old name is deprecated). Session no longer contains warnings. - HscMain has its own little monad that collects warnings, and also plumbs HscEnv around. The idea here is that warnings are collected while we're in HscMain, but on exit from HscMain (any function) we check for warnings and either print them (via log_action, so IDEs can still override the printing), or turn them into an error if -Werror is on. - GhcApiCallbacks is gone, along with GHC.loadWithLogger. Thomas Schilling told me he wasn't using these, and I don't see a good reason to have them. - there's a new pure API to the parser (suggestion from Neil Mitchell): parser :: String -> DynFlags -> FilePath -> Either ErrorMessages (WarningMessages, Located (HsModule RdrName))
* Use new showMultiLineString to fix Trac #4436simonpj@microsoft.com2010-10-251-1/+11
| | | | | | There is an accompanying patch for libraries base template-haskell
* instance Outputable IntMapsimonpj@microsoft.com2010-10-251-2/+4
|
* 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
|