diff options
| -rw-r--r-- | mjit.c | 6 | ||||
| -rw-r--r-- | mjit.h | 2 | ||||
| -rw-r--r-- | vm.c | 11 |
3 files changed, 15 insertions, 4 deletions
@@ -371,6 +371,12 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id) // void +rb_mjit_compile(const rb_iseq_t *iseq) +{ + // TODO: implement +} + +void mjit_init(const struct mjit_options *opts) { VM_ASSERT(mjit_enabled); @@ -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); @@ -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 |
