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>2017-02-20 11:16:50 -0800
commit29c890b4599b3bbdbd09a5915ea68a63f4e0a9ac (patch)
tree791966151a186d37ba143d7a56f0f3640add54bd /src/lisp/ao_lisp_atom.c
parentd46ca67f93e9ecbc4d8c051c3fbdead85490b690 (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;
}
}