diff options
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -306,8 +306,8 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq) /* Wait for JIT compilation finish for --jit-wait. This should only return a function pointer or NOT_COMPILED_JIT_ISEQ_FUNC. */ -mjit_func_t -mjit_get_iseq_func(struct rb_iseq_constant_body *body) +VALUE +mjit_wait_call(rb_execution_context_t *ec, struct rb_iseq_constant_body *body) { struct timeval tv; int tries = 0; @@ -316,19 +316,23 @@ mjit_get_iseq_func(struct rb_iseq_constant_body *body) while (body->jit_func == (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC) { tries++; if (tries / 1000 > MJIT_WAIT_TIMEOUT_SECONDS || pch_status == PCH_FAILED) { - CRITICAL_SECTION_START(3, "in mjit_get_iseq_func to set jit_func"); + CRITICAL_SECTION_START(3, "in mjit_wait_call to set jit_func"); body->jit_func = (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC; /* JIT worker seems dead. Give up. */ - CRITICAL_SECTION_FINISH(3, "in mjit_get_iseq_func to set jit_func"); + CRITICAL_SECTION_FINISH(3, "in mjit_wait_call to set jit_func"); mjit_warning("timed out to wait for JIT finish"); break; } - CRITICAL_SECTION_START(3, "in mjit_get_iseq_func for a client wakeup"); + CRITICAL_SECTION_START(3, "in mjit_wait_call for a client wakeup"); rb_native_cond_broadcast(&mjit_worker_wakeup); - CRITICAL_SECTION_FINISH(3, "in mjit_get_iseq_func for a client wakeup"); + CRITICAL_SECTION_FINISH(3, "in mjit_wait_call for a client wakeup"); rb_thread_wait_for(tv); } - return body->jit_func; + + if ((uintptr_t)body->jit_func <= (uintptr_t)LAST_JIT_ISEQ_FUNC) { + return Qundef; + } + return body->jit_func(ec, ec->cfp); } extern VALUE ruby_archlibdir_path, ruby_prefix_path; |