- 07 Mar, 2006 1 commit
-
-
David Himmelstrup authored
MkIface.writeIfaceFile doesn't check GhcMode anymore. All it does is what the name say: write an interface to disk. I've refactored HscMain so the logic is easier to manage. That means we can avoid running the simplifier when typechecking (: And best of all, HscMain doesn't use GhcMode at all, anymore! The new HscMain intro looks like this: It's the task of the compilation proper to compile Haskell, hs-boot and core files to either byte-code, hard-code (C, asm, Java, ect) or to nothing at all (the module is still parsed and type-checked. This feature is mostly used by IDE's and the likes). Compilation can happen in either 'one-shot', 'batch', 'nothing', or 'interactive' mode. 'One-shot' mode targets hard-code, 'batch' mode targets hard-code, 'nothing' mode targets nothing and 'interactive' mode targets byte-code. The modes are kept separate because of their different types and meanings. In 'one-shot' mode, we're only compiling a single file and can therefore discard the new ModIface and ModDetails. This is also the reason it only targets hard-code; compiling to byte-code or nothing doesn't make sense when we discard the result. 'Batch' mode is like 'one-shot' except that we keep the resulting ModIface and ModDetails. 'Batch' mode doesn't target byte-code since that require us to return the newly compiled byte-code. 'Nothing' mode has exactly the same type as 'batch' mode but they're still kept separate. This is because compiling to nothing is fairly special: We don't output any interface files, we don't run the simplifier and we don't generate any code. 'Interactive' mode is similar to 'batch' mode except that we return the compiled byte-code together with the ModIface and ModDetails.
-
- 04 Mar, 2006 3 commits
-
-
David Himmelstrup authored
-
David Himmelstrup authored
-
David Himmelstrup authored
-
- 02 Mar, 2006 1 commit
-
-
Simon Marlow authored
This turned out to be a lot easier than I thought. Just moving a few bits of -split-objs support from the build system into the compiler was enough. The only thing that Cabal needs to do in order to support -split-objs now is to pass the names of the split objects rather than the monolithic ones to 'ar'.
-
- 24 Feb, 2006 1 commit
-
-
Simon Marlow authored
-
- 06 Jan, 2006 1 commit
-
-
simonmar authored
Add support for UTF-8 source files GHC finally has support for full Unicode in source files. Source files are now assumed to be UTF-8 encoded, and the full range of Unicode characters can be used, with classifications recognised using the implementation from Data.Char. This incedentally means that only the stage2 compiler will recognise Unicode in source files, because I was too lazy to port the unicode classifier code into libcompat. Additionally, the following synonyms for keywords are now recognised: forall symbol (U+2200) forall right arrow (U+2192) -> left arrow (U+2190) <- horizontal ellipsis (U+22EF) .. there are probably more things we could add here. This will break some source files if Latin-1 characters are being used. In most cases this should result in a UTF-8 decoding error. Later on if we want to support more encodings (perhaps with a pragma to specify the encoding), I plan to do it by recoding into UTF-8 before parsing. Internally, there were some pretty big changes: - FastStrings are now stored in UTF-8 - Z-encoding has been moved right to the back end. Previously we used to Z-encode every identifier on the way in for simplicity, and only decode when we needed to show something to the user. Instead, we now keep every string in its UTF-8 encoding, and Z-encode right before printing it out. To avoid Z-encoding the same string multiple times, the Z-encoding is cached inside the FastString the first time it is requested. This speeds up the compiler - I've measured some definite improvement in parsing at least, and I expect compilations overall to be faster too. It also cleans up a lot of cruft from the OccName interface. Z-encoding is nicely hidden inside the Outputable instance for Names & OccNames now. - StringBuffers are UTF-8 too, and are now represented as ForeignPtrs. - I've put together some test cases, not by any means exhaustive, but there are some interesting UTF-8 decoding error cases that aren't obvious. Also, take a look at unicode001.hs for a demo.
-
- 23 Nov, 2005 1 commit
-
-
simonmar authored
make --mk-dll work with --make Submitted by: Esa Ilari Vuokko <eivuokko@gmail.com>, thanks!
-
- 09 Nov, 2005 1 commit
-
-
simonmar authored
oops, it's i386_TARGET_ARCH, not x86_TARGET_ARCH
-
- 08 Nov, 2005 2 commits
-
-
simonmar authored
gcc's -fstrict-aliasing is biting us when we use the stack to store different types of objects. For example: *((StgDouble*)((W_)Sp-8)) = *((StgDouble*)((W_)Sp+8)); Sp[1] = (W_)&s1Cx_info; gcc feels free to reorder these two lines, because they refer to differently typed objects, even though the assignment to Sp[1] clearly aliases the read from the same location. Trying to fix this by accessing locations using union types might be possible, but I took the sledgehammer approach of -fno-strict-aliasing. This is justified to a certain extent because our generated C code is derived from a very weakly-typed internal language (C--).
-
simonmar authored
unless I'm mistaken, only x86 needs -ffloat-store. x86_64 certainly doesn't need it, because it uses SSE2 with the correct-sized floating point registers and doesn't store temporary results with more precision than results in memory.
-
- 30 Oct, 2005 1 commit
-
-
krasimir authored
Change the way in which the .exe suffix to the output file is added. The reason is that "-o main" will generate main.exe on Windows while the doesFileExists "main" in DriverPipeline.link will return False.
-
- 28 Oct, 2005 2 commits
-
-
simonmar authored
Add -stubdir option to control location of generated stub files. Also do some clean up while I'm here - remove hscStubCOut/hscStubHOut from DynFlags, and add mkStubPaths :: DynFlags -> Module -> ModLocation -> (FilePath,FilePath) to Finder. (this seemed better than caching the stub paths in every ModLocation, because they are rarely needed and only present in home modules, and are easily calculated from other available information). -stubdir behaves in exactly the same way as -odir and -hidir.
-
simonmar authored
Fix double "Linking ..." message, and mention the name of the executable in the message.
-
- 25 Oct, 2005 1 commit
-
-
simonmar authored
Two changes from Krasimir Angelov, which were required for Visual Haskell: - messaging cleanup throughout the compiler. DynFlags has a new field: log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO () this action is invoked for every message generated by the compiler. This means a client of the GHC API can direct messages to any destination, or collect them up in an IORef for later perusal. This replaces previous hacks to redirect messages in the GHC API (hence some changes to function types in GHC.hs). - The JustTypecheck mode of GHC now does what it says. It doesn't run any of the compiler passes beyond the typechecker for each module, but does generate the ModIface in order that further modules can be typechecked. And one change from me: - implement the LANGUAGE pragma, finally
-
- 23 Sep, 2005 1 commit
-
-
simonmar authored
in --make mode, don't re-link when the executable is up to date.
-
- 03 Aug, 2005 1 commit
-
-
simonmar authored
Fix the location of _stub.o files when compiling with -odir. The comment from the source: -- The _stub.c file is derived from the haskell source file (but stored -- in hscStubCOutName in the dflags for some reason, probably historical). -- Consequently, we derive the _stub.o filename from the haskell object -- filename. -- -- This isn't necessarily the same as the object filename we -- would get if we just compiled the _stub.c file using the pipeline. -- For example: -- -- ghc src/A.hs -odir obj -- -- results in obj/A.o, and src/A_stub.c. If we compile src/A_stub.c with -- -odir obj, we would get obj/src/A_stub.o, which is wrong; we want -- obj/A_stub.o.
-
- 08 Jul, 2005 1 commit
-
-
simonmar authored
genOutputFilenameFunc: fix output filename generated for non-Haskell compilations with -odir.
-
- 24 May, 2005 1 commit
-
-
simonmar authored
If hsc_lang is HscNothing, produce an empty linkable.
-
- 19 May, 2005 1 commit
-
-
simonpj authored
Tune up the reporting of unused imports Merge to STABLE (I think the earlier change made it across) (PS: the commit also does some trimming of redundant imports. If they don't merge, just discard them.) My earlier fixes to the reporting of unused imports still missed some obscure cases, some of which are now fixed by this commit. I had to make the import-provenance data type yet richer, but in fact it has more sharing now, so it may be cheaper on space. There's still one infelicity. Consider import M( x ) imoprt N( x ) where the same underlying 'x' is involved in both cases. Currently we don't report a redundant import, because dropping either import would change the qualified names in scope (M.x, N.x). But if the qualified names aren't used, the import is indeed redundant. Sadly we don't know that, because we only know what Names are used. Left for the future! There's a comment in RnNames.warnDuplicateImports This commit also trims quite a few redundant imports disovered by the new setup.
-
- 17 May, 2005 1 commit
-
-
simonmar authored
Improve source locations on error messages from the downsweep. We now keep track of SrcSpans from import declarations, so we can report a proper source location for unknown imports (this improves on the previous hacky solution of keeping track of the filename that contained the original import declaration). ModSummary now contains (Located Module) for each import instead of Module.
-
- 16 May, 2005 1 commit
-
-
simonmar authored
Implement -x <suffix> flag to override the suffix of a filename for the purposes of determinig how it should be compiled. The usage is similar to gcc, except that we just use a suffix rather than a name for the language. eg. ghc -c -x hs hello.blah will pretend hello.blah is a .hs file. Another possible use is -x hspp, which skips preprocessing. This works for one-shot compilation, --make, GHCi, and ghc -e. The original idea was to make it possible to use runghc on a file that doesn't end in .hs, so changes to runghc will follow. Also, I made it possible to specify .c files and other kinds of files on the --make command line; these will be compiled to objects as normal and linked into the final executable. GHC API change: I had to extend the Target type to include an optional start phase, and also GHC.guessTarget now takes a (Maybe Phase) argument. I thought this would be half an hour, in fact it took half a day, and I still haven't documented it. Sigh.
-
- 28 Apr, 2005 1 commit
-
-
simonpj authored
This big commit does several things at once (aeroplane hacking) which change the format of interface files. So you'll need to recompile your libraries! 1. The "stupid theta" of a newtype declaration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Retain the "stupid theta" in a newtype declaration. For some reason this was being discarded, and putting it back in meant changing TyCon and IfaceSyn slightly. 2. Overlap flags travel with the instance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Arrange that the ability to support overlap and incoherence is a property of the *instance declaration* rather than the module that imports the instance decl. This allows a library writer to define overlapping instance decls without the library client having to know. The implementation is that in an Instance we store the overlap flag, and preseve that across interface files 3. Nuke the "instnce pool" and "rule pool" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A major tidy-up and simplification of the way that instances and rules are sucked in from interface files. Up till now an instance decl has been held in a "pool" until its "gates" (a set of Names) are in play, when the instance is typechecked and added to the InstEnv in the ExternalPackageState. This is complicated and error-prone; it's easy to suck in too few (and miss an instance) or too many (and thereby be forced to suck in its type constructors, etc). Now, as we load an instance from an interface files, we put it straight in the InstEnv... but the Instance we put in the InstEnv has some Names (the "rough-match" names) that can be used on lookup to say "this Instance can't match". The detailed dfun is only read lazily, and the rough-match thing meansn it is'nt poked on until it has a chance of being needed. This simply continues the successful idea for Ids, whereby they are loaded straightaway into the TypeEnv, but their TyThing is a lazy thunk, not poked on until the thing is looked up. Just the same idea applies to Rules. On the way, I made CoreRule and Instance into full-blown records with lots of info, with the same kind of key status as TyCon or DataCon or Class. And got rid of IdCoreRule altogether. It's all much more solid and uniform, but it meant touching a *lot* of modules. 4. Allow instance decls in hs-boot files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Allowing instance decls in hs-boot files is jolly useful, becuase in a big mutually-recursive bunch of data types, you want to give the instances with the data type declarations. To achieve this * The hs-boot file makes a provisional name for the dict-fun, something like $fx9. * When checking the "mother module", we check that the instance declarations line up (by type) and generate bindings for the boot dfuns, such as $fx9 = $f2 where $f2 is the dfun generated by the mother module * In doing this I decided that it's cleaner to have DFunIds get their final External Name at birth. To do that they need a stable OccName, so I have an integer-valued dfun-name-supply in the TcM monad. That keeps it simple. This feature is hardly tested yet. 5. Tidy up tidying, and Iface file generation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main/TidyPgm now has two entry points: simpleTidyPgm is for hi-boot files, when typechecking only (not yet implemented), and potentially when compiling without -O. It ignores the bindings, and generates a nice small TypeEnv. optTidyPgm is the normal case: compiling with -O. It generates a TypeEnv rich in IdInfo MkIface.mkIface now only generates a ModIface. A separate procedure, MkIface.writeIfaceFile, writes the file out to disk.
-
- 19 Apr, 2005 1 commit
-
-
simonmar authored
- DriverPipeline.compile: report errors in GHC_OPTIONS pragmas using the Message callback, and give them a proper line number. - GHC.checkModule: read the GHC_OPTIONS pragma, and report errors appropriately.
-
- 13 Apr, 2005 2 commits
-
-
wolfgang authored
Make the status messages from ghc --make display the number of modules to be compiled, as in: [3 of 9] Compiling Foo.hs ( Foo.hs, Foo.o )
-
simonmar authored
Add : loadMsg :: Session -> LoadHowMuch -> (Messages-> IO ()) -> IO SuccessFlag ie. just like load, except it takes a message callback and plumbs it down to hscMain. checkModule now uses loadMsgs. Better name suggestions welcome.
-
- 05 Apr, 2005 1 commit
-
-
krasimir authored
In many places there was a common pattern when (verbose >= n) $ putMsg "..." It is now replaced with debutTraceMsg dflags n "..." In few places hPutStrLn stderr or putStrLn was used instead of putMsg in the above pattern. They are replaced too. Now putMsg is used only in places where the verbosity flag was not checked.
-
- 31 Mar, 2005 2 commits
-
-
simonmar authored
DriverPipeline.compile: we should be grabbing the OPTIONS from the StringBuffer, not reading the file again (duh!) SysTools: some message cleanups
-
simonmar authored
Tweaks to get the GHC sources through Haddock. Doesn't quite work yet, because Haddock complains about the recursive modules. Haddock needs to understand SOURCE imports (it can probably just ignore them as a first attempt).
-
- 30 Mar, 2005 2 commits
-
-
simonmar authored
Add support for partial reloads in the GHC API. This is mainly for VS: when editing a file you don't want to continually reload the entire project whenever the current file changes, you want to reload up to and including the current file only. However, you also want to retain any other modules in the session that are still stable. I added a variant of :reload in GHCi to test this. You can say ':reload M' to reload up to module M only. This will bring M up to date, and throw away any invalidated modules from the session.
-
sof authored
Avoid a (rather verbose) GHC warning from being issued -- initialize the runPhase.mod_summary.ms_obj_date field.
-
- 28 Mar, 2005 1 commit
-
-
wolfgang authored
Track recent dynamic flags changes; fixes the build for Mac OS X.
-
- 24 Mar, 2005 1 commit
-
-
simonmar authored
Cleanup the upsweep strategy in GHC.load. Now it's hopefully clearer how we decide what modules to recompile, and which are "stable" (not even looked at) during a reload. See the comments for details. Also, I've taken some trouble to explicitly prune out things that aren't required before a reload, which should reduce the memory requirements for :reload in GHCi. Currently I believe it keeps most of the old program until the reload is complete, now it shouldn't require any extra memory.
-
- 22 Mar, 2005 1 commit
-
-
simonmar authored
A start on the GHC API: Flesh out the GHC module so that it can replace CompManager. Now, the clients that used CompManager consume the GHC API instead (namely Main, DriverMkDepend, and InteractiveUI). Main is significantly cleaner as a result. The interface needs more work: in particular, getInfo returns results in the form of IfaceDecls but we want to use full HsSyn and Id/DataCon/Class across the boundary instead. The interfaces for inspecting loaded modules are not yet implemented.
-
- 21 Mar, 2005 1 commit
-
-
simonmar authored
Complete the transition of -split-objs into a dynamic flag (looks like I half-finished it in the last commit). Also: complete the transition of -tmpdir into a dynamic flag, which involves some rearrangement of code from SysTools into DynFlags. Someday, initSysTools should move wholesale into initDynFlags, because most of the state that it initialises is now part of the DynFlags structure, and the rest could be moved in easily.
-
- 18 Mar, 2005 1 commit
-
-
simonmar authored
Flags cleanup. Basically the purpose of this commit is to move more of the compiler's global state into DynFlags, which is moving in the direction we need to go for the GHC API which can have multiple active sessions supported by a single GHC instance. Before: $ grep 'global_var' */*hs | wc -l 78 After: $ grep 'global_var' */*hs | wc -l 27 Well, it's an improvement. Most of what's left won't really affect our ability to host multiple sessions. Lots of static flags have become dynamic flags (yay!). Notably lots of flags that we used to think of as "driver" flags, like -I and -L, are now dynamic. The most notable static flags left behind are the "way" flags, eg. -prof. It would be nice to fix this, but it isn't urgent. On the way, lots of cleanup has happened. Everything related to static and dynamic flags lives in StaticFlags and DynFlags respectively, and they share a common command-line parser library in CmdLineParser. The flags related to modes (--makde, --interactive etc.) are now private to the front end: in fact private to Main itself, for now.
-
- 04 Mar, 2005 1 commit
-
-
simonmar authored
We shouldn't be including ghcconfig.h here
-
- 14 Feb, 2005 1 commit
-
-
simonmar authored
Put the GlobalRdrEnv back into the ModIface, so it gets preserved when we reload a module without recompiling it.
-
- 02 Feb, 2005 1 commit
-
-
simonmar authored
Fix isLinkMode and adjust formatting a little
-
- 01 Feb, 2005 1 commit
-
-
simonmar authored
Fix the source_unchanged test in the Hsc phase
-