diff options
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 03d2ed09d1..1f472efb91 100644 --- a/vm_method.c +++ b/vm_method.c @@ -126,11 +126,27 @@ vm_cme_invalidate(rb_callable_method_entry_t *cme) rb_yjit_cme_invalidate((VALUE)cme); } +static int +rb_clear_constant_cache_for_id_i(st_data_t ic, st_data_t idx, st_data_t arg) +{ + ((IC) ic)->entry = NULL; + return ST_CONTINUE; +} + +// Here for backward compat. +void rb_clear_constant_cache(void) {} + void -rb_clear_constant_cache(void) +rb_clear_constant_cache_for_id(ID id) { + rb_vm_t *vm = GET_VM(); + st_table *ics; + + if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) { + st_foreach(ics, rb_clear_constant_cache_for_id_i, (st_data_t) NULL); + } + rb_yjit_constant_state_changed(); - INC_GLOBAL_CONSTANT_STATE(); } static void |