summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-10-17 09:27:59 -0700
committerGitHub <noreply@github.com>2022-10-17 09:27:59 -0700
commite7c71c6c9271b0c29f210769159090e17128e740 (patch)
tree536ec0057e05111955abe0a9cb38389af6c50d08 /ruby.c
parent07a93b1e378bf2ea356b0561e5e89e60d30fc684 (diff)
downloadruby-e7c71c6c9271b0c29f210769159090e17128e740.tar.gz
Make mjit_cont sharable with YJIT (#6556)
* Make mjit_cont sharable with YJIT * Update dependencies * Update YJIT binding
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index 752498f66c..0a3248f95f 100644
--- a/ruby.c
+++ b/ruby.c
@@ -44,6 +44,7 @@
#include "eval_intern.h"
#include "internal.h"
#include "internal/cmdlineopt.h"
+#include "internal/cont.h"
#include "internal/error.h"
#include "internal/file.h"
#include "internal/inits.h"
@@ -1618,6 +1619,12 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
rb_call_builtin_inits();
ruby_init_prelude();
+ // Make sure the saved_ec of the initial thread's root_fiber is scanned by rb_jit_cont_each_ec.
+ //
+ // rb_threadptr_root_fiber_setup for the initial thread is called before rb_yjit_enabled_p()
+ // or mjit_enabled becomes true, meaning jit_cont_new is skipped for the root_fiber.
+ // Therefore we need to call this again here to set the root_fiber's jit_cont.
+ rb_fiber_init_jit_cont(GET_EC()->fiber_ptr);
#if USE_MJIT
// mjit_init is safe only after rb_call_builtin_inits defines RubyVM::MJIT::Compiler
if (opt->mjit.on)