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

7
iseq.c
View file

@ -366,7 +366,11 @@ rb_iseq_mark(const rb_iseq_t *iseq)
if (vm_ci_markable(ci)) { if (vm_ci_markable(ci)) {
rb_gc_mark_movable((VALUE)ci); rb_gc_mark_movable((VALUE)ci);
} }
if (cc && vm_cc_markable(cc)) {
if (cc) {
VM_ASSERT((cc->flags & VM_CALLCACHE_ON_STACK) == 0);
if (vm_cc_markable(cc)) {
if (!vm_cc_invalidated_p(cc)) { if (!vm_cc_invalidated_p(cc)) {
rb_gc_mark_movable((VALUE)cc); rb_gc_mark_movable((VALUE)cc);
} }
@ -376,6 +380,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
} }
} }
} }
}
if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) { if (body->param.flags.has_kw && ISEQ_COMPILE_DATA(iseq) == NULL) {
const struct rb_iseq_param_keyword *const keyword = body->param.keyword; const struct rb_iseq_param_keyword *const keyword = body->param.keyword;

View file

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