[前][次][番号順一覧][スレッド一覧]

ruby-changes:53642

From: k0kubun <ko1@a...>
Date: Tue, 20 Nov 2018 20:27:38 +0900 (JST)
Subject: [ruby-changes:53642] k0kubun:r65883 (trunk): mjit_worker.c: avoid GC when modifying ISeq

k0kubun	2018-11-20 20:18:59 +0900 (Tue, 20 Nov 2018)

  New Revision: 65883

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65883

  Log:
    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

  Modified files:
    trunk/mjit_worker.c
Index: mjit_worker.c
===================================================================
--- mjit_worker.c	(revision 65882)
+++ mjit_worker.c	(revision 65883)
@@ -1217,6 +1217,10 @@ mjit_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1217
             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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]