summaryrefslogtreecommitdiff
path: root/ghc/interpreter/storage.c
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2001-01-17 15:23:39 by sewardj]sewardj2001-01-171-3387/+0
| | | | Bye bye STG Hugs!
* [project @ 2000-06-23 13:13:10 by sewardj]sewardj2000-06-231-9/+11
| | | | | | | | markHugsObjects() and lookupSection(): don't use debugging versions of macros module(), name(), tycon(), etc, even when debugging. Also, in lookupSection(), return immediately when not in combined mode. Together, these dramatically reduce the cost of GC in Hugs (by about a factor of 15 for nofib/real/anna).
* [project @ 2000-05-12 13:34:06 by sewardj]sewardj2000-05-121-3/+9
| | | | Minor wurbles to make it compile on Cygwin following DietHEPpery.
* [project @ 2000-05-10 09:02:25 by sewardj]sewardj2000-05-101-3/+4
| | | | | | Allow the c-t storage manager to reuse dead symbol table slots, as had always been intended, but up to now has been disabled due to ultra-paranoid debugging.
* [project @ 2000-05-09 17:38:19 by andy]andy2000-05-091-3/+2
| | | | Removing the duplex #include "Storage.h"
* [project @ 2000-05-09 09:11:40 by sewardj]sewardj2000-05-091-57/+11
| | | | Reorder tests in whatIs() to try for most common options first.
* [project @ 2000-04-27 16:35:29 by sewardj]sewardj2000-04-271-32/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 @ 2000-04-25 17:43:49 by andy]andy2000-04-251-2/+3
| | | | | | | o Adding simple counter for number of enters o Inc version number o Adding the start of support for mdo o Wibble
* [project @ 2000-04-14 15:18:05 by sewardj]sewardj2000-04-141-5/+13
| | | | | | Clean up the runtime heap before deleting modules (and, currently, after every evaluation) so that the combined system can safely throw away modules and info tables without creating dangling refs from the heap.
* [project @ 2000-04-12 09:37:19 by sewardj]sewardj2000-04-121-2/+23
| | | | | More infotable cleanups: zap the debugging table of info table names. This can be cleanly done by looking at the .itbl field on Names and Tycons.
* [project @ 2000-04-11 16:36:53 by sewardj]sewardj2000-04-111-4/+17
| | | | | | | Ensure that when Hugs decides to unload a module (nukeModule()), there are no closures anywhere in the system which refers to infotables defined in that module. That means reverting all CAFs and doing a major GC prior to deleting the module. A flag is used to avoid redundant GCs.
* [project @ 2000-04-07 16:25:19 by sewardj]sewardj2000-04-071-2/+27
| | | | | | | | If an object symbol is not found via the usual methods, search absolutely every object symbol table in the system before giving up on it. Motivation: searching for Arch_x86_foobar_closure generates a search for x86_foobar_closure in module Arch, whereas we really want to search for foobar_closure in module Arch_x86. Sigh.
* [project @ 2000-04-07 09:58:34 by sewardj]sewardj2000-04-071-3/+3
| | | | print(STAR) wibble.
* [project @ 2000-04-06 15:05:30 by sewardj]sewardj2000-04-061-2/+3
| | | | | | | More constructors-with-context fixes: * Don't inline bytecode constructor calls if constructor has a context * Fix bug in startGHCDataDecl which caused loss of context in iface constructor types.
* [project @ 2000-04-06 14:23:55 by sewardj]sewardj2000-04-061-4/+13
| | | | | | | Align Hugs' constructor-building with that of GHC. Always pass dictionaries to the constructor function, even if they are ignored. Generate a constructor function which expects dictionaries. And ignore dictionaries in constructor types when desugaring patterns containing them.
* [project @ 2000-04-06 00:01:26 by andy]andy2000-04-061-3/+3
| | | | Changing PrimPrel to PrelPrim.
* [project @ 2000-04-05 16:57:18 by sewardj]sewardj2000-04-051-94/+72
| | | | | Clean up the storage manager a little, and reinstate the compile time garbage collector. Then pray.
* [project @ 2000-04-05 10:25:08 by sewardj]sewardj2000-04-051-2/+3
| | | | | | | | Correctly handle constructors with strict fields, which was broken by overenthusiastic constructor inlining some time back: * notice if a constructor has strict fields, and set name(n).hasStrict, both for source modules and interfaces * if a constr has strict fields, do not inline applications of it
* [project @ 2000-04-04 15:41:56 by sewardj]sewardj2000-04-041-3/+3
| | | | | | | | | | | | | | | | * Enforce downward closure rule (first attempt :-) If both object and source of a module are available, be simple and choose the more recent. If that causes a subsequent violation of the DCR, complain to the user at the time the violation is detected. The alternative is to have a clever algorithm which makes clever choices now to avoid conflicts later, but that looks complicated to do, and I think it would also confuse users. * As a side effect of the above, enforce the rule that the Prelude must be all source or all object, but not a combination. * Rationalise signature and semantics for findFilesForModule, so as to make client code simpler.
* [project @ 2000-04-04 11:24:48 by sewardj]sewardj2000-04-041-3/+3
| | | | identToStr(): use whatIs(), not fst in switch.
* [project @ 2000-04-04 01:07:49 by andy]andy2000-04-041-4/+4
| | | | | | | Adding in support for split Hugs Prelude. There are now two preludes. (1) PrimPrel - the Prelude defintions, and the extra magic datatypes. (2) Prelude - the external interface for Prelude.
* [project @ 2000-04-03 23:43:13 by andy]andy2000-04-031-3/+3
| | | | | Fixing problem withn "Prelude> take.P" which was causing Hugs to crash. The new abstraction for the Text segment was not being observed.
* [project @ 2000-03-31 04:13:27 by andy]andy2000-03-311-10/+11
| | | | | | | | | | | | | | Fixing a couple of problems with Quantified identifiers. (1) The string building routine for Qid's was not using the new abstraction for showing names. The old abstraction worked most of the time in the new system, so was only getting tickled sometimes. (2) Fixing the local module that top level expressions evaluate in. By importing quantified Prelude, this allows top level expressions like Prelude.take And a trivial Makefile change.
* [project @ 2000-03-30 09:02:12 by andy]andy2000-03-301-3/+3
| | | | | | | | | | | | | Fixing bug with import privileged clashing with import hidden. This caused a rather nasty name-leak, where catch from the prelude was being given the type of catch from Exceptions. Now, when you use import privileged Prelude (...) you also need to do import Prelude, allowing you the option of import Prelude hiding (...). A bucket load of wibbles will follow in various libraries, implementing this restriction.
* [project @ 2000-03-24 14:32:03 by sewardj]sewardj2000-03-241-4/+6
| | | | | Reimplement interrupt handling in a way compatible with the revised module chaser, etc.
* [project @ 2000-03-24 12:36:43 by sewardj]sewardj2000-03-241-5/+5
| | | | Fix various bugs with module chasing and reloading.
* [project @ 2000-03-23 14:54:20 by sewardj]sewardj2000-03-231-3/+3
| | | | | Make Hugs compile on Win32 again after recent changes. Also, rename prelude.h to hugsbasictypes.h to avoid conflicts with includes/Prelude.h.
* [project @ 2000-03-22 18:14:22 by sewardj]sewardj2000-03-221-761/+752
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial commit of major changes to module chasing and storage management: * Total reimplementation of module chasing (see achieveTargetModules in hugs.c). Build, maintain and use module dependency graphs to decide what needs reloading when. The old mechanism with a stack of scripts, etc, is gone forever. All the rest of these points are in support of the module-chasing change: * The result of parsing a module is now a parse tree, rather than a half-baked parse tree and a bunch of side-effects. Hooray! * Redo symbol tables for Names, Tycons, Classes, Instances and Modules. They are now dynamically expandable, doubling in size automatically when full, and use a freelist system to keep track of available slots. * Allow arbitrary modules to be deleted from the system. The main honcho here is nukeModule(). * Not strictly necessary, but ... unify the address space for all compile-time entities. See revised whatIs(). Text is part of the unified address space. This is very convenient for debugging. print() can now print practically anything. Generally simplify storage management as much as possible, and zap the years of elaborate hacks needed to make Hugs work well in 16-bit systems. Added a load of sanity-checking support to storage.[ch]. * We don't support project files any more. They were useful for a while, but no longer seem relevant. * Nuked a large bunch of irrelevant options in rts/options.h. As of this commit, the system can load and chase modules, both in standalone and combined modes. The :l (load), :a (also), :r (refresh), :i (info), :t (show type) and :m (set eval module) commands appear to work. There are also several temporary limitations which will be fixed soon: * Anything to do with external editors, etc, doesn't work. * The downward-closure-of-object-code (if M is object, all modules below M must be too) is not enforced nor checked for. It needs to be. * Module M _must_ reside in M.hs/M.o (sigh). To be fixed. * Error handling is probably flaky, and interrupt handling very likely is. * Error messages don't have line numbers. (A 5-minute fix). * Progress messages are all at sea; needs re-thinking now that the order in which things are done is radically different. * Compile-time GC is temporarily disabled whilst I figure out how to stress-test the GC. * Freed-up symbol table entries are never re-entered on the free lists -- a debugging measure. * :% is given a bad type in combined mode. To be investigated.
* [project @ 2000-03-13 11:37:16 by sewardj]sewardj2000-03-131-24/+21
| | | | | Further cleanups of connect.h. Also, zap the Args macro. We really don't need to support K&R C any more.
* [project @ 2000-03-10 20:03:36 by sewardj]sewardj2000-03-101-84/+2
| | | | Update .c files to reflect reorganisation of .h files in this directory.
* [project @ 2000-03-10 17:30:36 by lewie]lewie2000-03-101-2/+4
| | | | | | | | First stab at reviving TREX - just fixing some header wibbles. Also one small fix to get implicit parameters working (`textOf' needed to be taught that IPCELLs are also OK). Moved #defines for TREX, IPARAM, etc, into options.h (in their previous location at the end of prelude.h, they were being defined too late).
* [project @ 2000-03-10 14:53:00 by sewardj]sewardj2000-03-101-9/+3
| | | | | | Compilation cleanups: * Add some prototypes to header files, to avoid compilation warnings. * Remove irrelevant #ifdeffery (#if NPLUSK, + various others)
* [project @ 2000-03-07 16:18:25 by sewardj]sewardj2000-03-071-2/+8
| | | | | Complete the initial implementation and debugging of the Win32 PE (PEi386) linker.
* [project @ 2000-02-25 10:53:53 by sewardj]sewardj2000-02-251-10/+25
| | | | Nuke PTR_ON_HEAP and all associated ifdeffery; we always need it.
* [project @ 2000-02-24 17:26:12 by sewardj]sewardj2000-02-241-3/+6
| | | | primUnpackString --> hugsprimUnpackString
* [project @ 2000-02-24 14:05:55 by sewardj]sewardj2000-02-241-4/+4
| | | | | | Wibbles for Win32 standalone compilation of Hugs: -- Turn off debugging miniinterpreter -- Change SIZEOF_INTP (which no longer exists) into SIZEOF_VOID_P
* [project @ 2000-02-15 13:16:19 by sewardj]sewardj2000-02-151-4/+5
| | | | | | | | | Backend interop fixes: -- Make Hugs use the same constructor tag numbering as GHC, viz, starting at zero. -- Evaluator.c: when unwinding the stack on entering a constructor, return to the scheduler if a RET_{VEC_}{SMALL|BIG} is found on the stack.
* [project @ 2000-02-08 17:50:46 by sewardj]sewardj2000-02-081-9/+19
| | | | | | | -- finishGHCClass(): fill in the .number fields for members in the correct order. -- Let nullary constructors be called via their _closure labels so they don't get heap-allocated.
* [project @ 2000-02-08 15:32:29 by sewardj]sewardj2000-02-081-5/+148
| | | | | | | Many bug fixes for object loading: -- create class symbol table entries more correctly -- find GHC-created info tables for names which are constructors -- add debugging machinery: :d <entity> and symbol-table printers
* [project @ 2000-01-12 14:52:53 by sewardj]sewardj2000-01-121-7/+9
| | | | | | | | Clear up confusion regarding names of tuple types. -- (), coded as Z0T, is the unit. -- (,), coded as Z1T, is the pair type. -- (,,,N commas,,,) coded as ZNT, is the (N+1)-tuple type. -- There is no 1-ary type type.
* [project @ 2000-01-11 17:23:39 by sewardj]sewardj2000-01-111-2/+15
| | | | Handle tuple types (,,,) --> Z3T in enZcodeThenFindText().
* [project @ 2000-01-11 15:40:57 by sewardj]sewardj2000-01-111-12/+13
| | | | Supply correct kinds for tycons created by addWiredInBoxingTycon().
* [project @ 2000-01-11 14:51:43 by sewardj]sewardj2000-01-111-10/+21
| | | | | | nameFromOPtr(): don't try to search object sym tables for source modules lookupSection(): ditto, plus don't forget to also look in module(m).objectExtras
* [project @ 2000-01-10 17:19:32 by sewardj]sewardj2000-01-101-2/+2
| | | | Back out previous commit.
* [project @ 2000-01-10 17:06:41 by sewardj]sewardj2000-01-101-2/+2
| | | | | | | | | | | | This is the missing log message for the commit by sewardj at 2000/01/10 08:23:33 PST for these files: Some names in the standalone Prelude are referred to during desugaring in Hugs. These functions therefore need to be supplied from the GHC world in combined mode. Rename the relevant functions from primXYZ to hugsprimXYZ to distinguish them, in preparation for create of ghc/lib/std/PrelHugs.lhs. ---------------------------------------------------------------------
* [project @ 2000-01-10 16:23:32 by sewardj]sewardj2000-01-101-2/+25
|
* [project @ 2000-01-07 17:49:29 by sewardj]sewardj2000-01-071-5/+13
| | | | | | | type.c: implement typechecker(POSTPREL), so that initialisation of the typechecker is completed correctly in combined mode. storage.c(addTupleTycon): create a name table entry for () so that nameUnit in the above can be bound to something.
* [project @ 2000-01-07 16:56:47 by sewardj]sewardj2000-01-071-4/+4
| | | | | | | | storage.c: unZcode tuple types (eg Z4T) correctly (off by one) interface.c(startGHCClass): remember to do dictapsToQualtype on class member types (processInterfaces): return a Bool if Prelude.hi was processed, so we can know when to do everybody(POSTPREL)
* [project @ 2000-01-06 16:33:10 by sewardj]sewardj2000-01-061-3/+3
| | | | Update Hugs' knowledge of the GHC Prelude to track recent Prelude changes.
* [project @ 2000-01-05 15:57:40 by sewardj]sewardj2000-01-051-6/+15
| | | | | | | Remember to add entities to module(m).names/.tycons/.classes as well as to module(m).exports. Otherwise the 'eval environment' will be wrong. Add assertions in storage.c for addName/addTycon/addClass.