diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 6578ffe..3e8aac6 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2521,6 +2521,7 @@ int ruby_run_node(void *n); /* version.c */ void ruby_show_version(void); +void ruby_show_version_with_jit(int jit_on); void ruby_show_copyright(void); diff --git a/ruby.c b/ruby.c index 79fb6d1..90a2868 100644 --- a/ruby.c +++ b/ruby.c @@ -1555,7 +1555,11 @@ 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))) { - ruby_show_version(); + int jit_on = opt->mjit.on; +#ifdef MJIT_FORCE_ENABLE + jit_on = 1; +#endif + ruby_show_version_with_jit(jit_on); if (opt->dump & DUMP_BIT(version)) return Qtrue; } if (opt->dump & DUMP_BIT(copyright)) { diff --git a/version.c b/version.c index 4c7b1ab..55d8530 100644 --- a/version.c +++ b/version.c @@ -86,7 +86,16 @@ Init_version(void) void ruby_show_version(void) { - PRINT(description); + ruby_show_version_with_jit(0); +} + +/*! Prints the version information of the CRuby interpreter to stdout, including JIT information. */ +void +ruby_show_version_with_jit(int jit_on) +{ + printf("%s", ruby_description); + if (jit_on) printf(" +JIT"); + printf("\n"); #ifdef RUBY_LAST_COMMIT_TITLE fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout); #endif