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

Do not access jit_unit if NULL

This commit is contained in:
Takashi Kokubun 2020-12-16 19:43:17 -08:00
parent 93ba3ac036
commit d07183ec85
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

5
mjit.c
View file

@ -350,6 +350,10 @@ mjit_recompile(const rb_iseq_t *iseq)
verbose(1, "JIT recompile: %s@%s:%d", RSTRING_PTR(iseq->body->location.label), verbose(1, "JIT recompile: %s@%s:%d", RSTRING_PTR(iseq->body->location.label),
RSTRING_PTR(rb_iseq_path(iseq)), FIX2INT(iseq->body->location.first_lineno)); RSTRING_PTR(rb_iseq_path(iseq)), FIX2INT(iseq->body->location.first_lineno));
iseq->body->jit_func = (mjit_func_t)NOT_ADDED_JIT_ISEQ_FUNC;
if (iseq->body->jit_unit == NULL) // mjit_free_iseq is already called
return;
// Lazily move active_units to stale_units to avoid race conditions around active_units with compaction // Lazily move active_units to stale_units to avoid race conditions around active_units with compaction
CRITICAL_SECTION_START(3, "in rb_mjit_recompile_iseq"); CRITICAL_SECTION_START(3, "in rb_mjit_recompile_iseq");
@ -357,7 +361,6 @@ mjit_recompile(const rb_iseq_t *iseq)
pending_stale_p = true; pending_stale_p = true;
CRITICAL_SECTION_FINISH(3, "in rb_mjit_recompile_iseq"); CRITICAL_SECTION_FINISH(3, "in rb_mjit_recompile_iseq");
iseq->body->jit_func = (mjit_func_t)NOT_ADDED_JIT_ISEQ_FUNC;
mjit_add_iseq_to_process(iseq, &iseq->body->jit_unit->compile_info); mjit_add_iseq_to_process(iseq, &iseq->body->jit_unit->compile_info);
if (UNLIKELY(mjit_opts.wait)) { if (UNLIKELY(mjit_opts.wait)) {
mjit_wait(iseq->body); mjit_wait(iseq->body);