+static const struct ao_lisp_type const *ao_lisp_types[AO_LISP_NUM_TYPE] = {
+ [AO_LISP_CONS] = &ao_lisp_cons_type,
+ [AO_LISP_INT] = NULL,
+ [AO_LISP_STRING] = &ao_lisp_string_type,
+ [AO_LISP_OTHER] = (void *) 0x1,
+ [AO_LISP_ATOM] = &ao_lisp_atom_type,
+ [AO_LISP_BUILTIN] = &ao_lisp_builtin_type,
+ [AO_LISP_FRAME] = &ao_lisp_frame_type,
+ [AO_LISP_LAMBDA] = &ao_lisp_lambda_type,
+};
+
+
+static void
+ao_lisp_mark_busy(void)
+{
+ int i;
+
+ memset(ao_lisp_busy, '\0', sizeof (ao_lisp_busy));
+ memset(ao_lisp_cons, '\0', sizeof (ao_lisp_cons));
+ ao_lisp_cons_noted = 0;
+ DBG("mark\n");
+ for (i = 0; i < AO_LISP_ROOT; i++) {
+ if (ao_lisp_root[i].type) {
+ void **a = ao_lisp_root[i].addr, *v;
+ if (a && (v = *a)) {
+ DBG("root %d\n", DBG_OFFSET(v));
+ ao_lisp_mark(ao_lisp_root[i].type, v);
+ }
+ } else {
+ ao_poly *a = (ao_poly *) ao_lisp_root[i].addr, p;
+ if (a && (p = *a)) {
+ DBG("root 0x%04x\n", p);
+ ao_lisp_poly_mark(p, 0);
+ }
+ }
+ }
+ while (ao_lisp_cons_noted) {
+ memcpy(ao_lisp_cons_last, ao_lisp_cons, sizeof (ao_lisp_cons));
+ memset(ao_lisp_cons, '\0', sizeof (ao_lisp_cons));
+ ao_lisp_cons_noted = 0;
+ for (i = 0; i < AO_LISP_POOL; i += 4) {
+ if (busy(ao_lisp_cons_last, i)) {
+ void *v = ao_lisp_pool + i;
+ DBG("cons %d\n", DBG_OFFSET(v));
+ ao_lisp_mark(&ao_lisp_cons_type, v);
+ }
+ }
+ }
+}
+