summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen/CgStackery.lhs
Commit message (Collapse)AuthorAgeFilesLines
* Reorganisation of the source treeSimon Marlow2006-04-071-339/+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.
* [project @ 2004-09-30 10:35:15 by simonpj]simonpj2004-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------ Add Generalised Algebraic Data Types ------------------------------------ This rather big commit adds support for GADTs. For example, data Term a where Lit :: Int -> Term Int App :: Term (a->b) -> Term a -> Term b If :: Term Bool -> Term a -> Term a ..etc.. eval :: Term a -> a eval (Lit i) = i eval (App a b) = eval a (eval b) eval (If p q r) | eval p = eval q | otherwise = eval r Lots and lots of of related changes throughout the compiler to make this fit nicely. One important change, only loosely related to GADTs, is that skolem constants in the typechecker are genuinely immutable and constant, so we often get better error messages from the type checker. See TcType.TcTyVarDetails. There's a new module types/Unify.lhs, which has purely-functional unification and matching for Type. This is used both in the typechecker (for type refinement of GADTs) and in Core Lint (also for type refinement).
* [project @ 2004-08-17 15:23:47 by simonpj]simonpj2004-08-171-3/+3
| | | | | | | | | | | | | | | | ------------------------------- Use merge-sort not quicksort Nuke quicksort altogether ------------------------------- Quicksort has O(n**2) behaviour worst case, and this occasionally bites. In particular, when compiling large files consisting only of static data, we get loads of top-level delarations -- and that led to more than half the total compile time being spent in the strongly connected component analysis for the occurrence analyser. Switching to merge sort completely solved the problem. I've nuked quicksort altogether to make sure this does not happen again.
* [project @ 2004-08-13 13:04:50 by simonmar]simonmar2004-08-131-217/+227
| | | | Merge backend-hacking-branch onto HEAD. Yay!
* [project @ 2003-11-17 14:41:58 by simonmar]simonmar2003-11-171-6/+3
| | | | GC dead code.
* [project @ 2002-12-11 15:36:20 by simonmar]simonmar2002-12-111-82/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge the eval-apply-branch on to the HEAD ------------------------------------------ This is a change to GHC's evaluation model in order to ultimately make GHC more portable and to reduce complexity in some areas. At some point we'll update the commentary to describe the new state of the RTS. Pending that, the highlights of this change are: - No more Su. The Su register is gone, update frames are one word smaller. - Slow-entry points and arg checks are gone. Unknown function calls are handled by automatically-generated RTS entry points (AutoApply.hc, generated by the program in utils/genapply). - The stack layout is stricter: there are no "pending arguments" on the stack any more, the stack is always strictly a sequence of stack frames. This means that there's no need for LOOKS_LIKE_GHC_INFO() or LOOKS_LIKE_STATIC_CLOSURE() any more, and GHC doesn't need to know how to find the boundary between the text and data segments (BIG WIN!). - A couple of nasty hacks in the mangler caused by the neet to identify closure ptrs vs. info tables have gone away. - Info tables are a bit more complicated. See InfoTables.h for the details. - As a side effect, GHCi can now deal with polymorphic seq. Some bugs in GHCi which affected primitives and unboxed tuples are now fixed. - Binary sizes are reduced by about 7% on x86. Performance is roughly similar, some programs get faster while some get slower. I've seen GHCi perform worse on some examples, but haven't investigated further yet (GHCi performance *should* be about the same or better in theory). - Internally the code generator is rather better organised. I've moved info-table generation from the NCG into the main codeGen where it is shared with the C back-end; info tables are now emitted as arrays of words in both back-ends. The NCG is one step closer to being able to support profiling. This has all been fairly thoroughly tested, but no doubt I've messed up the commit in some way.
* [project @ 2002-09-13 15:02:25 by simonpj]simonpj2002-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------- Make Template Haskell into the HEAD -------------------------------------- This massive commit transfers to the HEAD all the stuff that Simon and Tim have been doing on Template Haskell. The meta-haskell-branch is no more! WARNING: make sure that you * Update your links if you are using link trees. Some modules have been added, some have gone away. * Do 'make clean' in all library trees. The interface file format has changed, and you can get strange panics (sadly) if GHC tries to read old interface files: e.g. ghc-5.05: panic! (the `impossible' happened, GHC version 5.05): Binary.get(TyClDecl): ForeignType * You need to recompile the rts too; Linker.c has changed However the libraries are almost unaltered; just a tiny change in Base, and to the exports in Prelude. NOTE: so far as TH itself is concerned, expression splices work fine, but declaration splices are not complete. --------------- The main change --------------- The main structural change: renaming and typechecking have to be interleaved, because we can't rename stuff after a declaration splice until after we've typechecked the stuff before (and the splice itself). * Combine the renamer and typecheker monads into one (TcRnMonad, TcRnTypes) These two replace TcMonad and RnMonad * Give them a single 'driver' (TcRnDriver). This driver replaces TcModule.lhs and Rename.lhs * The haskell-src library package has a module Language/Haskell/THSyntax which defines the Haskell data type seen by the TH programmer. * New modules: hsSyn/Convert.hs converts THSyntax -> HsSyn deSugar/DsMeta.hs converts HsSyn -> THSyntax * New module typecheck/TcSplice type-checks Template Haskell splices. ------------- Linking stuff ------------- * ByteCodeLink has been split into ByteCodeLink (which links) ByteCodeAsm (which assembles) * New module ghci/ObjLink is the object-code linker. * compMan/CmLink is removed entirely (was out of place) Ditto CmTypes (which was tiny) * Linker.c initialises the linker when it is first used (no need to call initLinker any more). Template Haskell makes it harder to know when and whether to initialise the linker. ------------------------------------- Gathering the LIE in the type checker ------------------------------------- * Instead of explicitly gathering constraints in the LIE tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE) we now dump the constraints into a mutable varabiable carried by the monad, so we get tcExpr :: RenamedExpr -> TcM TypecheckedExpr Much less clutter in the code, and more efficient too. (Originally suggested by Mark Shields.) ----------------- Remove "SysNames" ----------------- Because the renamer and the type checker were entirely separate, we had to carry some rather tiresome implicit binders (or "SysNames") along inside some of the HsDecl data structures. They were both tiresome and fragile. Now that the typechecker and renamer are more intimately coupled, we can eliminate SysNames (well, mostly... default methods still carry something similar). ------------- Clean up HsPat ------------- One big clean up is this: instead of having two HsPat types (InPat and OutPat), they are now combined into one. This is more consistent with the way that HsExpr etc is handled; there are some 'Out' constructors for the type checker output. So: HsPat.InPat --> HsPat.Pat HsPat.OutPat --> HsPat.Pat No 'pat' type parameter in HsExpr, HsBinds, etc Constructor patterns are nicer now: they use HsPat.HsConDetails for the three cases of constructor patterns: prefix, infix, and record-bindings The *same* data type HsConDetails is used in the type declaration of the data type (HsDecls.TyData) Lots of associated clean-up operations here and there. Less code. Everything is wonderful.
* [project @ 2002-08-29 15:44:11 by simonmar]simonmar2002-08-291-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Housekeeping: - The main goal is to remove dependencies on hslibs for a bootstrapped compiler, leaving only a requirement that the packages base, haskell98 and readline are built in stage 1 in order to bootstrap. We're almost there: Posix is still required for signal handling, but all other dependencies on hslibs are now gone. Uses of Addr and ByteArray/MutableByteArray array are all gone from the compiler. PrimPacked defines the Ptr type for GHC 4.08 (which didn't have it), and it defines simple BA and MBA types to replace uses of ByteArray and MutableByteArray respectively. - Clean up import lists. HsVersions.h now defines macros for some modules which have moved between GHC versions. eg. one now imports 'GLAEXTS' to get at unboxed types and primops in the compiler. Many import lists have been sorted as per the recommendations in the new style guidelines in the commentary. I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and itself, and everything still works here. Doubtless I've got something wrong, though.
* [project @ 2001-10-03 13:57:42 by simonmar]simonmar2001-10-031-5/+6
| | | | | | | | | | | | | | | | Tidy up ghc/includes/Constants and related things. Now all the constants that the compiler needs to know, such as header size, update frame size, info table size and so on are generated automatically into a header file, DeriviedConstants.h, by a small C program in the same way as NativeDefs.h. The C code in the RTS is expected to use sizeof() directly (it already does). Also tidied up the constants in MachDeps.h - all the constants representing the sizes of various types are named SIZEOF_<foo>, to match the constants defined in config.h. PrelStorable.lhs now doesn't contain any special knowledge about GHC's conventions as regards the size of certain types, this is all in MachDeps.h.
* [project @ 2001-09-12 15:52:40 by sewardj]sewardj2001-09-121-2/+3
| | | | | | | | | | | | | | | | | | | | merge (ghc-5-02-branch --> HEAD): Bugfix: there was an implicit assumption that the list of slots passed to freeStackSlots was already sorted, whereas in fact this wasn't the case for at least one call. Now we explicitly sort the list in freeStackSlots, removing the hidden assumption. The symptoms of this bug include crashes (perhaps the "AsmCodeGen" crash), and a tendency to grow the stack a lot when let-no-escapes are involved (because the bug caused fragmentation of the stack free list, so we weren't re-using free slots properly). 1.17.2.1 +3 -2 fptools/ghc/compiler/codeGen/CgStackery.lhs ASSERT that the list of stack slots we calculate in buildLivenessMask is sorted, because we rely on that property later. 1.38.2.1 +5 -6 fptools/ghc/compiler/codeGen/CgBindery.lhs
* [project @ 2001-08-31 12:39:06 by rje]rje2001-08-311-59/+54
| | | | | | | Reapplied my "FCode as a monad" patch, now that 5.02 has forked into a separate branch. I'm fairly sure that this doesn't change the behaviour of anything.
* [project @ 2001-08-30 09:51:15 by sewardj]sewardj2001-08-301-54/+59
| | | | | | | | | | Back out recent changes to the code generator as too destabilising. Revert files as follows: revert to 1.35 CgBindery.lhs revert to 1.26 CgMonad.lhs revert to 1.15 CgStackery.lhs revert to 1.10 CgUsages.lhs
* [project @ 2001-08-29 14:20:14 by rje]rje2001-08-291-59/+54
| | | | | | | | | | | | | | FCode/Code is now a monad, and thus now also a constructed type, rather than a type synonym. This requires quite a lot of changes in quite a lot of files, but none of these changes should have changed the behaviour of anything. Being a Monad allows code that used FCode to be IMHO rather more readable as it can use do notation, and other common Monad idioms. In addition, state has been abstracted away with getter and setter functions, so that functions mess with the innards of FCode as little as possible - making it easier to change FCode in future.
* [project @ 2000-10-24 07:35:00 by simonpj]simonpj2000-10-241-2/+2
| | | | Mainly MkIface
* [project @ 2000-01-14 11:45:21 by hwloidl]hwloidl2000-01-141-3/+3
| | | | Bugfix (raiseError in non-enterable closures); added GranSim code to Schedule.c
* [project @ 2000-01-13 14:33:57 by hwloidl]hwloidl2000-01-131-6/+9
| | | | | Merged GUM-4-04 branch into the main trunk. In particular merged GUM and SMP code. Most of the GranSim code in GUM-4-04 still has to be carried over.
* [project @ 1999-06-24 13:04:13 by simonmar]simonmar1999-06-241-2/+13
| | | | | | - Implement update-in-place in certain very specialised circumstances - Clean up abstract C a bit - Speed up pretty-printing absC a bit.
* [project @ 1999-06-08 15:56:44 by simonmar]simonmar1999-06-081-85/+52
| | | | | | | Allow reserving of stack slots for non-pointer data (eg. cost centres). This means the previous hacks to keep the stack bitmaps correct in the presence of cost centres are now unnecessary, and case-of-case expressions will be compiled properly with profiling on.
* [project @ 1998-12-18 17:40:31 by simonpj]simonpj1998-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | Another big commit from Simon. Actually, the last one didn't all go into the main trunk; because of a CVS glitch it ended up in the wrong branch. So this commit includes: * Scoped type variables * Warnings for unused variables should work now (they didn't before) * Simplifier improvements: - Much better treatment of strict arguments - Better treatment of bottoming Ids - No need for w/w split for fns that are merely strict - Fewer iterations needed, I hope * Less gratuitous renaming in interface files and abs C * OccName is a separate module, and is an abstract data type I think the whole Prelude and Exts libraries compile correctly. Something isn't quite right about typechecking existentials though.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-186/+200
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-01-08 18:03:08 by simonm]simonm1998-01-081-4/+2
| | | | | | | | | | | | | | | | | | | The Great Multi-Parameter Type Classes Merge. Notes from Simon (abridged): * Multi-parameter type classes are fully implemented. * Error messages from the type checker should be noticeably improved * Warnings for unused bindings (-fwarn-unused-names) * many other minor bug fixes. Internally there are the following changes * Removal of Haskell 1.2 compatibility. * Dramatic clean-up of the PprStyle stuff. * The type Type has been substantially changed. * The dictionary for each class is represented by a new data type for that purpose, rather than by a tuple.
* [project @ 1996-06-26 10:26:00 by partain]partain1996-06-261-1/+1
| | | | SLPJ 1.3 changes through 96/06/25
* [project @ 1996-06-05 06:44:31 by partain]partain1996-06-051-1/+1
| | | | SLPJ changes through 960604
* [project @ 1996-05-17 16:02:43 by partain]partain1996-05-171-2/+38
| | | | Sansom 1.3 changes through 960507
* [project @ 1996-04-05 08:26:04 by partain]partain1996-04-051-8/+9
| | | | Add SLPJ/WDP 1.3 changes through 960404
* [project @ 1996-03-19 08:58:34 by partain]partain1996-03-191-11/+10
| | | | simonpj/sansom/partain/dnt 1.3 compiler stuff through 96/03/18
* [project @ 1996-01-11 14:06:51 by partain]partain1996-01-111-1/+1
|
* [project @ 1996-01-08 20:28:12 by partain]partain1996-01-081-0/+264
Initial revision