summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-08-14 16:03:50 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-09-22 09:59:35 -0700
commit4afc6370cba7e83c204edcdf1c2f8d1497af2f7c (patch)
treef9bc0e8f24ed98a829f1a6a7b8ae0bfafc3a4ade /vm_method.c
parentccb82041548f871a0185eead619ce62e1df5957d (diff)
Add missing locks to method table
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/vm_method.c b/vm_method.c
index 7295c74c7b..238ad62f4b 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -754,7 +754,9 @@ rb_clear_all_refinement_method_cache(void)
void
rb_method_table_insert(VALUE klass, struct rb_id_table *table, ID method_id, const rb_method_entry_t *me)
{
- rb_method_table_insert0(klass, table, method_id, me, RB_TYPE_P(klass, T_ICLASS) && !RICLASS_OWNS_M_TBL_P(klass));
+ RB_VM_LOCKING() {
+ rb_method_table_insert0(klass, table, method_id, me, RB_TYPE_P(klass, T_ICLASS) && !RICLASS_OWNS_M_TBL_P(klass));
+ }
}
void
@@ -1545,7 +1547,9 @@ method_added(VALUE klass, ID mid)
void
rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_visibility_t visi)
{
- rb_method_entry_make(klass, mid, klass, visi, type, NULL, mid, opts);
+ RB_VM_LOCKING() {
+ rb_method_entry_make(klass, mid, klass, visi, type, NULL, mid, opts);
+ }
if (type != VM_METHOD_TYPE_UNDEF && type != VM_METHOD_TYPE_REFINED) {
method_added(klass, mid);
@@ -1570,11 +1574,14 @@ static rb_method_entry_t *
method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *me,
rb_method_visibility_t visi, VALUE defined_class)
{
- rb_method_entry_t *newme = rb_method_entry_make(klass, mid, defined_class, visi,
- me->def->type, me->def, 0, NULL);
- if (newme == me) {
- me->def->no_redef_warning = TRUE;
- METHOD_ENTRY_FLAGS_SET(newme, visi, FALSE);
+ rb_method_entry_t *newme;
+ RB_VM_LOCKING() {
+ newme = rb_method_entry_make(klass, mid, defined_class, visi,
+ me->def->type, me->def, 0, NULL);
+ if (newme == me) {
+ me->def->no_redef_warning = TRUE;
+ METHOD_ENTRY_FLAGS_SET(newme, visi, FALSE);
+ }
}
method_added(klass, mid);