fix gc not acknowledging macros and strings

This commit is contained in:
Lobo 2026-01-12 09:47:19 -03:00
parent 5504f6b123
commit d23a9a4827
2 changed files with 5 additions and 1 deletions

View file

@ -99,13 +99,16 @@ V gc_collect(Gc *gc) {
obj->tail = forward(gc, obj->tail);
break;
}
case TYPE_CLOS: {
case TYPE_CLOS:
case TYPE_MAC: {
Cl *obj = (Cl *)(hdr + 1);
obj->args = forward(gc, obj->args);
obj->body = forward(gc, obj->body);
obj->env = forward(gc, obj->env);
break;
}
case TYPE_STR:
break;
case TYPE_FWD:
fprintf(stderr, "fatal GC error: forwarding pointer in to-space\n");
abort();

View file

@ -24,6 +24,7 @@ int main(void) {
error_print(&interp);
}
gc_rootreset(&interp.gc, mark);
gc_collect(&interp.gc);
nexttoken(&lex);
}