>>>> "R" == Richard
<reingrub(a)informatik.uni-tuebingen.de> writes:
R> Hi,
R> I'm currently working on a new Representation for ELisp data objects
R> in order to get them more abstract and have GC and the other XEmacs
R> modules decoupled.
Welcome.
Over the years I've done a lot of thinking about garbage collection,
but not a lot of action. I like the idea of a real generational gc
very much.
R> With the new representation, data objects are either binary or contain
R> only descriptors (a descriptor is a tagged datum, in XEmacs source its
R> C type is Lisp_Object). This gives the GC the information needed to
R> traverse the reachability graph of live objects. The mark_object
R> method of a class of objects will be obsolete.
Guile used the strange idea of making every lisp object contain
exactly two descriptors. Of course this works well for cons cells,
but seems unnatural for other objects. But it makes memory
allocation very easy.
R> Outside the GC objects should be only accessed through provided
R> selector and mutator macros/functions. This will help to implement a
R> write barrier, needed for the generational GC.
You should be aware that some folks have created their own lisp object
types in external modules.
R> An example is the new representation of Lisp_Compiled_Function:
R> #define XCF_SPECPDL_DEPTH(f) \
R> (unsigned) XINT (XCOMPILED_FUNCTION (f)->specpdl_depth)
The type EMACSINT is probably the right type to use for the result of
XINT. On 64-bit machines, Lisp_Objects will have 64 bits, but ints
will typically only have 32.
Since there are 50 different lisp object types, in a production system
we'll probably want long macro names like
XCOMPILED_FUNCTION_STACK_DEPTH()
and
XSET_COMPILED_FUNCTION_STACK_DEPTH()
Ben and I have discussed, but never quite implemented, a set of inline
functions (can't be macros) to replace things like
struct buffer *buf;
{
Lisp_Object buffer;
XSETBUFFER(buffer, bufp);
return buffer;
}
with something like
return buffer_to_object (buf);
but we've disagreed on the naming scheme for these functions.
As to the goals of the project, I assume it is to reduce memory
footprint for the xemacs process. Unused lisp objects can be paged to
disk and mostly stay there?
Good luck implementing the new GC!
Martin