summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-10 23:55:33 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-05 22:11:20 -0800
commit251f976235430effddf82cb08ac0e389ddd36a74 (patch)
treecd8a5e4e7c1e738f9d3180c81c22a8d0678d2a1f /vm.c
parent3c093fe391914dcfc10c69971164a66cb71c6bd3 (diff)
downloadruby-251f976235430effddf82cb08ac0e389ddd36a74.tar.gz
Prepare rb_mjit_compile hook
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c11
1 files changed, 8 insertions, 3 deletions
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