summaryrefslogtreecommitdiff
path: root/ghc/interpreter/connect.h
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2001-01-17 15:23:39 by sewardj]sewardj2001-01-171-1000/+0
| | | | Bye bye STG Hugs!
* [project @ 2000-06-28 10:42:17 by sewardj]sewardj2000-06-281-3/+5
| | | | | | | | | Partially fix signal (control-C) handling under mingw32. The interpreter can now be interrupted and successfully returns to the Hugs prompt, but only if Hugs was started from cmd.exe and not by bash (!). This is a known bogon with Cygwin, according to Sigbjorn. I still can't get Hugs to ignore other control-C's; instead it acts as if it was asked to exit. Bizarre.
* [project @ 2000-05-26 10:14:33 by sewardj]sewardj2000-05-261-3/+11
| | | | | | | | | Changes to allow Hugs to be built with mingw32, not cygwin. Also, updates so that DietHEP works properly for mingw32. Most changes are trivial (assert --> ASSERT), etc. For hugs, have deleted queries about the width of a terminal window, and so the printing of dots as progress indicators is gone too. No great loss. Zapped various other out-of-date platform-specific junk in machdep.c.
* [project @ 2000-05-12 11:59:38 by sewardj]sewardj2000-05-121-2/+3
| | | | | First try at support for DietHEP. Has some unfindable bug which causes it to fail when hugs.c is compiled -O; works fine without -O.
* [project @ 2000-05-10 09:00:20 by sewardj]sewardj2000-05-101-16/+2
| | | | | Zap CRUDE_PROFILING. It was there mainly to test assess the effect of the simplifier; is redundant.
* [project @ 2000-04-27 16:35:29 by sewardj]sewardj2000-04-271-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10 09:40:03 by sewardj]sewardj2000-04-101-15/+2
| | | | | Nuke USE_REGISTRY and all the code it protects. We can reinstate this stuff later if we so decide.
* [project @ 2000-04-06 00:01:26 by andy]andy2000-04-061-4/+4
| | | | Changing PrimPrel to PrelPrim.
* [project @ 2000-04-04 17:35:04 by sewardj]sewardj2000-04-041-2/+5
| | | | | Restore ability to load a script which doesn't have a module header, ie doesn't start module M where ...
* [project @ 2000-04-04 15:41:56 by sewardj]sewardj2000-04-041-2/+4
| | | | | | | | | | | | | | | | * 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 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-03-24 14:32:03 by sewardj]sewardj2000-03-241-29/+21
| | | | | Reimplement interrupt handling in a way compatible with the revised module chaser, etc.
* [project @ 2000-03-22 18:14:22 by sewardj]sewardj2000-03-221-23/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-20 04:26:23 by andy]andy2000-03-201-2/+5
| | | | | | | Second attack at supporting threads inside STG Hugs. We now support most of the concurrency primitives. Also a wibble in Evaluator.c, letting Hugs compile.
* [project @ 2000-03-15 23:27:16 by andy]andy2000-03-151-2/+16
| | | | | | | | | | Adding in internal support for assert, that gives optional assertion messages with file and line numbers. Changing the default build style to stand alone. Thinking: People building the combined system are likly to be hackers already, so can make a one line change. We should discuss this...
* [project @ 2000-03-14 14:34:47 by sewardj]sewardj2000-03-141-2/+4
| | | | | | Update Hugs so as to work with the new way of referencing Prelude symbols from the RTS. The main action is in fixupRTStoPreludeRefs() in rts/Prelude.c.
* [project @ 2000-03-13 11:37:16 by sewardj]sewardj2000-03-131-323/+314
| | | | | 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 19:50:44 by sewardj]sewardj2000-03-101-157/+609
| | | | | | Major cleanup of header files. Merge the 5 deleted files into connect.h. Organise connect.h to gather declarations into roughtly related categories.
* [project @ 2000-03-10 17:30:36 by lewie]lewie2000-03-101-6/+2
| | | | | | | | 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-7/+10
| | | | | | Compilation cleanups: * Add some prototypes to header files, to avoid compilation warnings. * Remove irrelevant #ifdeffery (#if NPLUSK, + various others)
* [project @ 2000-03-09 02:47:13 by andy]andy2000-03-091-3/+3
| | | | | | | | | Changing name of linkPreludeNames to linkPrimitiveNames (cause that is what it does). Adding a Hugs extension "import privileged". This will allow us to remove the many exports from the prelude of the primitive functions and types, but still allow us to write libraries that use it.
* [project @ 2000-01-07 16:56:47 by sewardj]sewardj2000-01-071-3/+3
| | | | | | | | 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 @ 1999-12-20 16:55:26 by sewardj]sewardj1999-12-201-3/+5
| | | | | | | | | | | | | | | | | | * Fix silly bugs in new linker, object.[ch]. * Allow modules to have arbitrary numbers of "extra" object files as well as their primary object file. Initial requirement is that Prelude needs libHS_cbits.o/.dll as well as Prelude.o module(m).object is the primary object module(m).objectExtras are the extra objects module(m).objectExtraNames :: [Text] are their names. Modify machdep.c to assume that extra objects for module M live in the same directory as M's primary object. * Stuff 130ish symbol names into the RTS symbol table, enough so that the whole Prelude can be linked. That includes symbols in the C library needed by libHS_cbits. This is very hacky and needs to be fixed properly.
* [project @ 1999-12-10 15:59:41 by sewardj]sewardj1999-12-101-29/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major improvements in interface processing, and minor supporting improvements to CT-storage management. * Make the iface parser return the complete interface as a single tree, which is processed later. Added abs syntax tags I_INTERFACE .. I_VALUE to support this. * Add tagged ("z") 2,3,4,5 tuples. Because they are tagged, they can't be confused with lists, etc. Selectors zfst, zsnd ... zsel45, zsel55 check tags first. Iface processing uses z-tuples wherever it can. * Add unap as a safe "inverse" of ap; it checks tags. So unap(TAG1, ap(TAG2,cell)) == cell but only if TAG1==TAG2, else assertion failure. * In interface.c, clean up the startGHC*/endGHC* functions. processInterfaces() is the top-level driver; it makes 4 passes over the supplied iface trees. * Throw away iface symbols not mentioned in export lists. * Use iface export lists to construct both the export and eval environments for a module. * Don't use Texts to refer to things. Instead use ConId and VarId. Added ConId and VarId as synonyms for Cell in storage.h. * Add findSimpleInstance in storage.c.
* [project @ 1999-12-03 17:56:04 by sewardj]sewardj1999-12-031-7/+2
| | | | Remove some hooks into the Prelude which Hugs no longer needs to know about.
* [project @ 1999-11-29 18:59:23 by sewardj]sewardj1999-11-291-5/+6
| | | | | | | | | | | | | | | | 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-25 10:19:15 by sewardj]sewardj1999-11-251-2/+5
| | | | | Don't guess where the installation directory is. Instead, read it from the STGHUGSDIR env var at startup.
* [project @ 1999-11-23 15:12:04 by andy]andy1999-11-231-2/+3
| | | | | Changing the top level evaluator so it runs things of type IO a, not just IO <monomorphic-thing>.
* [project @ 1999-11-17 16:57:38 by andy]andy1999-11-171-2/+10
| | | | Merging in the various changes between Sep99 Hugs and Nov99 Hugs.
* [project @ 1999-11-12 17:32:36 by sewardj]sewardj1999-11-121-4/+2
| | | | | Delete optimiser.c (the simplifier) and all supporting bits and pieces.
* [project @ 1999-10-29 11:41:04 by sewardj]sewardj1999-10-291-2/+3
| | | | Basic #ifdeffery to make StgHugs compile out of the box on cygwin.
* [project @ 1999-10-26 17:27:25 by sewardj]sewardj1999-10-261-4/+7
| | | | | | | | | | | | 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-20 02:15:56 by andy]andy1999-10-201-4/+23
| | | | | Adding final diffs between Hugs98 (Jan99) and Hugs98 (Sep99) manually to STG Hugs.
* [project @ 1999-10-16 02:17:25 by andy]andy1999-10-161-5/+14
| | | | | | | Adding diffs between Hugs98 (Jan99) and Hugs98 (Sep99) manually to STG Hugs. Brings in large change to typechecking sub-system.
* [project @ 1999-10-15 23:52:00 by andy]andy1999-10-151-2/+3
| | | | | | | | Adding diffs between Hugs98 (Jan99) and Hugs98 (Sep99) manually to STG Hugs. These are the changes to input.c, with minor tweeks to connect.h and parser.y to make this work.
* [project @ 1999-10-15 21:40:49 by andy]andy1999-10-151-7/+9
| | | | Updating all copyright messages to the same as Hugs98.
* [project @ 1999-10-15 11:02:06 by sewardj]sewardj1999-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | 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-06-07 17:22:31 by sewardj]sewardj1999-06-071-2/+33
| | | | | | | Many changes needed to support loading of GHC compiled code. The main changes are to parser.y and interface.c to load .hi files and create appropriate symbol table entries. Also, interface.c has the beginnings of and ELF loader/linker in it.
* [project @ 1999-04-27 10:06:47 by sewardj]sewardj1999-04-271-69/+9
| | | | | | | | | 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-09 14:51:03 by sewardj]sewardj1999-03-091-4/+3
| | | | | | | | | | Many improvements resulting from first attempt to run nofib suite: -- More libraries (lib/*.hs) brought into operation -- Prelude error handling and basic I/O improved -- Changed bytecode immediate value fields so large constant -- tables can be compiled -- Fixed bugs: translation of FATBAR, negative floating point -- literals, strict constructors, handling of CAFs
* [project @ 1999-03-01 14:46:42 by sewardj]sewardj1999-03-011-4/+31
| | | | | 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-03 17:08:25 by sewardj]sewardj1999-02-031-18/+507
| | | | | Preliminary results of the merge of STG hugs and 990121. These files will compile and link, but don't work yet.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-0/+45
Move 4.01 onto the main trunk.