From b9332ac8e7126066ac4238443d63eaa4c06789f9 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 24 Dec 2022 01:13:40 -0800 Subject: 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. --- ractor.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ractor.c') diff --git a/ractor.c b/ractor.c index fddcec382b..e608e4e232 100644 --- a/ractor.c +++ b/ractor.c @@ -17,6 +17,7 @@ #include "gc.h" #include "transient_heap.h" #include "yjit.h" +#include "mjit.h" VALUE rb_cRactor; @@ -1606,6 +1607,7 @@ ractor_create(rb_execution_context_t *ec, VALUE self, VALUE loc, VALUE name, VAL r->debug = cr->debug; rb_yjit_before_ractor_spawn(); + rb_mjit_before_ractor_spawn(); rb_thread_create_ractor(r, args, block); RB_GC_GUARD(rv); -- cgit v1.2.3