summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
Commit message (Collapse)AuthorAgeFilesLines
* Reorganisation of the source treeSimon Marlow2006-04-0733-10447/+0
| | | | | | | | | | | | | | | Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.
* Allow C argument regs to be used as global regs (R1, R2, etc.)Simon Marlow2006-02-282-44/+78
| | | | | | | | | | The problem here was that we generated C calls with expressions involving R1 etc. as parameters. When some of the R registers are also C argument registers, both GCC and the native code generator generate incorrect code. The hacky workaround is to assign problematic arguments to temporaries first; fortunately this works with both GCC and the NCG, but we have to be careful not to undo this with later optimisations (see changes to CmmOpt).
* pass arguments to unknown function calls in registersSimon Marlow2006-02-282-45/+45
| | | | | | | | | | | | | | | We now have more stg_ap entry points: stg_ap_*_fast, which take arguments in registers according to the platform calling convention. This is faster if the function being called is evaluated and has the right arity, which is the common case (see the eval/apply paper for measurements). We still need the stg_ap_*_info entry points for stack-based application, such as an overflows when a function is applied to too many argumnets. The stg_ap_*_fast functions actually just check for an evaluated function, and if they don't find one, push the args on the stack and invoke stg_ap_*_info. (this might be slightly slower in some cases, but not the common case).
* turn off a traceSimon Marlow2006-02-241-1/+1
|
* change dirty_MUT_VAR() to use recordMutableCap()Simon Marlow2006-02-091-1/+2
| | | | rather than recordMutableGen(), the former works better in SMP
* make the smp way RTS-only, normal libraries now work with -smpSimon Marlow2006-02-085-40/+24
| | | | | | | | | | | | | | We had to bite the bullet here and add an extra word to every thunk, to enable running ordinary libraries on SMP. Otherwise, we would have needed to ship an extra set of libraries with GHC 6.6 in addition to the two sets we already ship (normal + profiled), and all Cabal packages would have to be compiled for SMP too. We decided it best just to take the hit now, making SMP easily accessible to everyone in GHC 6.6. Incedentally, although this increases allocation by around 12% on average, the performance hit is around 5%, and much less if your inner loop doesn't use any laziness.
* make the par# primop actually do somethingSimon Marlow2006-01-241-2/+18
|
* [project @ 2006-01-17 16:13:18 by simonmar]simonmar2006-01-171-2/+11
| | | | | | | | | | | | | | | | | | | | | | | Improve the GC behaviour of IORefs (see Ticket #650). This is a small change to the way IORefs interact with the GC, which should improve GC performance for programs with plenty of IORefs. Previously we had a single closure type for mutable variables, MUT_VAR. Mutable variables were *always* on the mutable list in older generations, and always traversed on every GC. Now, we have two closure types: MUT_VAR_CLEAN and MUT_VAR_DIRTY. The latter is on the mutable list, but the former is not. (NB. this differs from MUT_ARR_PTRS_CLEAN and MUT_ARR_PTRS_DIRTY, both of which are on the mutable list). writeMutVar# now implements a write barrier, by calling dirty_MUT_VAR() in the runtime, that does the necessary modification of MUT_VAR_CLEAN into MUT_VAR_DIRY, and adding to the mutable list if necessary. This results in some pretty dramatic speedups for GHC itself. I've just measureed a 30% overall speedup compiling a 31-module program (anna) with the default heap settings :-D
* [project @ 2006-01-17 16:03:47 by simonmar]simonmar2006-01-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Improve the GC behaviour of IOArrays/STArrays See Ticket #650 This is a small change to the way mutable arrays interact with the GC, that can have a dramatic effect on performance, and make tricks with unsafeThaw/unsafeFreeze redundant. Data.HashTable should be faster now (I haven't measured it yet). We now have two mutable array closure types, MUT_ARR_PTRS_CLEAN and MUT_ARR_PTRS_DIRTY. Both are on the mutable list if the array is in an old generation. writeArray# sets the type to MUT_ARR_PTRS_DIRTY. The garbage collector can set the type to MUT_ARR_PTRS_CLEAN if it finds that no element of the array points into a younger generation (discovering this required a small addition to evacuate(), but rough tests indicate that it doesn't measurably affect performance). NOTE: none of this affects unboxed arrays (IOUArray/STUArray), only boxed arrays (IOArray/STArray). We could go further and extend the DIRTY bit to be per-block rather than for the whole array, but for now this is an easy improvement.
* [project @ 2006-01-10 14:47:23 by simonmar]simonmar2006-01-101-1/+1
| | | | Fix a comment
* [project @ 2006-01-10 14:46:50 by simonmar]simonmar2006-01-101-6/+6
| | | | | Char primops: the Char# rep is wordRep, not I32 (fixed -dcmm-lint problems on x86_64)
* [project @ 2006-01-09 10:31:14 by simonmar]simonmar2006-01-091-3/+2
| | | | ord# and chr# should be no-ops, not conversions between wordRep and I32.
* [project @ 2006-01-06 16:30:17 by simonmar]simonmar2006-01-063-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [project @ 2005-11-16 12:55:58 by simonpj]simonpj2005-11-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two significant changes to the representation of types 1. Change the representation of type synonyms Up to now, type synonym applications have been held in *both* expanded *and* un-expanded form. Unfortunately, this has exponential (!) behaviour when type synonyms are deeply nested. E.g. type P a b = (a,b) f :: P a (P b (P c (P d e))) This showed up in a program of Joel Reymont, now immortalised as typecheck/should_compile/syn-perf.hs So now synonyms are held as ordinary TyConApps, and expanded only on demand. SynNote has disappeared altogether, so the only remaining TyNote is a FTVNote. I'm not sure if it's even useful. 2. Eta-reduce newtypes See the Note [Newtype eta] in TyCon.lhs If we have newtype T a b = MkT (S a b) then, in Core land, we would like S = T, even though the application of T is then not saturated. This commit eta-reduces T's RHS, and keeps that inside the TyCon (in nt_etad_rhs). Result is that coreEqType can be simpler, and has less need of expanding newtypes.
* [project @ 2005-10-28 11:35:35 by simonmar]simonmar2005-10-281-8/+4
| | | | | | | | | | | | Change the default executable name to match the basename of the source file containing the Main module (or the module specified by -main-is), if there is one. On Windows, the .exe extension is added. As requested on the ghc-users list, and as implemented by Tomasz Zielonka <tomasz.zielonka at gmail.com>, with modifications by me. I changed the type of the mainModIs field of DynFlags from Maybe String to Module, which removed some duplicate code.
* [project @ 2005-10-27 00:21:24 by sof]sof2005-10-271-2/+2
| | | | emitForeignCall: avoid CC warnings by hinting that resume/suspendThread id arg is a ptr
* [project @ 2005-08-02 12:02:16 by simonmar]simonmar2005-08-021-0/+1
| | | | Add a ToDo
* [project @ 2005-07-25 14:12:48 by simonmar]simonmar2005-07-252-39/+2
| | | | | | Remove the ForeignObj# type, and all its PrimOps. The new efficient representation of ForeignPtr doesn't use ForeignObj# underneath, and there seems no need to keep it.
* [project @ 2005-07-07 13:50:40 by simonmar]simonmar2005-07-071-2/+2
| | | | | | | small performance fix: in via-C mode we previously always created a switch instead of an conditional-tree for a multi-branch case. Refine this slightly so that 2-branch switches turn into conditionals again, since gcc doesn't do a good job of optimising the equivalent switch.
* [project @ 2005-06-21 10:44:37 by simonmar]simonmar2005-06-2110-97/+104
| | | | | | | | | | | | | | | | | | | | | | | Relax the restrictions on conflicting packages. This should address many of the traps that people have been falling into with the current package story. Now, a local module can shadow a module in an exposed package, as long as the package is not otherwise required by the program. GHC checks for conflicts when it knows the dependencies of the module being compiled. Also, we now check for module conflicts in exposed packages only when importing a module: if an import can be satisfied from multiple packages, that's an error. It's not possible to prevent GHC from starting by installing packages now (unless you install another base package). It seems to be possible to confuse GHCi by having a local module shadowing a package module that goes away and comes back again. I think it's nearly right, but strange happenings have been observed. I'll try to merge this into the STABLE branch.
* [project @ 2005-05-18 12:06:51 by simonmar]simonmar2005-05-181-15/+6
| | | | revert rev. 1.71
* [project @ 2005-05-18 04:02:39 by wolfgang]wolfgang2005-05-182-29/+16
| | | | | Use constructor functions instead of stginit functions on Win32, too. (stginit functions are still used for profiling)
* [project @ 2005-05-17 13:47:39 by simonmar]simonmar2005-05-171-4/+8
| | | | | | closureDescription: remove duplicate module name for external names, and include the unique for local names. This makes profiling with -hd more uesful.
* [project @ 2005-05-17 12:22:37 by simonmar]simonmar2005-05-171-1/+1
| | | | | | Profiling: the type_descr and closure_descr were the wrong way around, so +RTS -hy behaves like +RTS -hd, and vice-versa. How on earth that happened I have no idea.
* [project @ 2005-05-15 03:20:29 by wolfgang]wolfgang2005-05-151-29/+31
| | | | | Reinstate __stginit_Foo functions even when they don't do anything, because they are part of the documented interface (as discussed on cvs-ghc, Apr 26).
* [project @ 2005-05-12 11:11:58 by simonmar]simonmar2005-05-121-4/+11
| | | | | SMP: we need to assign the result of resumeThread to BaseReg, because we might now have a new Capability. (this was an interesting bug to find...)
* [project @ 2005-04-28 16:05:54 by simonpj]simonpj2005-04-281-6/+3
| | | | | | | | | Re-plumb the connections between TidyPgm and the various code generators. There's a new type, CgGuts, to mediate this, which has the happy effect that ModGuts can die earlier. The non-O route still isn't quite right, because default methods are being lost. I'm working on it.
* [project @ 2005-04-28 15:28:05 by simonmar]simonmar2005-04-281-0/+2
| | | | | | Small code-size optimisation: I forgot to add a specialised case for functions with no argument words (which might happen if the function takes a void argument, for example).
* [project @ 2005-04-28 10:09:41 by simonpj]simonpj2005-04-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [project @ 2005-04-27 09:54:26 by simonmar]simonmar2005-04-271-1/+1
| | | | Fix the volatile regs to the suspendThread call
* [project @ 2005-04-22 16:01:53 by sof]sof2005-04-221-3/+23
| | | | | | Until the GHCi linker is made capable of handling .ctors sections in PEi object files, stick with __stginits. Being a bit sloppy by using 'mingw32_HOST_OS' to test for this.
* [project @ 2005-04-21 15:28:20 by simonmar]simonmar2005-04-214-63/+96
| | | | | | SMP: thunks get an extra header word so that the payload doesn't occupy the same space as the updated value. This is the sum total of the changes to compiler/, which are pleasingly few.
* [project @ 2005-04-15 05:29:48 by wolfgang]wolfgang2005-04-151-16/+4
| | | | | | Initialise foreign exports from GNU C __attribute__((constructor)) functions in the stub C file, rather than from __stginit_ functions. For non-profiling ways, leave out __stginit_ alltogether.
* [project @ 2005-04-12 19:58:56 by wolfgang]wolfgang2005-04-121-1/+4
| | | | | | Dynamic Linking: On non-Win32, we can store cross-dylib pointers in static data, so disable a Win32-specific hack on the other platforms, to prevent code bloat.
* [project @ 2005-04-11 08:52:29 by simonmar]simonmar2005-04-111-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | When generating a switch for: case e of 0 -> A 1 -> B instead of generating if (e < 1) then goto A B generate if (e >= 1) then goto B A because this helps the NCG to generate better code. In particular, if e is a comparison, then we don't need to reverse the sense of the comparison to eliminate the comparse against 1 (the NCG does try to reverse the comparison, but floating-point comparisons can't be reversed).
* [project @ 2005-04-07 12:39:56 by simonmar]simonmar2005-04-071-1/+1
| | | | The arg to suspendThread should have a "ptr" hint
* [project @ 2005-03-31 10:16:33 by simonmar]simonmar2005-03-3110-32/+32
| | | | | | | 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).
* [project @ 2005-03-24 15:22:33 by simonmar]simonmar2005-03-241-4/+8
| | | | tweaks to a (commented-out) trace message
* [project @ 2005-03-21 10:50:22 by simonmar]simonmar2005-03-211-7/+7
| | | | | | | | | | | | 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.
* [project @ 2005-03-18 13:37:27 by simonmar]simonmar2005-03-1814-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [project @ 2005-03-18 11:19:27 by simonmar]simonmar2005-03-181-12/+16
| | | | | | | | merge rev. 1.6.2.1, simplified slightly: Initialise a CostCentreStack by generating SIZEOF_CostCentreStack (gotten from the C compiler) zeros, padded to the nearest word. Improves on the previous fixes for unpredictable padding (see comment).
* [project @ 2005-03-17 12:45:08 by simonmar]simonmar2005-03-171-2/+2
| | | | | Rearrange the fields of CostCentreStack to leave no (or less) room for arbitrary padding decisions by C compilers.
* [project @ 2005-02-22 10:58:22 by simonmar]simonmar2005-02-221-13/+29
| | | | | | emitSwitch: if we're compiling via C, then always generate a switch rather than an if-tree. This should work around brokenness in older versions of GCC.
* [project @ 2005-02-10 13:01:52 by simonmar]simonmar2005-02-103-20/+32
| | | | | | | | | | | | | | | | | | | | | | | GC changes: instead of threading old-generation mutable lists through objects in the heap, keep it in a separate flat array. This has some advantages: - the IND_OLDGEN object is now only 2 words, so the minimum size of a THUNK is now 2 words instead of 3. This saves some amount of allocation (about 2% on average according to my measurements), and is more friendly to the cache by squashing objects together more. - keeping the mutable list separate from the IND object will be necessary for our multiprocessor implementation. - removing the mut_link field makes the layout of some objects more uniform, leading to less complexity and special cases. - I also unified the two mutable lists (mut_once_list and mut_list) into a single mutable list, which lead to more simplifications in the GC.
* [project @ 2005-02-01 15:34:00 by simonmar]simonmar2005-02-011-1/+0
| | | | whitespace
* [project @ 2005-02-01 15:33:14 by simonmar]simonmar2005-02-011-4/+12
| | | | | hack upon the hack: confine the hack to -fasm, because gcc is too stupid to optimise away the extra temporary.
* [project @ 2005-02-01 15:08:06 by simonmar]simonmar2005-02-011-2/+7
| | | | | small perf hack in emitVectoredReturnInstr: work around lack of CSE in the NCG by assigning info_amode to a new temporary.
* [project @ 2005-01-28 12:55:17 by simonmar]simonmar2005-01-282-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rationalise the BUILD,HOST,TARGET defines. Recall that: - build is the platform we're building on - host is the platform we're running on - target is the platform we're generating code for The change is that now we take these definitions as applying from the point of view of the particular source code being built, rather than the point of view of the whole build tree. For example, in RTS and library code, we were previously testing the TARGET platform. But under the new rule, the platform on which this code is going to run is the HOST platform. TARGET only makes sense in the compiler sources. In practical terms, this means that the values of BUILD, HOST & TARGET may vary depending on which part of the build tree we are in. Actual changes: - new file: includes/ghcplatform.h contains platform defines for the RTS and library code. - new file: includes/ghcautoconf.h contains the autoconf settings only (HAVE_BLAH). This is so that we can get hold of these settings independently of the platform defines when necessary (eg. in GHC). - ghcconfig.h now #includes both ghcplatform.h and ghcautoconf.h. - MachRegs.h, which is included into both the compiler and the RTS, now has to cope with the fact that it might need to test either _TARGET_ or _HOST_ depending on the context. - the compiler's Makefile now generates stage{1,2,3}/ghc_boot_platform.h which contains platform defines for the compiler. These differ depending on the stage, of course: in stage2, the HOST is the TARGET of stage1. This was wrong before. - The compiler doesn't get platform info from Config.hs any more. Previously it did (sometimes), but unless we want to generate a new Config.hs for each stage we can't do this. - GHC now helpfully defines *_{BUILD,HOST}_{OS,ARCH} automatically in CPP'd Haskell source. - ghcplatform.h defines *_TARGET_* for backwards compatibility (ghcplatform.h is included by ghcconfig.h, which is included by config.h, so code which still #includes config.h will get the TARGET settings as before). - The Users's Guide is updated to mention *_HOST_* rather than *_TARGET_*. - coding-style.html in the commentary now contains a section on platform defines. There are further doc updates to come. Thanks to Wolfgang Thaller for pointing me in the right direction.
* [project @ 2005-01-27 11:12:52 by simonpj]simonpj2005-01-275-21/+0
| | | | | | | | | | Remove redundant .hi-boot files. The earliest compiler we claim to be able to compile GHC with is GHC 5, and that needs hi-boot-5 boot files. So the plain hi-boot files are dead. Reason for removing them now is that my big commit accidentally splatted them with binary data; so if you ever want to recover them, go back one revision beore the one I'm deleting.
* [project @ 2005-01-27 10:44:00 by simonpj]simonpj2005-01-275-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------------- Replace hi-boot files with hs-boot files -------------------------------------------- This major commit completely re-organises the way that recursive modules are dealt with. * It should have NO EFFECT if you do not use recursive modules * It is a BREAKING CHANGE if you do ====== Warning: .hi-file format has changed, so if you are ====== updating into an existing HEAD build, you'll ====== need to make clean and re-make The details: [documentation still to be done] * Recursive loops are now broken with Foo.hs-boot (or Foo.lhs-boot), not Foo.hi-boot * An hs-boot files is a proper source file. It is compiled just like a regular Haskell source file: ghc Foo.hs generates Foo.hi, Foo.o ghc Foo.hs-boot generates Foo.hi-boot, Foo.o-boot * hs-boot files are precisely a subset of Haskell. In particular: - they have the same import, export, and scoping rules - errors (such as kind errors) in hs-boot files are checked You do *not* need to mention the "original" name of something in an hs-boot file, any more than you do in any other Haskell module. * The Foo.hi-boot file generated by compiling Foo.hs-boot is a machine- generated interface file, in precisely the same format as Foo.hi * When compiling Foo.hs, its exports are checked for compatibility with Foo.hi-boot (previously generated by compiling Foo.hs-boot) * The dependency analyser (ghc -M) knows about Foo.hs-boot files, and generates appropriate dependencies. For regular source files it generates Foo.o : Foo.hs Foo.o : Baz.hi -- Foo.hs imports Baz Foo.o : Bog.hi-boot -- Foo.hs source-imports Bog For a hs-boot file it generates similar dependencies Bog.o-boot : Bog.hs-boot Bog.o-boot : Nib.hi -- Bog.hs-boto imports Nib * ghc -M is also enhanced to use the compilation manager dependency chasing, so that ghc -M Main will usually do the job. No need to enumerate all the source files. * The -c flag is no longer a "compiler mode". It simply means "omit the link step", and synonymous with -no-link.