Skip to content

Commit c1ce3d7

Browse files
committed
Streamline YJIT checks on jit_compile()
1 parent deb010a commit c1ce3d7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

vm.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,12 @@ jit_compile(rb_execution_context_t *ec)
433433
{
434434
const rb_iseq_t *iseq = ec->cfp->iseq;
435435
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
436-
bool yjit_enabled = rb_yjit_enabled_p;
437436

438437
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
439-
if (body->jit_entry == NULL && yjit_enabled) {
438+
if (body->jit_entry == NULL && rb_yjit_enabled_p) {
440439
body->jit_entry_calls++;
441-
if (yjit_enabled) {
442-
if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) {
443-
rb_yjit_compile_iseq(iseq, ec, false);
444-
}
440+
if (rb_yjit_threshold_hit(iseq, body->jit_entry_calls)) {
441+
rb_yjit_compile_iseq(iseq, ec, false);
445442
}
446443
}
447444
return body->jit_entry;
@@ -477,18 +474,14 @@ jit_compile_exception(rb_execution_context_t *ec)
477474
{
478475
const rb_iseq_t *iseq = ec->cfp->iseq;
479476
struct rb_iseq_constant_body *body = ISEQ_BODY(iseq);
480-
if (!rb_yjit_enabled_p) {
481-
return NULL;
482-
}
483477

484478
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
485-
if (body->jit_exception == NULL) {
479+
if (body->jit_exception == NULL && rb_yjit_enabled_p) {
486480
body->jit_exception_calls++;
487481
if (body->jit_exception_calls == rb_yjit_call_threshold) {
488482
rb_yjit_compile_iseq(iseq, ec, true);
489483
}
490484
}
491-
492485
return body->jit_exception;
493486
}
494487

0 commit comments

Comments
 (0)