Use rb_id_table_foreach_values for mark_cc_tbl

We don't need the key, so we can improve performance by only iterating
on the value.

This will also fix the MMTk build because looking up the key in
rb_id_table_foreach requires locking the VM, which is not supported in
the MMTk worker threads.
This commit is contained in:
Peter Zhu 2025-05-20 15:34:47 -04:00
parent b4c900debd
commit ac23fa0902
Notes: git 2025-05-21 15:27:15 +00:00

5
gc.c
View File

@ -2828,12 +2828,11 @@ struct mark_cc_entry_args {
};
static enum rb_id_table_iterator_result
mark_cc_entry_i(ID id, VALUE ccs_ptr, void *data)
mark_cc_entry_i(VALUE ccs_ptr, void *data)
{
struct rb_class_cc_entries *ccs = (struct rb_class_cc_entries *)ccs_ptr;
VM_ASSERT(vm_ccs_p(ccs));
VM_ASSERT(id == ccs->cme->called_id);
if (METHOD_ENTRY_INVALIDATED(ccs->cme)) {
rb_vm_ccs_free(ccs);
@ -2861,7 +2860,7 @@ mark_cc_tbl(rb_objspace_t *objspace, struct rb_id_table *tbl, VALUE klass)
args.objspace = objspace;
args.klass = klass;
rb_id_table_foreach(tbl, mark_cc_entry_i, (void *)&args);
rb_id_table_foreach_values(tbl, mark_cc_entry_i, (void *)&args);
}
static enum rb_id_table_iterator_result