diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-05-20 15:34:47 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-05-21 11:27:02 -0400 |
| commit | ac23fa09029a2db4045b03b377133f770cb25327 (patch) | |
| tree | 2016493b4aa330d100bd3fda7d3128113e7c1b71 | |
| parent | b4c900debdc4d757d42d6eee5d72b911db45ff45 (diff) | |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13386
| -rw-r--r-- | gc.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 |
