summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-09-04 21:53:46 -0700
committerGitHub <noreply@github.com>2022-09-04 21:53:46 -0700
commit3767c6a90d8970f9b39e9ed116a7b9bbac3f9f26 (patch)
tree36e1c581b45edebcba4b33e1ca3f35c6fffa05f4 /ruby.c
parent277498e2a2b62b564e3d39ca54aa15b6e8a2c41a (diff)
downloadruby-3767c6a90d8970f9b39e9ed116a7b9bbac3f9f26.tar.gz
Ruby MJIT (#6028)
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ruby.c b/ruby.c
index 4f33267d73..cefa774639 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1563,11 +1563,23 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
rb_warning_category_update(opt->warn.mask, opt->warn.set);
+#if USE_MJIT
+ // rb_call_builtin_inits depends on RubyVM::MJIT.enabled?
+ if (opt->mjit.on)
+ mjit_enabled = true;
+#endif
+
Init_ext(); /* load statically linked extensions before rubygems */
Init_extra_exts();
rb_call_builtin_inits();
ruby_init_prelude();
+#if USE_MJIT
+ // mjit_init is safe only after rb_call_builtin_inits defines RubyVM::MJIT::Compiler
+ if (opt->mjit.on)
+ mjit_init(&opt->mjit);
+#endif
+
ruby_set_script_name(opt->script_name);
require_libraries(&opt->req_list);
}
@@ -1915,12 +1927,6 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
ruby_gc_set_params();
ruby_init_loadpath();
-#if USE_MJIT
- if (opt->mjit.on)
- /* Using TMP_RUBY_PREFIX created by ruby_init_loadpath(). */
- mjit_init(&opt->mjit);
-#endif
-
Init_enc();
lenc = rb_locale_encoding();
rb_enc_associate(rb_progname, lenc);