summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-15 22:29:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-15 22:29:59 -0700
commit506cb6b8dfd3ad55bc0bef4701bbea396e9b05ac (patch)
tree89214cadcdcd83b88745a42865d6b2a15bf5f17b
parent85e4b2948071d4b219dd8de1b1acf5b131deb156 (diff)
downloadtxr-506cb6b8dfd3ad55bc0bef4701bbea396e9b05ac.tar.gz
txr-506cb6b8dfd3ad55bc0bef4701bbea396e9b05ac.tar.bz2
txr-506cb6b8dfd3ad55bc0bef4701bbea396e9b05ac.zip
Bugfix: recycled conses play nice with gen GC.
* lib.c (cons): When we recycle a cons, it could be already in the mature generation. In that case, baby objects stored in its car or cdr violate the integrity of the heap. We must hint about this to the garbage collector. Test case: ./txr --gc-debug -p "(list* 'foo (zip '(a) (repeat '((gensym)))))"
-rw-r--r--lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index abcce6ba..64a22b68 100644
--- a/lib.c
+++ b/lib.c
@@ -2501,6 +2501,9 @@ val cons(val car, val cdr)
if (recycled_conses) {
obj = recycled_conses;
recycled_conses = recycled_conses->c.cdr;
+#if CONFIG_GEN_GC
+ gc_mutated(obj);
+#endif
} else {
obj = make_obj();
obj->c.type = CONS;