diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 12:40:44 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 12:40:44 +0000 |
commit | e45c9a40a2ee2ca241565f5953af116cd2b5ab29 (patch) | |
tree | 7e568375050ffb4d39a1549ca8ec147273520ae1 /mjit_worker.c | |
parent | 12225347198344590af4a4a55ac1f90591a21dac (diff) | |
download | ruby-e45c9a40a2ee2ca241565f5953af116cd2b5ab29.tar.gz |
Do not execute MJIT copy job when ISeq is GC-ed
I assumed that ISeq is never GC-ed by `in_jit` + `mjit_mark` on copy job
ISeq, but unfortunately I found SEGV on `mjit_copy_job_handler` in which
iseq->body was somehow Qnil. And it seems to be fixed by disabling the
job when `mjit_free_iseq` is called for the ISeq.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r-- | mjit_worker.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mjit_worker.c b/mjit_worker.c index be0910b611..e7f17ac2d3 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -1195,15 +1195,17 @@ mjit_copy_cache_from_main_thread(const rb_iseq_t *iseq, struct rb_call_cache *cc } CRITICAL_SECTION_START(3, "in mjit_copy_cache_from_main_thread"); - bool result = job->finish_p; + bool success_p = job->finish_p; // Disable dispatching this job in mjit_copy_job_handler while memory allocated by alloca // could be expired after finishing this function. job->finish_p = true; in_jit = true; // Prohibit GC during JIT compilation + if (job->iseq == NULL) // ISeq GC is notified in mjit_mark_iseq + success_p = false; job->iseq = NULL; // Allow future GC of this ISeq from here CRITICAL_SECTION_FINISH(3, "in mjit_copy_cache_from_main_thread"); - return result; + return success_p; } // The function implementing a worker. It is executed in a separate |