summaryrefslogtreecommitdiff
path: root/src/lisp/ao_lisp_cons.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-10 23:29:21 -0800
committerKeith Packard <keithp@keithp.com>2016-11-17 22:18:39 -0800
commit654a34e72e28bfa52f26ed0be3bef63dfb50bba6 (patch)
tree0a2198463ee176e29a20a55413eac561e35b4c0a /src/lisp/ao_lisp_cons.c
parentcc50f9628431c13c556de8e54788264a5f653f54 (diff)
altos/lisp: Deal with memory compation in the middle of operations
Handle memory compaction in places where we've got pointers into the heap across an allocation operation. Either re-compute the values from managed global references or add new roots across the allocation. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_cons.c')
-rw-r--r--src/lisp/ao_lisp_cons.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lisp/ao_lisp_cons.c b/src/lisp/ao_lisp_cons.c
index 855079b8..cd8a8d1d 100644
--- a/src/lisp/ao_lisp_cons.c
+++ b/src/lisp/ao_lisp_cons.c
@@ -67,7 +67,13 @@ const struct ao_lisp_type ao_lisp_cons_type = {
struct ao_lisp_cons *
ao_lisp_cons_cons(ao_poly car, struct ao_lisp_cons *cdr)
{
- struct ao_lisp_cons *cons = ao_lisp_alloc(sizeof (struct ao_lisp_cons));
+ struct ao_lisp_cons *cons;
+
+ ao_lisp_root_add(&ao_lisp_cons_type, &cdr);
+ ao_lisp_root_poly_add(&car);
+ cons = ao_lisp_alloc(sizeof (struct ao_lisp_cons));
+ ao_lisp_root_clear(&car);
+ ao_lisp_root_clear(&cdr);
if (!cons)
return NULL;
cons->car = car;