summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-08-12 22:54:40 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2021-08-12 23:11:38 -0700
commitb3f8c491efefc0461ab225d062f6c64286498609 (patch)
tree5d3fbb4fe76d37f91bafbdb4b5fff9ce28d8f7ce /mjit.c
parent1a16940291301ace49cba0f37154a67033ab27c0 (diff)
Print JIT cancel when all JIT-ed code is cancelled
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mjit.c b/mjit.c
index 5ca4d6849e..57f28476ca 100644
--- a/mjit.c
+++ b/mjit.c
@@ -83,6 +83,16 @@ mjit_gc_exit_hook(void)
CRITICAL_SECTION_FINISH(4, "mjit_gc_exit_hook");
}
+// Prohibit calling JIT-ed code and let existing JIT-ed frames exit before the next insn.
+void
+mjit_cancel_all(const char *reason)
+{
+ mjit_call_p = false;
+ if (mjit_opts.warnings || mjit_opts.verbose) {
+ fprintf(stderr, "JIT cancel: Disabled JIT-ed code because %s\n", reason);
+ }
+}
+
// Deal with ISeq movement from compactor
void
mjit_update_references(const rb_iseq_t *iseq)
@@ -96,7 +106,7 @@ mjit_update_references(const rb_iseq_t *iseq)
// We need to invalidate JIT-ed code for the ISeq because it embeds pointer addresses.
// To efficiently do that, we use the same thing as TracePoint and thus everything is cancelled for now.
// See mjit.h and tool/ruby_vm/views/_mjit_compile_insn.erb for how `mjit_call_p` is used.
- mjit_call_p = false; // TODO: instead of cancelling all, invalidate only this one and recompile it with some threshold.
+ mjit_cancel_all("GC.compact is used"); // TODO: instead of cancelling all, invalidate only this one and recompile it with some threshold.
}
// Units in stale_units (list of over-speculated and invalidated code) are not referenced from