mjit_mark_cc_entries: should consider VM_CALLCACHE_UNMARKABLE

Now that vm_empty_cc is VM_CALLCACHE_UNMARKABLE, it has to be properly
ruled out from being GCed.
This commit is contained in:
卜部昌平 2020-06-09 12:38:46 +09:00
parent adfd4f3916
commit f4950145cf

2
mjit.c
View File

@ -1082,7 +1082,7 @@ mjit_mark_cc_entries(const struct rb_iseq_constant_body *const body)
// It must be `body->jit_unit->cc_entries_size` instead of `body->ci_size` to mark children's cc_entries
for (unsigned int i = 0; i < body->jit_unit->cc_entries_size; i++) {
const struct rb_callcache *cc = cc_entries[i];
if (cc != NULL) {
if (cc != NULL && vm_cc_markable(cc)) {
// Pin `cc` and `cc->cme` against GC.compact as their addresses may be written in JIT-ed code.
rb_gc_mark((VALUE)cc);
rb_gc_mark((VALUE)vm_cc_cme(cc));