summaryrefslogtreecommitdiff
path: root/src/lisp/ao_lisp_atom.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-14 18:45:12 -0800
committerKeith Packard <keithp@keithp.com>2017-02-20 11:16:50 -0800
commitddb4b8d90478ae324aa207a7541352c1ac9451ee (patch)
tree9f069fea8113178eedf9e4714bfea98538f818e5 /src/lisp/ao_lisp_atom.c
parentaffcf6ffc08313151541993ee543bfe390165e81 (diff)
altos/lisp: Change GC to do moves in batches of 32
This should make it quite a bit faster than doing one at a time. 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.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lisp/ao_lisp_atom.c b/src/lisp/ao_lisp_atom.c
index e1d9b082..6705f140 100644
--- a/src/lisp/ao_lisp_atom.c
+++ b/src/lisp/ao_lisp_atom.c
@@ -38,7 +38,7 @@ static void atom_mark(void *addr)
atom = ao_lisp_poly_atom(atom->next);
if (!atom)
break;
- if (ao_lisp_mark_memory(atom, atom_size(atom)))
+ if (ao_lisp_mark_memory(&ao_lisp_atom_type, atom))
break;
}
}
@@ -53,7 +53,7 @@ static void atom_move(void *addr)
if (!next)
break;
- ret = ao_lisp_move_memory((void **) &next, atom_size(next));
+ ret = ao_lisp_move_memory(&ao_lisp_atom_type, (void **) &next);
if (next != ao_lisp_poly_atom(atom->next))
atom->next = ao_lisp_atom_poly(next);
if (ret)
@@ -66,6 +66,7 @@ const struct ao_lisp_type ao_lisp_atom_type = {
.mark = atom_mark,
.size = atom_size,
.move = atom_move,
+ .name = "atom"
};
struct ao_lisp_atom *ao_lisp_atoms;
@@ -85,12 +86,12 @@ ao_lisp_atom_intern(char *name)
return atom;
}
#endif
+ ao_lisp_string_stash(0, name);
atom = ao_lisp_alloc(name_size(name));
+ name = ao_lisp_string_fetch(0);
if (atom) {
atom->type = AO_LISP_ATOM;
atom->next = ao_lisp_atom_poly(ao_lisp_atoms);
- if (!ao_lisp_atoms)
- ao_lisp_root_add(&ao_lisp_atom_type, &ao_lisp_atoms);
ao_lisp_atoms = atom;
strcpy(atom->name, name);
}
@@ -103,11 +104,8 @@ struct ao_lisp_frame *ao_lisp_frame_current;
static void
ao_lisp_atom_init(void)
{
- if (!ao_lisp_frame_global) {
+ if (!ao_lisp_frame_global)
ao_lisp_frame_global = ao_lisp_frame_new(0);
- ao_lisp_root_add(&ao_lisp_frame_type, &ao_lisp_frame_global);
- ao_lisp_root_add(&ao_lisp_frame_type, &ao_lisp_frame_current);
- }
}
static ao_poly *