aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-10-19 11:42:05 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:25 -0400
commit595e3a94fd11a435eccd3356492ee775b622ce2b (patch)
tree261fe34705222de0c65a671dfb7ce5b06d8dcd22 /mjit.h
parent6f4d17d62236460fd5aa9d07fea4d6794f27c397 (diff)
downloadruby-595e3a94fd11a435eccd3356492ee775b622ce2b.tar.gz
Fix MicroJIT logic in MJIT exec
Diffstat (limited to 'mjit.h')
-rw-r--r--mjit.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/mjit.h b/mjit.h
index b9cbf37a19..fc99da04a7 100644
--- a/mjit.h
+++ b/mjit.h
@@ -143,21 +143,25 @@ mjit_exec(rb_execution_context_t *ec)
const rb_iseq_t *iseq;
struct rb_iseq_constant_body *body;
- if (!mjit_call_p && !rb_ujit_enabled_p())
- return Qundef;
- RB_DEBUG_COUNTER_INC(mjit_exec);
-
- iseq = ec->cfp->iseq;
- body = iseq->body;
- body->total_calls++;
+ if (mjit_call_p || rb_ujit_enabled_p()) {
+ iseq = ec->cfp->iseq;
+ body = iseq->body;
+ body->total_calls++;
+ }
#ifndef MJIT_HEADER
const int ujit_call_threashold = 10;
- if (body->total_calls == ujit_call_threashold && !mjit_call_p) {
+ if (rb_ujit_enabled_p() && !mjit_call_p && body->total_calls == ujit_call_threashold) {
rb_ujit_compile_iseq(iseq);
+ return Qundef;
}
#endif
+ if (!mjit_call_p)
+ return Qundef;
+
+ RB_DEBUG_COUNTER_INC(mjit_exec);
+
mjit_func_t func = body->jit_func;
if (UNLIKELY((uintptr_t)func <= LAST_JIT_ISEQ_FUNC)) {
# ifdef MJIT_HEADER