Explicit GC of globals during minor collection, at least for now

This commit is contained in:
Justin Ethier 2015-10-20 00:17:53 -04:00
parent cc4b3f36b4
commit 1505274640

View file

@ -2608,9 +2608,7 @@ void GC(cont, args, num_args) closure cont; object *args; int num_args;
gc_ans[i] = args[i];
}
TODO: move mutations to heap (any stack-allocated globals must be here, too)
but that complicates the block below. is there a better way to do this?
ideally want to minimize changes to scheme code as well...
// Transport mutations
{
list l;
for (l = mutation_table; !nullp(l); l = cdr(l)) {
@ -2634,6 +2632,16 @@ ideally want to minimize changes to scheme code as well...
}
clear_mutations(); // Reset for next time
// Transport globals
gc_move2heap(Cyc_global_variables); // Internal global used by the runtime
{
list l = global_table;
for(; !nullp(l); l = cdr(l)){
cvar_type *c = (cvar_type *)car(l);
gc_move2heap(*(c->pvar)); // Transport underlying global, not the pvar
}
}
// Check allocated objects, moving additional objects as needed
while (scani < alloci) {
object obj = Cyc_thread->moveBuf[scani];