From 171c496e5082c2e1e9aad80bcd204c1e850512c1 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Thu, 22 Feb 2018 14:53:17 +0000 Subject: version.c: show +JIT when --jit is passed in version output. version.h: ditto ruby.c: propagate option for it common.mk: updated dependency for version.c mjit.c: overwrites the RUBY_DESCRIPTION to have +JIT when --jit is passed test/ruby/test_rubyoptions.rb: add test for them Only `ruby --jit -v` will have "+JIT", but this is intentional. This may not be convenient for debugging by ticket with `ruby -v`, but it's convenient for benchmark tools that pass options (--jit) when showing it. At least such behavior is planned for benchmark_driver.gem and this behavior is designed for it. Other benchmark tools are recommended to follow the behavior too if they show version. RUBY_DESCRIPTION might be useful for it too. The position of "+JIT" is changed from original proposal because other platforms like JRuby and TruffleRuby end it with archtecture. It's made similar to JRuby, but it's upper-cased because Matz made approval for "+JIT" in the ticket. Example: $ ruby -v ruby 2.6.0dev (2018-02-22 trunk 62529) [x86_64-linux] $ ruby --jit -v ruby 2.6.0dev (2018-02-22 trunk 62529) +JIT [x86_64-linux] After --jit is made default in the future, this output may be removed. So do not rely on this output if possible. [Feature #14462] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index 46451bf727..081b0a154f 100644 --- a/ruby.c +++ b/ruby.c @@ -1506,6 +1506,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) const struct rb_block *base_block; unsigned int dump = opt->dump & dump_exit_bits; +#ifndef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */ + opt->mjit.on = 1; +#endif + if (opt->dump & (DUMP_BIT(usage)|DUMP_BIT(help))) { const char *const progname = (argc > 0 && argv && argv[0] ? argv[0] : @@ -1538,6 +1542,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior"); if (opt->dump & (DUMP_BIT(version) | DUMP_BIT(version_v))) { + mjit_opts.on = opt->mjit.on; /* used by ruby_show_version(). mjit_init() is still not called here. */ ruby_show_version(); if (opt->dump & DUMP_BIT(version)) return Qtrue; } @@ -1590,9 +1595,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) ruby_gc_set_params(opt->safe_level); ruby_init_loadpath_safe(opt->safe_level); -#ifndef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */ if (opt->mjit.on) -#endif /* Using TMP_RUBY_PREFIX created by ruby_init_loadpath_safe(). */ mjit_init(&opt->mjit); -- cgit v1.2.3