This is a patch against bzr trunk 109851, ant it passes the full bootstrap for me. It's also alive with basic editing operations, but most probably will crash quite soon. There isn't too much comments yet, so I tried to write some notices below. * Object life cycle Each object contains 'struct gc_info' which is used to store additional object information. Allocation routines should call gengc_init to initialize 'gcinfo' slot of the object; it should specify correct GC_OBJ_xxx type and one of GC_NEW (if object will be immediately used) or GC_FREE (if the object will join a free list). If an object survives the GC, gengc_promote should be called to adjust object as GC_OLD; if an object dies, gengc_exit should be called for it. * Write barrier The main routine is gengc_write_barrier; convenient wrappers are gengc_object_write_barrier and PTR_BARRIER/VECTOR_BARRIER macros. Inter-generational objects are stored in gengc_objects without duplications; to record special values, Lisp_Misc_Save_Value is (ab)used to hold either interval pointer or Lisp_Object address. The last one (via gengc_record_address) is used when an Lisp_Object slot's address is obtained; since we can't assume what object type will be written to it (and whether something will be written at all), we conservatively assume that GC_NEW object will be written to this slot of GC_OLD object, and so the slot is a subject for marking traversal during generational collection. * Mark/sweep Collection scheduling is fairly simple: each odd collection is generational, and each even collection is full. During generational collection, only GC_NEW objects are marked with mark_object; the same applies to sweeping (gengc_sweep controls it); gengc_collect tries to collect some statistics about objects (set EMACS_GENGC_VERBOSE environment variable to see it). Dmitry