ruby-changes:68605
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:10:34 +0900 (JST)
Subject: [ruby-changes:68605] 726bdd4d35 (master): Show whether MicroJIT is enabled in the version string
https://git.ruby-lang.org/ruby.git/commit/?id=726bdd4d35 From 726bdd4d35861f0373d7508ab4ac7b2c781edf51 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Mon, 5 Oct 2020 06:56:33 -0400 Subject: Show whether MicroJIT is enabled in the version string --- ruby.c | 4 ++-- version.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ruby.c b/ruby.c index 97498e4ef4..a2e3ae8058 100644 --- a/ruby.c +++ b/ruby.c @@ -1803,6 +1803,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1803 */ rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior"); + if (opt->features.set & FEATURE_BIT(ujit)) + rb_ujit_init(); #if USE_MJIT if (opt->features.set & FEATURE_BIT(jit)) { opt->mjit.on = TRUE; /* set mjit.on for ruby_show_version() API and check to call mjit_init() */ @@ -1869,8 +1871,6 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1871 /* Using TMP_RUBY_PREFIX created by ruby_init_loadpath(). */ mjit_init(&opt->mjit); #endif - if (opt->features.set & FEATURE_BIT(ujit)) - rb_ujit_init(); Init_ruby_description(); Init_enc(); diff --git a/version.c b/version.c index 49738211a4..0a0bcc01cd 100644 --- a/version.c +++ b/version.c @@ -13,6 +13,7 @@ https://github.com/ruby/ruby/blob/trunk/version.c#L13 #include "version.h" #include "vm_core.h" #include "mjit.h" +#include "ujit_compile.h" #include <stdio.h> #ifndef EXIT_SUCCESS @@ -41,7 +42,9 @@ const char ruby_release_date[] = RUBY_RELEASE_DATE; https://github.com/ruby/ruby/blob/trunk/version.c#L42 const char ruby_platform[] = RUBY_PLATFORM; const int ruby_patchlevel = RUBY_PATCHLEVEL; const char ruby_description[] = RUBY_DESCRIPTION_WITH(""); +const char ruby_description_with_ujit[] = RUBY_DESCRIPTION_WITH(" +UJIT"); static const char ruby_description_with_jit[] = RUBY_DESCRIPTION_WITH(" +JIT"); +static const char ruby_description_with_both_jits[] = RUBY_DESCRIPTION_WITH(" +JIT +UJIT"); const char ruby_copyright[] = RUBY_COPYRIGHT; const char ruby_engine[] = "ruby"; @@ -102,10 +105,20 @@ Init_ruby_description(void) https://github.com/ruby/ruby/blob/trunk/version.c#L105 VALUE description; if (MJIT_OPTS_ON) { - description = MKSTR(description_with_jit); + if (rb_ujit_enabled_p()) { + description = MKSTR(description_with_both_jits); + } + else { + description = MKSTR(description_with_jit); + } } else { - description = MKSTR(description); + if (rb_ujit_enabled_p()) { + description = MKSTR(description_with_ujit); + } + else { + description = MKSTR(description); + } } /* @@ -118,10 +131,20 @@ void https://github.com/ruby/ruby/blob/trunk/version.c#L131 ruby_show_version(void) { if (MJIT_OPTS_ON) { - PRINT(description_with_jit); + if (rb_ujit_enabled_p()) { + PRINT(description_with_both_jits); + } + else { + PRINT(description_with_jit); + } } else { - PRINT(description); + if (rb_ujit_enabled_p()) { + PRINT(description_with_ujit); + } + else { + PRINT(description); + } } #ifdef RUBY_LAST_COMMIT_TITLE fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/