projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/lisp: Change GC to do moves in batches of 32
[fw/altos]
/
src
/
lisp
/
ao_lisp_atom.c
diff --git
a/src/lisp/ao_lisp_atom.c
b/src/lisp/ao_lisp_atom.c
index efa4f6214705d78623e27ad01ba686c9bf1f0e9f..6705f14036c07748a9b3a9004936c67b8bac3cdc 100644
(file)
--- 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;
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;
}
}
break;
}
}
@@
-46,11
+46,19
@@
static void atom_mark(void *addr)
static void atom_move(void *addr)
{
struct ao_lisp_atom *atom = addr;
static void atom_move(void *addr)
{
struct ao_lisp_atom *atom = addr;
+ int ret;
for (;;) {
for (;;) {
- if (ao_lisp_poly_move(&atom->next, 0))
+ struct ao_lisp_atom *next = ao_lisp_poly_atom(atom->next);
+
+ if (!next)
break;
break;
- atom = ao_lisp_poly_atom(atom->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)
+ break;
+ atom = next;
}
}
}
}
@@
-58,6
+66,7
@@
const struct ao_lisp_type ao_lisp_atom_type = {
.mark = atom_mark,
.size = atom_size,
.move = atom_move,
.mark = atom_mark,
.size = atom_size,
.move = atom_move,
+ .name = "atom"
};
struct ao_lisp_atom *ao_lisp_atoms;
};
struct ao_lisp_atom *ao_lisp_atoms;
@@
-77,12
+86,12
@@
ao_lisp_atom_intern(char *name)
return atom;
}
#endif
return atom;
}
#endif
+ ao_lisp_string_stash(0, name);
atom = ao_lisp_alloc(name_size(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 (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);
}
ao_lisp_atoms = atom;
strcpy(atom->name, name);
}
@@
-95,11
+104,8
@@
struct ao_lisp_frame *ao_lisp_frame_current;
static void
ao_lisp_atom_init(void)
{
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_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 *
}
static ao_poly *