summaryrefslogtreecommitdiff
path: root/src/lisp/ao_lisp_atom.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-11 21:11:13 -0800
committerKeith Packard <keithp@keithp.com>2016-11-17 22:18:39 -0800
commitc8d2b9acf4b118f36a114de2af4db42ae04426ed (patch)
treecd76f44a0da4b71cceae28832ddda0cab0ae1566 /src/lisp/ao_lisp_atom.c
parent7b99963e13f1cf3136c67521c851827377790a06 (diff)
altos/lisp: Make sure memmove only happens once per object. Other GC fixes
The memmove may be overlapping, so make sure it happens only once by just checking whether move_size has been set, rather than looking at ao_lisp_moving; that doesn't get set when moving a noted cons as that still needs to be walked at a later time. Fix up the various looping move functions to all use the same pattern. Atom was busted. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_atom.c')
-rw-r--r--src/lisp/ao_lisp_atom.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lisp/ao_lisp_atom.c b/src/lisp/ao_lisp_atom.c
index efa4f621..e1d9b082 100644
--- a/src/lisp/ao_lisp_atom.c
+++ b/src/lisp/ao_lisp_atom.c
@@ -46,11 +46,19 @@ static void atom_mark(void *addr)
static void atom_move(void *addr)
{
struct ao_lisp_atom *atom = addr;
+ int ret;
for (;;) {
- if (ao_lisp_poly_move(&atom->next, 0))
+ struct ao_lisp_atom *next = ao_lisp_poly_atom(atom->next);
+
+ if (!next)
break;
- atom = ao_lisp_poly_atom(atom->next);
+ ret = ao_lisp_move_memory((void **) &next, atom_size(next));
+ if (next != ao_lisp_poly_atom(atom->next))
+ atom->next = ao_lisp_atom_poly(next);
+ if (ret)
+ break;
+ atom = next;
}
}