From 62c1d8187b21b7741284d179c7cb313ee661f806 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 19 Oct 2023 17:51:01 -0700 Subject: [PATCH] Partly revert a change in #8705 Having this variable actually helps the performance of non-JITed calls. ----- ----------- ---------- ---------- ---------- ------------- ------------ bench before (ms) stddev (%) after (ms) stddev (%) after 1st itr before/after fib 241.9 0.5 225.4 1.0 1.06 1.07 ----- ----------- ---------- ---------- ---------- ------------- ------------ (benchmarked with --yjit-cold-threshold=0) --- vm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vm.c b/vm.c index cd6d4a5547..ebaee54953 100644 --- a/vm.c +++ b/vm.c @@ -426,14 +426,15 @@ jit_compile(rb_execution_context_t *ec) { const rb_iseq_t *iseq = ec->cfp->iseq; struct rb_iseq_constant_body *body = ISEQ_BODY(iseq); - if (!(rb_yjit_enabled_p || rb_rjit_call_p)) { + bool yjit_enabled = rb_yjit_enabled_p; + if (!(yjit_enabled || rb_rjit_call_p)) { return NULL; } // Increment the ISEQ's call counter and trigger JIT compilation if not compiled if (body->jit_entry == NULL) { body->jit_entry_calls++; - if (rb_yjit_enabled_p) { + if (yjit_enabled) { if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) { rb_yjit_compile_iseq(iseq, ec, false); }