diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-20 11:18:59 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-20 11:18:59 +0000 |
commit | d53220848c96f113d62d3478e72172de1b6d3fcb (patch) | |
tree | c0071d41705b6a31b124581a03a16b9f797cdc4c | |
parent | 5fe1ad969efdc968c9d53240f0845f007a396b8d (diff) |
mjit_worker.c: avoid GC when modifying ISeq
This is hoped to fix the SEGV:
https://app.wercker.com/ruby/ruby/runs/mjit-test1/5bf392cf183106002856c1f0?step=5bf3bddc87436a0006292535
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | mjit_worker.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mjit_worker.c b/mjit_worker.c index d85afb5ebe..b23d18d6bb 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -1217,6 +1217,10 @@ mjit_worker(void) func = convert_unit_to_func(unit, job.cc_entries, job.is_entries); CRITICAL_SECTION_START(3, "in jit func replace"); + while (in_gc) { /* Make sure we're not GC-ing when touching ISeq */ + verbose(3, "Waiting wakeup from GC"); + rb_native_cond_wait(&mjit_gc_wakeup, &mjit_engine_mutex); + } if (unit->iseq) { /* Check whether GCed or not */ /* Usage of jit_code might be not in a critical section. */ MJIT_ATOMIC_SET(unit->iseq->body->jit_func, func); |