From 99fdafd8c03a7baee265ce3dd22af5b2d02fdeb6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 7 Dec 2021 13:40:51 +0100 Subject: vm: introduce value registry Introduce a new, lazily allocated value registry which can be used by C code to store values which should not be garbage collected. The registry is a plain ucode object internally and treated as GC root but not exposed to ucode script code, this allows it to retain references to values which are otherwise completely unreachable from ucode scripts. Signed-off-by: Jo-Philipp Wich --- types.c | 1 + 1 file changed, 1 insertion(+) (limited to 'types.c') diff --git a/types.c b/types.c index c3032e1..a8ca023 100644 --- a/types.c +++ b/types.c @@ -2078,6 +2078,7 @@ ucv_gc_common(uc_vm_t *vm, bool final) if (!final) { /* mark reachable objects */ ucv_gc_mark(vm->globals); + ucv_gc_mark(vm->registry); ucv_gc_mark(vm->exception.stacktrace); for (i = 0; i < vm->callframes.count; i++) { -- cgit v1.2.3