From bd7ae6d2b8476292f22b193a6ec286e9823a28b3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 19 Jun 2024 00:07:50 -0700 Subject: 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. --- gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } /* -- cgit v1.2.3