diff options
author | Alan Wu <[email protected]> | 2023-11-27 19:19:41 -0500 |
---|---|---|
committer | Alan Wu <[email protected]> | 2023-11-28 13:03:04 -0500 |
commit | cd4207869ff831c41db3ec873b175369ffca080a () | |
tree | e3a63a06f41f952077aa84d2e300cf68b24ca113 /vm_method.c | |
parent | 0704f40787d306b00db6bbdfee7e13ee172f600a (diff) |
Fix cache incoherency for ME resolved through VM_METHOD_TYPE_REFINED
Previously, we didn't invalidate the method entry wrapped by VM_METHOD_TYPE_REFINED method entries which could cause calls to land in the wrong method like it did in the included test. Do the invalidation, and adjust rb_method_entry_clone() to accommodate this new invalidation vector. Fix: cfd7729ce7a31c8b6ec5dd0e99c67b2932de4732 See-also: e201b81f79828c30500947fe8c8ea3c515e3d112
-rw-r--r-- | vm_method.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -240,6 +240,13 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid) vm_cme_invalidate((rb_callable_method_entry_t *)cme); RB_DEBUG_COUNTER_INC(cc_invalidate_tree_cme); if (cme->def->iseq_overload) { rb_callable_method_entry_t *monly_cme = (rb_callable_method_entry_t *)lookup_overloaded_cme(cme); if (monly_cme) { @@ -676,12 +683,36 @@ rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, r return me; } const rb_method_entry_t * rb_method_entry_clone(const rb_method_entry_t *src_me) { rb_method_entry_t *me = rb_method_entry_alloc(src_me->called_id, src_me->owner, src_me->defined_class, src_me->def, METHOD_ENTRY_COMPLEMENTED(src_me)); METHOD_ENTRY_FLAGS_COPY(me, src_me); return me; } |