summaryrefslogtreecommitdiff
path: root/variable.c
diff options
authorPeter Zhu <peter@peterzhu.ca>2025-01-24 10:16:27 -0500
committerPeter Zhu <peter@peterzhu.ca>2025-01-27 10:28:36 -0500
commit98b36f6f3661430a29ee1fe40d28b9abeeb903f5 (patch)
tree0a8c6901a489131948f58e7a25cb2e3c4f461213 /variable.c
parent9e5ff79c5be426c3e6fef80449620075cbca7671 (diff)
Use rb_gc_vm_weak_table_foreach for reference updating
We can use rb_gc_vm_weak_table_foreach for reference updating of weak tables in the default GC.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12629
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/variable.c b/variable.c
index 9def7645ae..58c8653c40 100644
--- a/variable.c
+++ b/variable.c
@@ -1136,42 +1136,6 @@ rb_mark_generic_ivar(VALUE obj)
}
}
-static int
-rb_generic_ivar_update_references_i(st_data_t key, st_data_t val, st_data_t _data)
-{
- VALUE orig_obj = (VALUE)key;
- VALUE obj = rb_gc_location(orig_obj);
- struct gen_ivtbl *ivtbl = (struct gen_ivtbl *)val;
-
- if (rb_shape_obj_too_complex(obj)) {
- rb_gc_ref_update_table_values_only(ivtbl->as.complex.table);
- }
- else {
- for (uint32_t i = 0; i < ivtbl->as.shape.numiv; i++) {
- ivtbl->as.shape.ivptr[i] = rb_gc_location(ivtbl->as.shape.ivptr[i]);
- }
- }
-
- if (obj != orig_obj) {
- st_insert(generic_iv_tbl_, (st_data_t)obj, (st_data_t)ivtbl);
-
- return ST_DELETE;
- }
- else {
- return ST_CONTINUE;
- }
-}
-
-void
-rb_generic_ivar_update_references(void)
-{
- DURING_GC_COULD_MALLOC_REGION_START();
- {
- st_foreach(generic_iv_tbl_, rb_generic_ivar_update_references_i, (st_data_t)0);
- }
- DURING_GC_COULD_MALLOC_REGION_END();
-}
-
void
rb_free_generic_ivar(VALUE obj)
{
close