Initial (bad) gc

This commit is contained in:
2026-01-21 20:52:18 -08:00
parent 4c04e71078
commit 656846ddc0
16 changed files with 650 additions and 79 deletions

View File

@ -6,23 +6,28 @@
LispVal *obarray;
static void construct_manual_symbols() {
static void construct_manual_symbols(void) {
// IMPORTANT: the symbols listed here need to also be set as special in
// gen-init-globals.awk
Qnil = Fmake_symbol(LISP_LITSTR("nil"));
((LispSymbol *) Qnil)->function = Qnil;
((LispSymbol *) Qnil)->plist = Qnil;
lisp_gc_register_static_object(Qnil);
Qt = Fmake_symbol(LISP_LITSTR("t"));
((LispSymbol *) Qt)->value = Qt;
lisp_gc_register_static_object(Qt);
Qunbound = Fmake_symbol(LISP_LITSTR("unbound"));
((LispSymbol *) Qunbound)->value = Qunbound;
((LispSymbol *) Qnil)->value = Qunbound;
lisp_gc_register_static_object(Qunbound);
Qhash_string = Fmake_symbol(LISP_LITSTR("hash-string"));
lisp_gc_register_static_object(Qhash_string);
Qstrings_equal = Fmake_symbol(LISP_LITSTR("strings-equal"));
lisp_gc_register_static_object(Qstrings_equal);
}
static void register_manual_symbols() {
static void register_manual_symbols(void) {
#define INTERN(cname) \
Fputhash(obarray, ((LispSymbol *) Q##cname)->name, Q##cname);
INTERN(nil);
@ -33,7 +38,8 @@ static void register_manual_symbols() {
#undef INTERN
}
void lisp_init() {
void lisp_init(void) {
lisp_init_gc();
construct_manual_symbols();
obarray = Fmake_hash_table(Qhash_string, Qstrings_equal);
// these call Fintern, so they need to have obarray constructed
@ -47,7 +53,7 @@ void lisp_init() {
lisp_init_stack();
}
void lisp_shutdown() {}
void lisp_shutdown(void) {}
DEFUN(eval, "eval", (LispVal * form), "(form)", "") {
if (!OBJECTP(form)) {