Change to incremental GC

This commit is contained in:
2026-02-28 09:11:21 -08:00
parent a76e6a335d
commit 45f6d7a53d
8 changed files with 176 additions and 61 deletions

View File

@@ -24,6 +24,8 @@ struct StackFrame {
LispVal *args; // arguments of the function call
LispVal *lexenv; // lexical environment (plist)
struct LocalReferences local_refs;
bool marked; // whether we have GC'ed this frame
};
struct LispStack {
@@ -69,6 +71,8 @@ static inline void new_lexical_variable(LispVal *name, LispVal *value) {
assert(the_stack.depth != 0);
LISP_STACK_TOP()->lexenv =
CONS(name, CONS(value, LISP_STACK_TOP()->lexenv));
LISP_STACK_TOP()->marked = false;
gc_mark_stack_for_rescan();
}
// Copy the previous frame's lexenv to the top of the stack.