ruby-changes:66273
From: Takashi <ko1@a...>
Date: Thu, 20 May 2021 19:40:58 +0900 (JST)
Subject: [ruby-changes:66273] dfe21ef7a1 (master): Do not block JIT with pending_stale_p
https://git.ruby-lang.org/ruby.git/commit/?id=dfe21ef7a1 From dfe21ef7a15a30fc33f3a5cc089e15d09e905eb4 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Thu, 20 May 2021 03:33:28 -0700 Subject: Do not block JIT with pending_stale_p Because we want to flush pending stale units before unloading units, the pending_stale_p check is implemented in this waiting loop. However, once all methods are called more than --jit-min-calls, mjit_worker_wakeup will not be signaled again. As a result, when mjit_recompile is called after that and pending_stale_p becomes true, MJIT stops processing methods in the unit queue even if the queue is very long and MJIT does nothing, waiting for the signal. There should be a better way to handle this, but as a fix to be backported to Ruby 3.0, let me make an obvious simple commit here. --- mjit_worker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mjit_worker.c b/mjit_worker.c index c34f85c..24bc5c2 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -1368,7 +1368,7 @@ mjit_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1368 // Wait until a unit becomes available CRITICAL_SECTION_START(3, "in worker dequeue"); - while ((pending_stale_p || list_empty(&unit_queue.head) || active_units.length >= mjit_opts.max_cache_size) && !stop_worker_p) { + while ((list_empty(&unit_queue.head) || active_units.length >= mjit_opts.max_cache_size) && !stop_worker_p) { rb_native_cond_wait(&mjit_worker_wakeup, &mjit_engine_mutex); verbose(3, "Getting wakeup from client"); -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/