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

ruby-changes:68643

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:11:37 +0900 (JST)
Subject: [ruby-changes:68643] 595e3a94fd (master): Fix MicroJIT logic in MJIT exec

https://git.ruby-lang.org/ruby.git/commit/?id=595e3a94fd

From 595e3a94fd11a435eccd3356492ee775b622ce2b Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Mon, 19 Oct 2020 11:42:05 -0400
Subject: Fix MicroJIT logic in MJIT exec

---
 mjit.h | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/mjit.h b/mjit.h
index b9cbf37a19..fc99da04a7 100644
--- a/mjit.h
+++ b/mjit.h
@@ -143,21 +143,25 @@ mjit_exec(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/mjit.h#L143
     const rb_iseq_t *iseq;
     struct rb_iseq_constant_body *body;
 
-    if (!mjit_call_p && !rb_ujit_enabled_p())
-        return Qundef;
-    RB_DEBUG_COUNTER_INC(mjit_exec);
-
-    iseq = ec->cfp->iseq;
-    body = iseq->body;
-    body->total_calls++;
+    if (mjit_call_p || rb_ujit_enabled_p()) {
+        iseq = ec->cfp->iseq;
+        body = iseq->body;
+        body->total_calls++;
+    }
 
 #ifndef MJIT_HEADER
     const int ujit_call_threashold = 10;
-    if (body->total_calls == ujit_call_threashold && !mjit_call_p) {
+    if (rb_ujit_enabled_p() && !mjit_call_p && body->total_calls == ujit_call_threashold)  {
         rb_ujit_compile_iseq(iseq);
+        return Qundef;
     }
 #endif
 
+    if (!mjit_call_p)
+        return Qundef;
+
+    RB_DEBUG_COUNTER_INC(mjit_exec);
+
     mjit_func_t func = body->jit_func;
     if (UNLIKELY((uintptr_t)func <= LAST_JIT_ISEQ_FUNC)) {
 #  ifdef MJIT_HEADER
-- 
cgit v1.2.1


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

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