summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2025-02-14 10:40:00 -0800
committerTakashi Kokubun <[email protected]>2025-02-14 10:40:10 -0800
commitc1ce3d719dab2761fbca37f9336a33b47af187ed (patch)
treef38be208da1bc238198878bb3c0e2e0586453ed8 /vm.c
parentdeb010ae248879b1c577366f5349b6094536bf4e (diff)
Streamline YJIT checks on jit_compile()
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c15
1 files 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;
}