| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Bye bye STG Hugs!
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Zap CRUDE_PROFILING. It was there mainly to test assess the effect of
the simplifier; is redundant.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
o Adding simple counter for number of enters
o Inc version number
o Adding the start of support for mdo
o Wibble
|
|
|
|
|
| |
Nuke USE_REGISTRY and all the code it protects. We can reinstate this
stuff later if we so decide.
|
|
|
|
| |
Changing PrimPrel to PrelPrim.
|
|
|
|
|
| |
Restore ability to load a script which doesn't have a module header,
ie doesn't start module M where ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Reimplement interrupt handling in a way compatible with the
revised module chaser, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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...
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Further cleanups of connect.h. Also, zap the Args macro. We really
don't need to support K&R C any more.
|
|
|
|
|
|
| |
Major cleanup of header files. Merge the 5 deleted files into connect.h.
Organise connect.h to gather declarations into roughtly related
categories.
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
Compilation cleanups:
* Add some prototypes to header files, to avoid compilation warnings.
* Remove irrelevant #ifdeffery (#if NPLUSK, + various others)
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Remove some hooks into the Prelude which Hugs no longer needs to know about.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Don't guess where the installation directory is. Instead,
read it from the STGHUGSDIR env var at startup.
|
|
|
|
|
| |
Changing the top level evaluator so it runs things
of type IO a, not just IO <monomorphic-thing>.
|
|
|
|
| |
Merging in the various changes between Sep99 Hugs and Nov99 Hugs.
|
|
|
|
|
| |
Delete optimiser.c (the simplifier) and all supporting bits and
pieces.
|
|
|
|
| |
Basic #ifdeffery to make StgHugs compile out of the box on cygwin.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Adding final diffs between Hugs98 (Jan99) and Hugs98 (Sep99)
manually to STG Hugs.
|
|
|
|
|
|
|
| |
Adding diffs between Hugs98 (Jan99) and Hugs98 (Sep99)
manually to STG Hugs.
Brings in large change to typechecking sub-system.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Updating all copyright messages to the same as Hugs98.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Mods to make STG-hugs able to compile and run small examples. This
commit also includes proper implementations of seq, raise and catch.
|
|
|
|
|
| |
Preliminary results of the merge of STG hugs and 990121. These files
will compile and link, but don't work yet.
|
|
Move 4.01 onto the main trunk.
|