mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Explicit GC of globals during minor collection, at least for now
This commit is contained in:
parent
cc4b3f36b4
commit
1505274640
1 changed files with 11 additions and 3 deletions
14
runtime.c
14
runtime.c
|
@ -2608,9 +2608,7 @@ void GC(cont, args, num_args) closure cont; object *args; int num_args;
|
||||||
gc_ans[i] = args[i];
|
gc_ans[i] = args[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
TODO: move mutations to heap (any stack-allocated globals must be here, too)
|
// Transport mutations
|
||||||
but that complicates the block below. is there a better way to do this?
|
|
||||||
ideally want to minimize changes to scheme code as well...
|
|
||||||
{
|
{
|
||||||
list l;
|
list l;
|
||||||
for (l = mutation_table; !nullp(l); l = cdr(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
|
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
|
// Check allocated objects, moving additional objects as needed
|
||||||
while (scani < alloci) {
|
while (scani < alloci) {
|
||||||
object obj = Cyc_thread->moveBuf[scani];
|
object obj = Cyc_thread->moveBuf[scani];
|
||||||
|
|
Loading…
Add table
Reference in a new issue