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

ruby-changes:64179

From: Takashi <ko1@a...>
Date: Tue, 15 Dec 2020 16:36:14 +0900 (JST)
Subject: [ruby-changes:64179] 5463eff5f6 (master): Lock only active_units references

https://git.ruby-lang.org/ruby.git/commit/?id=5463eff5f6

From 5463eff5f6236f89c137c562ee271e1c1ff92a89 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 14 Dec 2020 23:33:49 -0800
Subject: Lock only active_units references

556a7285080c1344c75bb93a333c9bfc5d631c61 was not good maybe because it
wasn't using list_for_each_safe. If list_for_each_safe is safe for
list_del for any nodes (is that true?), this should be fine.

diff --git a/mjit_worker.c b/mjit_worker.c
index 5fbad3f..4dcf076 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -947,7 +947,8 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L947
     // compacted functions (not done yet).
     bool success = true;
     CRITICAL_SECTION_START(3, "before active_units list_for_each");
-    list_for_each(&active_units.head, child_unit, unode) {
+    list_for_each_safe(&active_units.head, child_unit, next, unode) {
+        CRITICAL_SECTION_FINISH(3, "after active_units list_for_each");
         char funcname[MAXPATHLEN];
         sprint_funcname(funcname, child_unit);
 
@@ -961,6 +962,8 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L962
         if (!iseq_label) iseq_label = sep = "";
         fprintf(f, "\n/* %s%s%s:%ld */\n", iseq_label, sep, iseq_path, iseq_lineno);
         success &= mjit_compile(f, child_unit->iseq, funcname, child_unit->id);
+
+        CRITICAL_SECTION_START(3, "before active_units list_for_each");
     }
     CRITICAL_SECTION_FINISH(3, "after active_units list_for_each");
 
-- 
cgit v0.10.2


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

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