summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-11-23 18:26:58 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2023-11-23 20:30:18 -0500
commit22de08811e28115da29616790bf9cad2ecdb7913 (patch)
treeea9bd25b9a09346f246fb912c6bd41991d76044f /gc.c
parentf05d586cc99ceed0666459603bfe2aa77a2291ab (diff)
Avoid marking IDs in too_complex tables and rename gc_update_tbl_refs()
Marking both keys and values versus marking just values is an important distinction, but previously, gc_update_tbl_refs() and gc_update_table_refs() had names that were too similar. The st_table storing ivars for too_complex T_OBJECTs have IDs as keys, but we were marking the IDs unnecessary previously, maybe due to the confusing naming.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index 7c1327f1d7..5321470d35 100644
--- a/gc.c
+++ b/gc.c
@@ -10123,13 +10123,15 @@ gc_ref_update_array(rb_objspace_t * objspace, VALUE v)
}
}
+static void gc_ref_update_table_values_only(rb_objspace_t *objspace, st_table *tbl);
+
static void
gc_ref_update_object(rb_objspace_t *objspace, VALUE v)
{
VALUE *ptr = ROBJECT_IVPTR(v);
if (rb_shape_obj_too_complex(v)) {
- rb_gc_update_tbl_refs(ROBJECT_IV_HASH(v));
+ gc_ref_update_table_values_only(objspace, ROBJECT_IV_HASH(v));
return;
}
@@ -10207,7 +10209,7 @@ hash_foreach_replace_value(st_data_t key, st_data_t value, st_data_t argp, int e
}
static void
-gc_update_tbl_refs(rb_objspace_t * objspace, st_table *tbl)
+gc_ref_update_table_values_only(rb_objspace_t *objspace, st_table *tbl)
{
if (!tbl || tbl->num_entries == 0) return;
@@ -10226,7 +10228,7 @@ gc_update_table_refs(rb_objspace_t * objspace, st_table *tbl)
}
}
-/* Update MOVED references in an st_table */
+/* Update MOVED references in a VALUE=>VALUE st_table */
void
rb_gc_update_tbl_refs(st_table *ptr)
{
@@ -10846,7 +10848,7 @@ gc_update_references(rb_objspace_t *objspace)
rb_gc_update_global_tbl();
global_symbols.ids = rb_gc_location(global_symbols.ids);
global_symbols.dsymbol_fstr_hash = rb_gc_location(global_symbols.dsymbol_fstr_hash);
- gc_update_tbl_refs(objspace, objspace->obj_to_id_tbl);
+ gc_ref_update_table_values_only(objspace, objspace->obj_to_id_tbl);
gc_update_table_refs(objspace, objspace->id_to_obj_tbl);
gc_update_table_refs(objspace, global_symbols.str_sym);
gc_update_table_refs(objspace, finalizer_table);