From 967040ba59799e6b7891168ffbf37cc646988d84 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Sun, 13 Dec 2020 05:55:18 +0900 Subject: Introduce negative method cache pCMC doesn't have negative method cache so this patch implements it. --- vm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 6573925509..c6f3344130 100644 --- a/vm.c +++ b/vm.c @@ -2530,6 +2530,13 @@ rb_vm_each_stack_value(void *ptr, void (*cb)(VALUE, void*), void *ctx) } } +static enum rb_id_table_iterator_result +vm_mark_negative_cme(VALUE val, void *dmy) +{ + rb_gc_mark(val); + return ID_TABLE_CONTINUE; +} + void rb_vm_mark(void *ptr) { @@ -2585,6 +2592,8 @@ rb_vm_mark(void *ptr) rb_gc_mark_values(RUBY_NSIG, vm->trap_list.cmd); + rb_id_table_foreach_values(vm->negative_cme_table, vm_mark_negative_cme, NULL); + mjit_mark(); } @@ -3660,6 +3669,7 @@ Init_BareVM(void) vm->objspace = rb_objspace_alloc(); ruby_current_vm_ptr = vm; + vm->negative_cme_table = rb_id_table_create(16); Init_native_thread(th); th->vm = vm; -- cgit v1.2.3