summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-02-19 14:57:59 +0900
committerKoichi Sasada <ko1@atdot.net>2021-02-19 16:54:31 +0900
commit9c769575bfa2a5c9e7078eb2840bba640dc46077 (patch)
tree40447e43ba4afc6972c55d9089b30a5b2c00a264 /vm_method.c
parentd260cbe2950392c41e263c82ab753e5faa12468c (diff)
downloadruby-9c769575bfa2a5c9e7078eb2840bba640dc46077.tar.gz
invalidate negative cache any time.
negative cache on a class which does not have subclasses was not invalidated, but it should be invalidated because other classes can cache this negative cache. [Bug #17553]
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/vm_method.c b/vm_method.c
index a3bebae95d..2573e708ba 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -129,17 +129,15 @@ rb_clear_constant_cache(void)
}
static void
-invalidate_negative_cache(ID mid, bool invalidate_cme)
+invalidate_negative_cache(ID mid)
{
const rb_callable_method_entry_t *cme;
rb_vm_t *vm = GET_VM();
if (rb_id_table_lookup(vm->negative_cme_table, mid, (VALUE *)&cme)) {
rb_id_table_delete(vm->negative_cme_table, mid);
- if (invalidate_cme) {
- vm_cme_invalidate((rb_callable_method_entry_t *)cme);
- RB_DEBUG_COUNTER_INC(cc_invalidate_negative);
- }
+ vm_cme_invalidate((rb_callable_method_entry_t *)cme);
+ RB_DEBUG_COUNTER_INC(cc_invalidate_negative);
}
}
@@ -162,7 +160,7 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
// invalidate CCs
if (cc_tbl && rb_id_table_lookup(cc_tbl, mid, (VALUE *)&ccs)) {
- if (NIL_P(ccs->cme->owner)) invalidate_negative_cache(mid, false);
+ if (NIL_P(ccs->cme->owner)) invalidate_negative_cache(mid);
rb_vm_ccs_free(ccs);
rb_id_table_delete(cc_tbl, mid);
RB_DEBUG_COUNTER_INC(cc_invalidate_leaf_ccs);
@@ -211,7 +209,7 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
RB_DEBUG_COUNTER_INC(cc_invalidate_tree);
}
else {
- invalidate_negative_cache(mid, true);
+ invalidate_negative_cache(mid);
}
}
}