diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-04-03 16:10:59 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-04-03 16:10:59 -0700 |
commit | 2561b623c178a08de9cdcda35a5a5fc8f83bdaf7 (patch) | |
tree | 48b8680a29c1b872a4c44e1b1d555cbe894e9536 /lib.h | |
parent | 1ce504148e960fa8fdd3701977786b99a7437f57 (diff) | |
download | txr-2561b623c178a08de9cdcda35a5a5fc8f83bdaf7.tar.gz txr-2561b623c178a08de9cdcda35a5a5fc8f83bdaf7.tar.bz2 txr-2561b623c178a08de9cdcda35a5a5fc8f83bdaf7.zip |
Generational GC showing signs of working. One test case in
test suite fails.
* gc.c (FRESHQ_SIZE): New preprocessor symbol.
(backptr_oflow, freshq, freshq_head, freshq_tail): New static
variables.
(make_obj): Place newly allocated generation 0 object into
freshq. If freshq becomes full, transfer oldest item into
generation 1.
(mark_obj): If doing only a partial gc, then do not mark
objects which are not generation 0.
(mark_mem_region): Valgrind support: cannot mark t.type field undefined
because it is a bitfield. Just mark the first SIZEOF_PTR bytes
of the object defined.
(mark): Under partial gc, mark the table of back pointers.
(sweep_one): New static function from the prior guts of sweep.
Reachable objects now get promoted to generation 1.
(sweep): Under partial gc, sweep just the freshq which identifies
the generation 0 objects, rather than the entire linked list of all the
heaps.
(gc): Trigger full gc also if the backptr list has overflowed
due to gc having been disabled.
Under generational gc, reset the static variables afterward:
clear the list of backpointers, and the freshq.
(gc_is_reachable): Under partial gc, report any mature object
as reachable.
(gc_set, gc_mutated): Handle backptr array overflow situation
when gc is disabled.
(gc_push): Bugfix: it is the newly pushed cons cell that has to be
marked as a root, not the value being pushed.
* hash.c (sethash): Use set macro for storing value.
* lib.h (set, mut, mpush): Fix wrong-way #if test for these macros.
The trivial versions were being defined uner CONFIG_GEN_GC and vice
versa!
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -229,13 +229,14 @@ union obj { }; #if CONFIG_GEN_GC -#define set(place, val) ((place) = (val)) -#define mut(obj) -#define mpush(val, place) (push(val, &(place))) -#else +val gc_set(val *, val); #define set(place, val) (gc_set(&(place), val)) #define mut(obj) (gc_mutated(obj)); #define mpush(val, place) (gc_push(val, &(place))) +#else +#define set(place, val) ((place) = (val)) +#define mut(obj) +#define mpush(val, place) (push(val, &(place))) #endif INLINE cnum tag(val obj) { return ((cnum) obj) & TAG_MASK; } |