summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-13 05:55:18 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-14 11:57:46 +0900
commit967040ba59799e6b7891168ffbf37cc646988d84 (patch)
tree2f36f519d5c753ccd68dc08c8e6c65ea375ffcc6 /vm.c
parentfa63052be19b26d39b22689ad9969aa83909809e (diff)
Introduce negative method cache
pCMC doesn't have negative method cache so this patch implements it.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3892
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c10
1 files changed, 10 insertions, 0 deletions
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;