diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-11-15 12:57:43 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 12:57:43 -0800 |
commit | 1125274c4e8aeffd8609ced41c05d26d45b9b5ad (patch) | |
tree | 03ed20d9e5cc86ced01a4329b330d3ca9a043f81 /vm_method.c | |
parent | 9751b54971c5ad3bab29ce8af6ec50695aa43251 (diff) | |
download | ruby-1125274c4e8aeffd8609ced41c05d26d45b9b5ad.tar.gz |
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>
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 08e91ea039..bec3fc804d 100644 --- a/vm_method.c +++ b/vm_method.c @@ -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 |