From 15052746401fff8c7b6c90d4d6fc4421b16dd007 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 20 Oct 2015 00:17:53 -0400 Subject: [PATCH] Explicit GC of globals during minor collection, at least for now --- runtime.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/runtime.c b/runtime.c index a774bc97..65e4d0ab 100644 --- a/runtime.c +++ b/runtime.c @@ -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];