Browse Source

fix GC issues

master
Martin Dørum 3 years ago
parent
commit
19d87ad18c
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      lib/vm/vm.c

+ 10
- 1
lib/vm/vm.c View File

val->flags &= ~L2_VAL_MARKED; val->flags &= ~L2_VAL_MARKED;
} }
} }

// Normal variables are unmarked by the above loop,
// but builtins don't go through that loop
for (size_t i = 0; i < vm->gc_start; ++i) {
vm->values[i].flags &= ~L2_VAL_MARKED;
}

return freed; return freed;
} }


gc_mark(vm, vm->stack[sptr]); gc_mark(vm, vm->stack[sptr]);
} }


for (l2_word fsptr = 0; fsptr < vm->fsptr; ++fsptr) {
// Don't need to mark the first stack frame, since that's where all the
// builtins live, and they aren't sweeped anyways
for (l2_word fsptr = 1; fsptr < vm->fsptr; ++fsptr) {
gc_mark(vm, vm->fstack[fsptr].ns); gc_mark(vm, vm->fstack[fsptr].ns);
} }



Loading…
Cancel
Save