Skip to content

Commit 3c3e34e

Browse files
committed
Try to avoid unnecessary CC table dups
1 parent f424c69 commit 3c3e34e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

vm_insnhelper.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,17 +2130,14 @@ vm_populate_cc(VALUE klass, const struct rb_callinfo * const ci, ID mid)
21302130
VALUE attach = RCLASS_ATTACHED_OBJECT(klass);
21312131
rcu_cc_tbl_p = RB_TYPE_P(attach, T_CLASS) || RB_TYPE_P(attach, T_MODULE);
21322132
}
2133-
if (rcu_cc_tbl_p) {
2134-
cc_tbl = rb_vm_cc_table_dup(cc_tbl, klass);
2135-
}
21362133
}
21372134
}
21382135

21392136
RB_DEBUG_COUNTER_INC(cc_not_found_in_ccs);
21402137

21412138
const rb_callable_method_entry_t *cme;
21422139

2143-
cme = rb_callable_method_entry(klass, mid, cc_tbl == original_cc_table);
2140+
cme = rb_callable_method_entry(klass, mid, !rcu_cc_tbl_p && cc_tbl == original_cc_table);
21442141

21452142
VM_ASSERT(cme == NULL || IMEMO_TYPE_P(cme, imemo_ment));
21462143

@@ -2150,6 +2147,10 @@ vm_populate_cc(VALUE klass, const struct rb_callinfo * const ci, ID mid)
21502147
return &vm_empty_cc;
21512148
}
21522149

2150+
if (rcu_cc_tbl_p) {
2151+
cc_tbl = rb_vm_cc_table_dup(cc_tbl, klass);
2152+
}
2153+
21532154
VM_ASSERT(cme == rb_callable_method_entry(klass, mid, false));
21542155

21552156
METHOD_ENTRY_CACHED_SET((struct rb_callable_method_entry_struct *)cme);

0 commit comments

Comments
 (0)