summaryrefslogtreecommitdiffhomepage
path: root/types.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-12-07 13:40:51 +0100
committerJo-Philipp Wich <jo@mein.io>2021-12-08 15:53:40 +0100
commit99fdafd8c03a7baee265ce3dd22af5b2d02fdeb6 (patch)
treea76772653a70c610085c90f80c13ab8eda0cf010 /types.c
parent0d29b2558987eda5d8a913638f40d506172606ac (diff)
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 <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r--types.c1
1 files changed, 1 insertions, 0 deletions
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++) {