summaryrefslogtreecommitdiff
path: root/ghc/includes/Assembler.h
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2000-12-11 12:50:52 by sewardj]sewardj2000-12-111-393/+0
| | | | | Are now redundant since GHCi does bytecode assembly in Haskell-land (fptools/ghc/compiler/ghci/ByteCodeGen.lhs).
* [project @ 2000-12-04 12:31:19 by simonmar]simonmar2000-12-041-2/+1
| | | | merge recent changes from before-ghci-branch onto the HEAD
* [project @ 2000-11-13 14:40:36 by simonmar]simonmar2000-11-131-2/+2
| | | | | | Change the names of several RTS symbols so they don't potentially clash with user code. All the symbols that may clash now have an "stg_" prefix.
* [project @ 2000-10-09 11:18:46 by daan]daan2000-10-091-13/+59
| | | | | | | | | | Lots of changes for Xmlambda. all changes are between #ifdef XMLAMBDA blocks. - new bytecodes for Inj constructors and witnesses - new primops for rows - code for calling foreign functions. This only works with 'dynamic.c' but that is not checked in yet.
* [project @ 2000-08-29 13:34:21 by qrczak]qrczak2000-08-291-2/+2
| | | | | | Don't use a typedef called int64 in RtsAPI. It conflicts with e.g. OCaml's headers. It should be cleaned better...
* [project @ 2000-06-27 09:18:04 by sewardj]sewardj2000-06-271-13/+1
| | | | Fix compilation problems with int64 and nat64.
* [project @ 2000-06-15 13:18:08 by daan]daan2000-06-151-2/+42
| | | | | | | | Added definition of int64 to make it compilable with both gcc and VisualC++ Added functions to the bytecode assembler that support code generation for Xmlambda. All additions for Xmlambda are surrounded by #ifdef XMLAMBDA.
* [project @ 2000-05-09 10:00:35 by sewardj]sewardj2000-05-091-1/+2
| | | | Fix various compile-time warnings in the assembler and evaluator.
* [project @ 2000-04-27 16:35:29 by sewardj]sewardj2000-04-271-33/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A total rewrite of the BCO assembler/linker, and rationalisation of the code management and code generation phases of Hugs. Problems with the old linker: * Didn't have a clean way to insert a pointer to GHC code into a BCO. This meant CAF GC didn't work properly in combined mode. * Leaked memory. Each BCO, caf and constructor generated by Hugs had a corresponding malloc'd record used in its construction. These records existed forever. Pointers from the Hugs symbol tables into the runtime heap always went via these intermediates, for no apparent reason. * A global variable holding a list of top-level stg trees was used during code generation. It was hard to associate trees in this list with entries in the name/tycon tables. Just too many mechanisms. The New World Order is as follows: * The global code list (stgGlobals) is gone. * Each name in the name table has a .closure field. This points to the top-level code for that name. Before bytecode generation this points to a STG tree. During bytecode generation but before bytecode linking it is a MPtr pointing to a malloc'd intermediate structure (an AsmObject). After linking, it is a real live pointer into the execution heap (CPtr) which is treated as a root during GC. Because tuples do not have name table entries, tycons which are tuples also have a .closure field, which is treated identically to those of name table entries. * Each module has a code list -- a list of names and tuples. If you are a name or tuple and you have something (code, CAF or Con) which needs to wind up in the execution heap, you MUST be on your module's code list. Otherwise you won't get code generated. * Lambda lifting generates new name table entries, which of course also wind up on the code list. * The initial phase of code generation for a module m traverses m's code list. The stg trees referenced in the .closure fields are code generated, creating AsmObject (AsmBCO, AsmCAF, AsmCon) in mallocville. The .closure fields then point to these AsmObjects. Since AsmObjects can be mutually recursive, they can contain references to: * Other AsmObjects Asm_RefObject * Existing closures Asm_RefNoOp * name/tycon table entries Asm_RefHugs AsmObjects can also contain BCO insns and non-ptr words. * A second copy-and-link phase copies the AsmObjects into the execution heap, resolves the Asm_Ref* items, and frees up the malloc'd entities. * Minor cleanups in compile-time storage. There are now 3 kinds of address-y things available: CPtr/mkCPtr/cptrOf -- ptrs to Closures, probably in exec heap ie anything which the exec GC knows about MPtr/mkMPtr/mptrOf -- ptrs to mallocville, which the exec GC knows nothing about Addr/mkAddr/addrOf -- literal addresses (like literal ints) * Many hacky cases removed from codegen.c. Referencing code or data during code generation is a lot simpler, since an entity is either: a CPtr, in which case use it as is a MPtr -- stuff it into the AsmObject and the linker will fix it a name or tycon -- ditto * I've checked, using Purify that, at least in standalone mode, no longer leaks mallocd memory. Prior to this it would leak at the rate of about 300k per Prelude. * Added this comment to the top of codegen.c. Still to do: * Reinstate peephole optimisation for BCOs. * Nuke magic number headers in AsmObjects, used for debugging. * Profile and accelerate. Code generation is slower because linking is slower. Evaluation GC is slower because markHugsObjects has slowed down. * Make setCurrentModule ignore name table entries created by the lambda-lifter. * Zap various #if 0's in codegen.c/Assembler.c. * Zap CRUDE_PROFILING.
* [project @ 1999-11-29 18:59:23 by sewardj]sewardj1999-11-291-10/+12
| | | | | | | | | | | | | | | | Make StgHugs use the same naming scheme as GHC does for class + instance machinery. Add machinery to do Z-encoding/decoding of names extracted from interface files. Make the ELF object loader work again. It seemed to have suffered slight bitrot over the past couple of months. Fix various minor bugs. Track a small change in interface file syntax. Make Printer.c print tagged-unboxed stack sections in a decent way now that Alastair-style stack tags have been abandoned.
* [project @ 1999-11-16 17:38:54 by sewardj]sewardj1999-11-161-6/+6
| | | | | Added basic support for MVars: data MVar, and newMVar, putMVar and getMVar.
* [project @ 1999-10-26 17:27:25 by sewardj]sewardj1999-10-261-3/+5
| | | | | | | | | | | | Add foreign import/export implementations for x86 stdcall convention. Make parser notice calling conventions on f-i and f-x declarations, check they are supported on the platform Hugs is compiled on. Pass them all the way through the code generator to the interpreter. Allow f-i/f-x decls to omit the calling convention, in which case ccall is used. Remove calling convention from all such decls in the Prelude so it will work on any platform.
* [project @ 1999-10-19 11:41:35 by sewardj]sewardj1999-10-191-10/+5
| | | | Change CFunDescriptor to match new foreign import implementation.
* [project @ 1999-10-15 11:02:06 by sewardj]sewardj1999-10-151-3/+1
| | | | | | | | | | | | | | | | | | | | | Added basic support for foreign export dynamic. Many aspects of it are still broken: * Only supports x86-linux. * The range of allowable types is small: Char Int Float Double Addr and Word. * Adjustor thunks are never freed. * Returning Doubles or Floats doesn't work at all. I expect to fix some of these shortly. foreign import also needs redoing, so it can accept any number of arguments of any type. Also: * Fixed setRtsFlags in Evaluator.c to make it endian-independent. * Fixed raisePrim in Evaluator.c so things like division by zero, array index errors, etc, throw an exception instead of terminating StgHugs. raisePrim is renamed makeErrorCall.
* [project @ 1999-07-06 16:17:39 by sewardj]sewardj1999-07-061-1/+2
| | | | | Make vectored returns to Hugs work, and make IS_CODE_PTR etc work for dynamically loaded objects.
* [project @ 1999-04-27 10:06:47 by sewardj]sewardj1999-04-271-23/+3
| | | | | | | | | Changes to improve runtime performance of STG Hugs. -- Reorganisation of the evaluator (Evaluator.c). -- Changes to code emission (Assembler.c) to support peephole opts -- An experimental simplifier (optimise.c). -- Many supporting bug fixes and minor changes. -- Experimental implementation of integer for standalone hugs (sainteger.c).
* [project @ 1999-03-01 14:46:42 by sewardj]sewardj1999-03-011-5/+10
| | | | | Mods to make STG-hugs able to compile and run small examples. This commit also includes proper implementations of seq, raise and catch.
* [project @ 1999-02-05 16:02:18 by simonm]simonm1999-02-051-5/+3
| | | | Copyright police.
* [project @ 1999-01-18 15:23:30 by sewardj]sewardj1999-01-181-2/+3
| | | | Completed support for GAMMA_VAR.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-0/+280
Move 4.01 onto the main trunk.