| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Bye bye STG Hugs!
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
Minor wurbles to make it compile on Cygwin following DietHEPpery.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Removing the duplex #include "Storage.h"
|
|
|
|
| |
Reorder tests in whatIs() to try for most common options first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
print(STAR) wibble.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Changing PrimPrel to PrelPrim.
|
|
|
|
|
| |
Clean up the storage manager a little, and reinstate the compile time
garbage collector. Then pray.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
identToStr(): use whatIs(), not fst in switch.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Fixing problem withn "Prelude> take.P" which was causing Hugs to crash.
The new abstraction for the Text segment was not being observed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Reimplement interrupt handling in a way compatible with the
revised module chaser, etc.
|
|
|
|
| |
Fix various bugs with module chasing and reloading.
|
|
|
|
|
| |
Make Hugs compile on Win32 again after recent changes. Also, rename
prelude.h to hugsbasictypes.h to avoid conflicts with includes/Prelude.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Further cleanups of connect.h. Also, zap the Args macro. We really
don't need to support K&R C any more.
|
|
|
|
| |
Update .c files to reflect reorganisation of .h files in this directory.
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
| |
Complete the initial implementation and debugging of the Win32 PE
(PEi386) linker.
|
|
|
|
| |
Nuke PTR_ON_HEAP and all associated ifdeffery; we always need it.
|
|
|
|
| |
primUnpackString --> hugsprimUnpackString
|
|
|
|
|
|
| |
Wibbles for Win32 standalone compilation of Hugs:
-- Turn off debugging miniinterpreter
-- Change SIZEOF_INTP (which no longer exists) into SIZEOF_VOID_P
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
-- 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.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Handle tuple types (,,,) --> Z3T in enZcodeThenFindText().
|
|
|
|
| |
Supply correct kinds for tycons created by addWiredInBoxingTycon().
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Back out previous commit.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
---------------------------------------------------------------------
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
| |
Update Hugs' knowledge of the GHC Prelude to track recent Prelude changes.
|
|
|
|
|
|
|
| |
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.
|