diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-07-27 21:49:42 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-27 21:49:42 +0200 |
commit | 3b1be3d5f43f28c935629be20c770da3c9fb86c1 (patch) | |
tree | 219b6f834fe43762187b001e158dcf715d27038b | |
parent | d49af4eb9b111442b4e4fce56a154fb8f27c9b5d (diff) |
types: mark further GC roots
Mark reachable native function and ucode function objects during incremental
GC steps in order to avoid freeing them prematurely.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | types.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2064,10 +2064,18 @@ ucv_gc_common(uc_vm_t *vm, bool final) if (!final) { /* mark reachable objects */ ucv_gc_mark(vm->globals); + ucv_gc_mark(vm->exception.stacktrace); - for (i = 0; i < vm->callframes.count; i++) + for (i = 0; i < vm->callframes.count; i++) { ucv_gc_mark(vm->callframes.entries[i].ctx); + if (vm->callframes.entries[i].closure) + ucv_gc_mark(&vm->callframes.entries[i].closure->header); + + if (vm->callframes.entries[i].cfunction) + ucv_gc_mark(&vm->callframes.entries[i].cfunction->header); + } + for (i = 0; i < vm->stack.count; i++) ucv_gc_mark(vm->stack.entries[i]); } |