ruby-changes:64730
From: Takashi <ko1@a...>
Date: Mon, 4 Jan 2021 17:24:32 +0900 (JST)
Subject: [ruby-changes:64730] 095972e799 (master): Skip mjit_wait if iseq is not a target
https://git.ruby-lang.org/ruby.git/commit/?id=095972e799 From 095972e79959966d1177275fab3cf2e6512f6dd3 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 4 Jan 2021 00:16:40 -0800 Subject: Skip mjit_wait if iseq is not a target diff --git a/mjit.c b/mjit.c index 4dad746..36416c6 100644 --- a/mjit.c +++ b/mjit.c @@ -263,12 +263,26 @@ create_unit(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/mjit.c#L263 iseq->body->jit_unit = unit; } +// Return true if given ISeq body should be compiled by MJIT +static inline int +mjit_target_iseq_p(struct rb_iseq_constant_body *body) +{ + return (body->type == ISEQ_TYPE_METHOD || body->type == ISEQ_TYPE_BLOCK) + && !body->builtin_inline_p + && body->iseq_size < JIT_ISEQ_SIZE_THRESHOLD; +} + static void mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_info *compile_info) { if (!mjit_enabled || pch_status == PCH_FAILED) return; + if (!mjit_target_iseq_p(iseq->body)) { + iseq->body->jit_func = (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC; // skip mjit_wait + return; + } + RB_DEBUG_COUNTER_INC(mjit_add_iseq_to_process); iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC; create_unit(iseq); diff --git a/mjit.h b/mjit.h index 80138f7..3ef3379 100644 --- a/mjit.h +++ b/mjit.h @@ -107,15 +107,6 @@ extern void mjit_mark_cc_entries(const struct rb_iseq_constant_body *const body) https://github.com/ruby/ruby/blob/trunk/mjit.h#L107 // takes too much time to be compiled. #define JIT_ISEQ_SIZE_THRESHOLD 1000 -// Return TRUE if given ISeq body should be compiled by MJIT -static inline int -mjit_target_iseq_p(struct rb_iseq_constant_body *body) -{ - return (body->type == ISEQ_TYPE_METHOD || body->type == ISEQ_TYPE_BLOCK) - && !body->builtin_inline_p - && body->iseq_size < JIT_ISEQ_SIZE_THRESHOLD; -} - # ifdef MJIT_HEADER NOINLINE(static COLDFUNC VALUE mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_iseq_constant_body *body)); # else @@ -129,7 +120,7 @@ mjit_exec_slowpath(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_ https://github.com/ruby/ruby/blob/trunk/mjit.h#L120 switch ((enum rb_mjit_iseq_func)func_i) { case NOT_ADDED_JIT_ISEQ_FUNC: RB_DEBUG_COUNTER_INC(mjit_exec_not_added); - if (body->total_calls == mjit_opts.min_calls && mjit_target_iseq_p(body)) { + if (body->total_calls == mjit_opts.min_calls) { rb_mjit_add_iseq_to_process(iseq); if (UNLIKELY(mjit_opts.wait)) { return rb_mjit_wait_call(ec, body); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/