diff --git a/mjit.c b/mjit.c index 6e8bbd8852..48bebb0e7e 100644 --- a/mjit.c +++ b/mjit.c @@ -370,6 +370,12 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id) // New stuff from here // +void +rb_mjit_compile(const rb_iseq_t *iseq) +{ + // TODO: implement +} + void mjit_init(const struct mjit_options *opts) { diff --git a/mjit.h b/mjit.h index 260cf4af78..cea1677e9b 100644 --- a/mjit.h +++ b/mjit.h @@ -85,7 +85,7 @@ RUBY_SYMBOL_EXPORT_BEGIN RUBY_EXTERN struct mjit_options mjit_opts; RUBY_EXTERN bool mjit_call_p; -extern void rb_mjit_add_iseq_to_process(const rb_iseq_t *iseq); +extern void rb_mjit_compile(const rb_iseq_t *iseq); extern struct rb_mjit_compile_info* rb_mjit_iseq_compile_info(const struct rb_iseq_constant_body *body); extern void rb_mjit_recompile_send(const rb_iseq_t *iseq); extern void rb_mjit_recompile_ivar(const rb_iseq_t *iseq); diff --git a/vm.c b/vm.c index 105bca6290..822c2c7ba4 100644 --- a/vm.c +++ b/vm.c @@ -395,7 +395,7 @@ mjit_check_iseq(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_ise switch ((enum rb_mjit_func_state)mjit_state) { case MJIT_FUNC_NOT_COMPILED: if (body->total_calls == mjit_opts.call_threshold) { - rb_mjit_add_iseq_to_process(iseq); + rb_mjit_compile(iseq); if (UNLIKELY(mjit_opts.wait && !MJIT_FUNC_STATE_P(body->jit_func))) { return body->jit_func(ec, ec->cfp); } @@ -441,8 +441,13 @@ jit_exec(rb_execution_context_t *ec) return Qundef; } } - else if (UNLIKELY(MJIT_FUNC_STATE_P(func = body->jit_func))) { - return mjit_check_iseq(ec, iseq, body); + else { // mjit_call_p + if (body->total_calls == mjit_opts.call_threshold) { + rb_mjit_compile(iseq); + } + if ((func = body->jit_func) == 0) { + return Qundef; + } } // Call the JIT code