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

ruby-changes:58231

From: Takashi <ko1@a...>
Date: Mon, 14 Oct 2019 02:05:29 +0900 (JST)
Subject: [ruby-changes:58231] 26fae9aa9d (master): Remove the quick stop path after convert_unit_to_func

https://git.ruby-lang.org/ruby.git/commit/?id=26fae9aa9d

From 26fae9aa9db59fdee7422a276662b45611e98a22 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 13 Oct 2019 09:59:43 -0700
Subject: Remove the quick stop path after convert_unit_to_func

Now I'm not exactly sure why I needed to check `stop_worker_p` after
`mjit_copy_cache_from_main_thread` of `convert_unit_to_func`
in 4161674b2fbea6bdd01783ac5d3b39d88db22972.
If it's for avoiding deadlock under `in_gc` condition, we should keep it.

However, if it's not the case and it's just for retrying accidental
compilation failure or just to avoid `MJIT_ATOMIC_SET` and
`compact_all_jit_code`, I think this quick stop path is not mandatory.

Because this path is somewhat problematic in my upcoming fix in
mjit_worker, let me try to remove this first and see how CI goes.

diff --git a/mjit.c b/mjit.c
index 69dc234..3ae9410 100644
--- a/mjit.c
+++ b/mjit.c
@@ -802,9 +802,7 @@ mjit_pause(bool wait_p) https://github.com/ruby/ruby/blob/trunk/mjit.c#L802
         }
     }
 
-    mjit_pause_wait_p = wait_p; // Avoid cancelling the last compilation after the unit fetch if wait_p.
     stop_worker();
-    mjit_pause_wait_p = false;
     return Qtrue;
 }
 
diff --git a/mjit_worker.c b/mjit_worker.c
index 193213e..c3b8d57 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -210,8 +210,6 @@ static bool in_jit; https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L210
 static bool stop_worker_p;
 // Set to true if worker is stopped.
 static bool worker_stopped;
-// Set to true only when worker is being stopped for `RubyVM::MJIT.pause(wait: true)`.
-static bool mjit_pause_wait_p;
 
 // Path of "/tmp", which can be changed to $TMP in MinGW.
 static char *tmp_dir;
@@ -1230,12 +1228,6 @@ mjit_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1228
             mjit_func_t func = convert_unit_to_func(unit);
             (void)RB_DEBUG_COUNTER_INC_IF(mjit_compile_failures, func == (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC);
 
-            // Checking `stop_worker_p` here because `mjit_copy_cache_from_main_thread` in `mjit_compile` may wait
-            // for a long time and worker may be stopped during the compilation.
-            // However, we do not want to stop here when the `stop_worker()` is from `MJIT.pause(wait: true)`.
-            if (stop_worker_p && !mjit_pause_wait_p)
-                break;
-
             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");
-- 
cgit v0.10.2


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

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