From d53220848c96f113d62d3478e72172de1b6d3fcb Mon Sep 17 00:00:00 2001 From: k0kubun Date: Tue, 20 Nov 2018 11:18:59 +0000 Subject: 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 --- mjit_worker.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- cgit v1.2.3