Delete ID from constant cache table if it becomes empty on ISEQ free

Co-authored-by: John Hawthorn <john@hawthorn.email>
This commit is contained in:
Kevin Newton 2022-03-09 21:21:21 -05:00 committed by Aaron Patterson
parent 629908586b
commit 8f6eaca2e1
Notes: git 2022-03-25 01:15:07 +09:00

5
iseq.c
View File

@ -129,6 +129,11 @@ iseq_clear_ic_references_i(VALUE *code, VALUE insn, size_t index, void *data)
if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) {
st_delete(ics, (st_data_t *) &ic_data->ic, (st_data_t *) NULL);
if (ics->num_entries == 0) {
rb_id_table_delete(vm->constant_cache, id);
st_free_table(ics);
}
}
return true;