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

ruby-changes:72181

From: Takashi <ko1@a...>
Date: Thu, 16 Jun 2022 13:33:14 +0900 (JST)
Subject: [ruby-changes:72181] 1ffc6c43f6 (master): MJIT: Deal with mjit_free_iseq on mjit_notify_waitpid

https://git.ruby-lang.org/ruby.git/commit/?id=1ffc6c43f6

From 1ffc6c43f696fc18f1d3b52b09a2ef0dd00ac09c Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 15 Jun 2022 21:32:29 -0700
Subject: MJIT: Deal with mjit_free_iseq on mjit_notify_waitpid

---
 mjit.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/mjit.c b/mjit.c
index 45b2d13674..043bb34c32 100644
--- a/mjit.c
+++ b/mjit.c
@@ -355,16 +355,18 @@ mjit_notify_waitpid(int status) https://github.com/ruby/ruby/blob/trunk/mjit.c#L355
             remove_file(so_file);
 
         // Set the jit_func if successful
-        if ((uintptr_t)func > (uintptr_t)LAST_JIT_ISEQ_FUNC) {
+        if (current_cc_unit->iseq != NULL) { // mjit_free_iseq could nullify this
             rb_iseq_t *iseq = current_cc_unit->iseq;
-            double end_time = real_ms_time();
-            verbose(1, "JIT success (%.1fms): %s@%s:%ld -> %s",
-                    end_time - current_cc_ms, RSTRING_PTR(ISEQ_BODY(iseq)->location.label),
-                    RSTRING_PTR(rb_iseq_path(iseq)), FIX2LONG(ISEQ_BODY(iseq)->location.first_lineno), c_file);
+            if ((uintptr_t)func > (uintptr_t)LAST_JIT_ISEQ_FUNC) {
+                double end_time = real_ms_time();
+                verbose(1, "JIT success (%.1fms): %s@%s:%ld -> %s",
+                        end_time - current_cc_ms, RSTRING_PTR(ISEQ_BODY(iseq)->location.label),
+                        RSTRING_PTR(rb_iseq_path(iseq)), FIX2LONG(ISEQ_BODY(iseq)->location.first_lineno), c_file);
 
-            add_to_list(current_cc_unit, &active_units);
+                add_to_list(current_cc_unit, &active_units);
+            }
             MJIT_ATOMIC_SET(ISEQ_BODY(iseq)->jit_func, func);
-        }
+        } // TODO: free unit on else?
         current_cc_unit = NULL;
 
         // Run compaction if it should
-- 
cgit v1.2.1


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

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