1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add VM_CALLCACHE_ON_STACK

check if iseq refers to on stack CC (it shouldn't).
This commit is contained in:
Koichi Sasada 2021-11-16 18:14:50 +09:00
parent 8d7116552d
commit 7ec1fc37f4
Notes: git 2021-11-17 22:22:03 +09:00
2 changed files with 14 additions and 7 deletions

17
iseq.c
View file

@ -366,12 +366,17 @@ rb_iseq_mark(const rb_iseq_t *iseq)
if (vm_ci_markable(ci)) {
rb_gc_mark_movable((VALUE)ci);
}
if (cc && vm_cc_markable(cc)) {
if (!vm_cc_invalidated_p(cc)) {
rb_gc_mark_movable((VALUE)cc);
}
else {
cds[i].cc = rb_vm_empty_cc();
if (cc) {
VM_ASSERT((cc->flags & VM_CALLCACHE_ON_STACK) == 0);
if (vm_cc_markable(cc)) {
if (!vm_cc_invalidated_p(cc)) {
rb_gc_mark_movable((VALUE)cc);
}
else {
cds[i].cc = rb_vm_empty_cc();
}
}
}
}

View file

@ -290,6 +290,7 @@ struct rb_callcache {
};
#define VM_CALLCACHE_UNMARKABLE IMEMO_FL_USER0
#define VM_CALLCACHE_ON_STACK IMEMO_FL_USER1
static inline const struct rb_callcache *
vm_cc_new(VALUE klass,
@ -305,7 +306,8 @@ vm_cc_new(VALUE klass,
(struct rb_callcache) { \
.flags = T_IMEMO | \
(imemo_callcache << FL_USHIFT) | \
VM_CALLCACHE_UNMARKABLE, \
VM_CALLCACHE_UNMARKABLE | \
VM_CALLCACHE_ON_STACK, \
.klass = clazz, \
.cme_ = cme, \
.call_ = call, \