From c1ce3d719dab2761fbca37f9336a33b47af187ed Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 14 Feb 2025 10:40:00 -0800 Subject: [PATCH] Streamline YJIT checks on jit_compile() --- vm.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/vm.c b/vm.c index c00c96b6e2..d4d57b363c 100644 --- a/vm.c +++ b/vm.c @@ -433,15 +433,12 @@ jit_compile(rb_execution_context_t *ec) { const rb_iseq_t *iseq = ec->cfp->iseq; struct rb_iseq_constant_body *body = ISEQ_BODY(iseq); - bool yjit_enabled = rb_yjit_enabled_p; // Increment the ISEQ's call counter and trigger JIT compilation if not compiled - if (body->jit_entry == NULL && yjit_enabled) { + if (body->jit_entry == NULL && rb_yjit_enabled_p) { body->jit_entry_calls++; - if (yjit_enabled) { - if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) { - rb_yjit_compile_iseq(iseq, ec, false); - } + if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) { + rb_yjit_compile_iseq(iseq, ec, false); } } return body->jit_entry; @@ -477,18 +474,14 @@ jit_compile_exception(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) { - return NULL; - } // Increment the ISEQ's call counter and trigger JIT compilation if not compiled - if (body->jit_exception == NULL) { + if (body->jit_exception == NULL && rb_yjit_enabled_p) { body->jit_exception_calls++; if (body->jit_exception_calls == rb_yjit_call_threshold) { rb_yjit_compile_iseq(iseq, ec, true); } } - return body->jit_exception; }