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

ruby-changes:58233

From: Takashi <ko1@a...>
Date: Mon, 14 Oct 2019 06:15:37 +0900 (JST)
Subject: [ruby-changes:58233] 183b421509 (master): Delay the free until we stop referring to a unit

https://git.ruby-lang.org/ruby.git/commit/?id=183b421509

From 183b42150962e507cd69ceddb64ad2a10f02fdfa Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 13 Oct 2019 14:11:02 -0700
Subject: Delay the free until we stop referring to a unit

`if (unit->iseq)` might have referred to a freed unit. Therefore this
commit delays its free.

diff --git a/mjit_worker.c b/mjit_worker.c
index c3b8d57..2650b1d 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -1038,7 +1038,6 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1038
         fclose(f);
         if (!mjit_opts.save_temps)
             remove_file(c_file);
-        free_unit(unit);
         in_jit = false; // just being explicit for return
     }
     else {
@@ -1237,6 +1236,9 @@ mjit_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1236
                 // Usage of jit_code might be not in a critical section.
                 MJIT_ATOMIC_SET(unit->iseq->body->jit_func, func);
             }
+            else {
+                free_unit(unit);
+            }
             CRITICAL_SECTION_FINISH(3, "in jit func replace");
 
 #ifndef _MSC_VER
-- 
cgit v0.10.2


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

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