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
commitf9c71551ad5c233c3ffe19900356f0ecba4f4d38 (patch)
tree89214cadcdcd83b88745a42865d6b2a15bf5f17b
parentcaa68b4eed7f2a4c1f4afc2672915f7ca9de00e8 (diff)
downloadtxr-f9c71551ad5c233c3ffe19900356f0ecba4f4d38.tar.gz
txr-f9c71551ad5c233c3ffe19900356f0ecba4f4d38.tar.bz2
txr-f9c71551ad5c233c3ffe19900356f0ecba4f4d38.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;