summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-06-19 00:07:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-06-19 00:07:50 -0700
commitbd7ae6d2b8476292f22b193a6ec286e9823a28b3 (patch)
tree9c9d0368c5613fa69b0eeb3c3121ecae80854785
parentdd839dc6ed1abf51645f5e69572ab9e106272c33 (diff)
downloadtxr-bd7ae6d2b8476292f22b193a6ec286e9823a28b3.tar.gz
txr-bd7ae6d2b8476292f22b193a6ec286e9823a28b3.tar.bz2
txr-bd7ae6d2b8476292f22b193a6ec286e9823a28b3.zip
gc: protect symbol used for cobj class reg.
* gc.c (gc_prot_array_s): New symbol variable. (gc_late_init): Initialize gc_prot_array_s. Use it when registering prot_array_cls. The _s variables are gc-protected by registrations in the protsym.c module which gets regularly updated, at least before every software release. The cobj class array is not traversed by gc.
-rw-r--r--gc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index ec00e203..272e4642 100644
--- a/gc.c
+++ b/gc.c
@@ -142,6 +142,7 @@ struct prot_array {
val arr[FLEX_ARRAY];
};
+val gc_prot_array_s;
struct cobj_class *prot_array_cls;
val prot1(val *loc)
@@ -1183,7 +1184,8 @@ void gc_late_init(void)
reg_fun(intern(lit("set-stack-limit"), user_package), func_n1(set_stack_limit));
reg_fun(intern(lit("get-stack-limit"), user_package), func_n0(get_stack_limit));
- prot_array_cls = cobj_register(intern(lit("gc-prot-array"), system_package));
+ gc_prot_array_s = intern(lit("gc-prot-array"), system_package);
+ prot_array_cls = cobj_register(gc_prot_array_s);
}
/*