summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-24 01:13:40 -0800
committerGitHub <noreply@github.com>2022-12-24 01:13:40 -0800
commitb9332ac8e7126066ac4238443d63eaa4c06789f9 (patch)
tree1d3d45ec28ddbcc7e124d026540be61cf4ef3840 /vm_insnhelper.c
parentd521c9e5a7ed603f8f1aaa9a9a66c3cc80599b0c (diff)
downloadruby-b9332ac8e7126066ac4238443d63eaa4c06789f9.tar.gz
MJIT: Cancel all on disastrous situations (#7019)
I noticed this while running test_yjit with --mjit-call-threshold=1, which redefines `Integer#<`. When Ruby is monkey-patched, MJIT itself could be broken. Similarly, Ruby scripts could break MJIT in many different ways. I prepared the same set of hooks as YJIT so that we could possibly override it and disable it on those moments. Every constant under RubyVM::MJIT is private and thus it's an unsupported behavior though.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 68b8d89abb..aa5e565f10 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -5324,13 +5324,11 @@ vm_ic_update(const rb_iseq_t *iseq, IC ic, VALUE val, const VALUE *reg_ep, const
ice->ic_cref = vm_get_const_key_cref(reg_ep);
if (rb_ractor_shareable_p(val)) ice->flags |= IMEMO_CONST_CACHE_SHAREABLE;
RB_OBJ_WRITE(iseq, &ic->entry, ice);
-#ifndef MJIT_HEADER
- // MJIT and YJIT can't be on at the same time, so there is no need to
- // notify YJIT about changes to the IC when running inside MJIT code.
+
RUBY_ASSERT(pc >= ISEQ_BODY(iseq)->iseq_encoded);
unsigned pos = (unsigned)(pc - ISEQ_BODY(iseq)->iseq_encoded);
rb_yjit_constant_ic_update(iseq, ic, pos);
-#endif
+ rb_mjit_constant_ic_update(iseq, ic, pos);
}
static VALUE