ruby-changes:64108
From: Takashi <ko1@a...>
Date: Sat, 12 Dec 2020 12:59:33 +0900 (JST)
Subject: [ruby-changes:64108] 3e23991345 (master): Lock GC while searching the best iseq
https://git.ruby-lang.org/ruby.git/commit/?id=3e23991345 From 3e2399134509930f3fe4d98787264f3a2c96af4c Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 11 Dec 2020 19:58:45 -0800 Subject: Lock GC while searching the best iseq To fix http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3286265 diff --git a/mjit_worker.c b/mjit_worker.c index 6e43169..5fbad3f 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -500,9 +500,14 @@ mjit_valid_class_serial_p(rb_serial_t class_serial) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L500 static struct rb_mjit_unit * get_from_list(struct rb_mjit_unit_list *list) { - struct rb_mjit_unit *unit = NULL, *next, *best = NULL; + while (in_gc) { + verbose(3, "Waiting wakeup from GC"); + rb_native_cond_wait(&mjit_gc_wakeup, &mjit_engine_mutex); + } + in_jit = true; // Lock GC // Find iseq with max total_calls + struct rb_mjit_unit *unit = NULL, *next, *best = NULL; list_for_each_safe(&list->head, unit, next, unode) { if (unit->iseq == NULL) { // ISeq is GCed. remove_from_list(unit, list); @@ -514,6 +519,11 @@ get_from_list(struct rb_mjit_unit_list *list) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L519 best = unit; } } + + in_jit = false; // Unlock GC + verbose(3, "Sending wakeup signal to client in a mjit-worker for GC"); + rb_native_cond_signal(&mjit_client_wakeup); + if (best) { remove_from_list(best, list); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/