Skip to content

Commit ac23fa0

Browse files
committed
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.
1 parent b4c900d commit ac23fa0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2828,12 +2828,11 @@ struct mark_cc_entry_args {
28282828
};
28292829

28302830
static enum rb_id_table_iterator_result
2831-
mark_cc_entry_i(ID id, VALUE ccs_ptr, void *data)
2831+
mark_cc_entry_i(VALUE ccs_ptr, void *data)
28322832
{
28332833
struct rb_class_cc_entries *ccs = (struct rb_class_cc_entries *)ccs_ptr;
28342834

28352835
VM_ASSERT(vm_ccs_p(ccs));
2836-
VM_ASSERT(id == ccs->cme->called_id);
28372836

28382837
if (METHOD_ENTRY_INVALIDATED(ccs->cme)) {
28392838
rb_vm_ccs_free(ccs);
@@ -2861,7 +2860,7 @@ mark_cc_tbl(rb_objspace_t *objspace, struct rb_id_table *tbl, VALUE klass)
28612860

28622861
args.objspace = objspace;
28632862
args.klass = klass;
2864-
rb_id_table_foreach(tbl, mark_cc_entry_i, (void *)&args);
2863+
rb_id_table_foreach_values(tbl, mark_cc_entry_i, (void *)&args);
28652864
}
28662865

28672866
static enum rb_id_table_iterator_result

0 commit comments

Comments
 (0)