From 506cb6b8dfd3ad55bc0bef4701bbea396e9b05ac Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 15 May 2016 22:29:59 -0700 Subject: 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)))))" --- lib.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib.c') 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; -- cgit v1.2.3