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

ruby-changes:63987

From: Takashi <ko1@a...>
Date: Mon, 7 Dec 2020 13:24:11 +0900 (JST)
Subject: [ruby-changes:63987] 556a728508 (master): Lock active_units references on compaction

https://git.ruby-lang.org/ruby.git/commit/?id=556a728508

From 556a7285080c1344c75bb93a333c9bfc5d631c61 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 6 Dec 2020 20:23:19 -0800
Subject: Lock active_units references on compaction

This might race with mjit_recompile.

diff --git a/mjit_worker.c b/mjit_worker.c
index 725a922..56921da 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -936,7 +936,9 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L936
     // TODO: Consider using a more granular lock after we implement inlining across
     // 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) {
+        CRITICAL_SECTION_FINISH(3, "after active_units list_for_each");
         char funcname[MAXPATHLEN];
         sprint_funcname(funcname, child_unit);
 
@@ -950,7 +952,10 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L952
         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");
 
     // release blocking mjit_gc_start_hook
     CRITICAL_SECTION_START(3, "after mjit_compile to wakeup client for GC");
-- 
cgit v0.10.2


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

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