mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
YJIT: Invalidate redefined methods only through cme (#6734)
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
This commit is contained in:
parent
9751b54971
commit
1125274c4e
Notes:
git
2022-11-15 20:58:13 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
5 changed files with 12 additions and 80 deletions
|
@ -187,6 +187,7 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
|
|||
// invalidate CCs
|
||||
if (cc_tbl && rb_id_table_lookup(cc_tbl, mid, &ccs_data)) {
|
||||
struct rb_class_cc_entries *ccs = (struct rb_class_cc_entries *)ccs_data;
|
||||
rb_yjit_cme_invalidate((rb_callable_method_entry_t *)ccs->cme);
|
||||
if (NIL_P(ccs->cme->owner)) invalidate_negative_cache(mid);
|
||||
rb_vm_ccs_free(ccs);
|
||||
rb_id_table_delete(cc_tbl, mid);
|
||||
|
@ -196,6 +197,10 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
|
|||
// remove from callable_m_tbl, if exists
|
||||
struct rb_id_table *cm_tbl;
|
||||
if ((cm_tbl = RCLASS_CALLABLE_M_TBL(klass)) != NULL) {
|
||||
VALUE cme;
|
||||
if (rb_yjit_enabled_p() && rb_id_table_lookup(cm_tbl, mid, &cme)) {
|
||||
rb_yjit_cme_invalidate((rb_callable_method_entry_t *)cme);
|
||||
}
|
||||
rb_id_table_delete(cm_tbl, mid);
|
||||
RB_DEBUG_COUNTER_INC(cc_invalidate_leaf_callable);
|
||||
}
|
||||
|
@ -255,8 +260,6 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
|
|||
}
|
||||
}
|
||||
RB_VM_LOCK_LEAVE();
|
||||
|
||||
rb_yjit_method_lookup_change(klass, mid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue