ruby-changes:70192
From: Takashi <ko1@a...>
Date: Tue, 14 Dec 2021 09:08:28 +0900 (JST)
Subject: [ruby-changes:70192] 11b8aaa26a (master): Rename --jit to --mjit (#5248)
https://git.ruby-lang.org/ruby.git/commit/?id=11b8aaa26a From 11b8aaa26a22bb67b144484af6890844771b5f46 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 13 Dec 2021 16:08:01 -0800 Subject: Rename --jit to --mjit (#5248) * Rename --jit to --mjit [Feature #18349] * Fix a few more --jit references * Fix MJIT Actions * More s/jit/mjit/ and re-introduce --disable-jit * Update NEWS.md * Fix test_bug_reporter_add --- .github/workflows/mjit.yml | 4 +- NEWS.md | 11 +++-- mjit_worker.c | 4 +- ruby.c | 62 +++++++++++++++++++--------- template/fake.rb.in | 2 +- test/-ext-/bug_reporter/test_bug_reporter.rb | 2 +- test/lib/jit_support.rb | 12 +++--- test/ruby/test_jit.rb | 4 +- test/ruby/test_jit_debug.rb | 4 +- test/ruby/test_rubyoptions.rb | 30 +++++++++----- test/ruby/test_yjit.rb | 9 ++++ version.c | 6 +-- win32/Makefile.sub | 4 +- yjit.c | 12 ++---- yjit.h | 7 ++++ yjit_iface.c | 2 +- 16 files changed, 111 insertions(+), 64 deletions(-) diff --git a/.github/workflows/mjit.yml b/.github/workflows/mjit.yml index 8b0011ec378..0578104c7f5 100644 --- a/.github/workflows/mjit.yml +++ b/.github/workflows/mjit.yml @@ -20,12 +20,12 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/mjit.yml#L20 strategy: matrix: test_task: [ "check" ] # to make job names consistent - jit_opts: [ "--jit", "--jit-wait" ] + jit_opts: [ "--mjit", "--mjit-wait" ] fail-fast: false runs-on: ubuntu-latest env: TESTOPTS: '-q --tty=no' - RUN_OPTS: '--disable-gems ${{ matrix.jit_opts }} --jit-debug=-ggdb3' + RUN_OPTS: '--disable-gems ${{ matrix.jit_opts }} --mjit-debug=-ggdb3' GITPULLOPTIONS: --no-tags origin ${{github.ref}} steps: - run: mkdir build diff --git a/NEWS.md b/NEWS.md index 2476d6e149e..93525c1d87e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -419,9 +419,14 @@ Excluding feature bug fixes. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L419 This feature is turned off by default and can be enabled by compiling Ruby with flag `USE_RVARGC=1` set. [[Feature #18045]] [[Feature #18239]] -### JIT +## JIT -* The default `--jit-max-cache` is changed from 100 to 10000. +* Rename Ruby 3.0's `--jit` to `--mjit`, and alias `--jit` to `--yjit` + on non-Windows x86-64 platforms and to `--mjit` on others. + +### MJIT + +* The default `--mjit-max-cache` is changed from 100 to 10000. * JIT-ed code is no longer cancelled when a TracePoint for class events is enabled. @@ -429,7 +434,7 @@ Excluding feature bug fixes. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L434 * The JIT compiler no longer skips compilation of methods longer than 1000 instructions. -* `--jit-verbose` and `--jit-warning` output "JIT cancel" when JIT-ed +* `--mjit-verbose` and `--mjit-warning` output "JIT cancel" when JIT-ed code is disabled because TracePoint or GC.compact is used. * `RubyVM::MJIT` is renamed to `RubyVM::JIT`. [[Feature #17490]] diff --git a/mjit_worker.c b/mjit_worker.c index a3a2acab7fa..879237eacca 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -249,7 +249,7 @@ static char *tmp_dir; https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L249 static const char *cc_path; // Used C compiler flags. static const char **cc_common_args; -// Used C compiler flags added by --jit-debug=... +// Used C compiler flags added by --mjit-debug=... static char **cc_added_args; // Name of the precompiled header file. static char *pch_file; @@ -686,7 +686,7 @@ remove_so_file(const char *so_file, struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L686 #endif } -// Print _mjitX, but make a human-readable funcname when --jit-debug is used +// Print _mjitX, but make a human-readable funcname when --mjit-debug is used static void sprint_funcname(char *funcname, const struct rb_mjit_unit *unit) { diff --git a/ruby.c b/ruby.c index 80ddc86bef7..f63cecdb985 100644 --- a/ruby.c +++ b/ruby.c @@ -103,7 +103,7 @@ void rb_warning_category_update(unsigned int mask, unsigned int bits); https://github.com/ruby/ruby/blob/trunk/ruby.c#L103 SEP \ X(frozen_string_literal) \ SEP \ - X(jit) \ + X(mjit) \ SEP \ X(yjit) /* END OF FEATURES */ @@ -220,7 +220,7 @@ enum { https://github.com/ruby/ruby/blob/trunk/ruby.c#L220 & ~FEATURE_BIT(gems) #endif & ~FEATURE_BIT(frozen_string_literal) - & ~FEATURE_BIT(jit) + & ~FEATURE_BIT(mjit) & ~FEATURE_BIT(yjit) ) }; @@ -235,7 +235,7 @@ cmdline_options_init(ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L235 opt->intern.enc.index = -1; opt->features.set = DEFAULT_FEATURES; #ifdef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */ - opt->features.set |= FEATURE_BIT(jit); + opt->features.set |= FEATURE_BIT(mjit); #elif defined(YJIT_FORCE_ENABLE) opt->features.set |= FEATURE_BIT(yjit); #endif @@ -291,6 +291,11 @@ usage(const char *name, int help, int highlight, int columns) https://github.com/ruby/ruby/blob/trunk/ruby.c#L291 (unsigned short)sizeof(shortopt), \ (unsigned short)sizeof(longopt), \ } +#if YJIT_SUPPORTED_P +# define PLATFORM_JIT_OPTION "--yjit" +#else +# define PLATFORM_JIT_OPTION "--mjit" +#endif static const struct message usage_msg[] = { M("-0[octal]", "", "specify record separator (\\0, if no argument)"), M("-a", "", "autosplit mode with -n or -p (splits $_ into $F)"), @@ -312,8 +317,8 @@ usage(const char *name, int help, int highlight, int columns) https://github.com/ruby/ruby/blob/trunk/ruby.c#L317 M("-w", "", "turn warnings on for your script"), M("-W[level=2|:category]", "", "set warning level; 0=silence, 1=medium, 2=verbose"), M("-x[directory]", "", "strip off text before #!ruby line and perhaps cd to directory"), - M("--jit", "", "enable JIT with default options (experimental)"), - M("--jit-[option]","", "enable JIT with an option (experimental)"), + M("--jit", "", "enable JIT for the platform, same as " PLATFORM_JIT_OPTION " (experimental)"), + M("--mjit", "", "enable C compiler-based JIT compiler (experimental)"), M("--yjit", "", "enable in-process JIT compiler (experimental)"), M("-h", "", "show this message, --help for more info"), }; @@ -321,7 +326,7 @@ usage(const char *name, int help, int highlight, int columns) https://github.com/ruby/ruby/blob/trunk/ruby.c#L326 M("--copyright", "", "print the copyright"), M("--dump={insns|parsetree|...}[,...]", "", "dump debug information. see below for available dump list"), - M("--enable={jit|rubyopt|...}[,...]", ", --disable={jit|rubyopt|...}[,...]", + M("--enable={mjit|rubyopt|...}[,...]", ", --disable={mjit|rubyopt|...}[,...]", "enable or disable features. see below for available features"), M("--external-encoding=encoding", ", --internal-encoding=encoding", "specify the default external or internal character encoding"), @@ -343,7 +348,7 @@ usage(const char *name, int help, int highlight, int columns) https://github.com/ruby/ruby/blob/trunk/ruby.c#L348 M("did_you_mean", "", "did_you_mean (default: "DEFAULT_RUBYGEMS_ENABLED")"), M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"), M("frozen-string-literal", "", "freeze all string literals (default: disabled)"), - M("jit", "", "JIT compiler (default: disabled)"), + M("mjit", "", "C compiler-based JIT compiler (default: disabled)"), M("yjit", "", "in-process JIT compiler (default: disabled)"), }; static const struct message warn_categories[] = { @@ -351,13 +356,13 @@ usage(const char *name, int help, int highlight, int columns) https://github.com/ruby/ruby/blob/trunk/ruby.c#L356 M("experimental", "", "experimental features"), }; static const struct message mjit_options[] = { - M("--jit-warnings", "", "Enable printing JIT warnings"), - M("--jit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"), - M("--jit-wait", "", "Wait until JIT compilation finishes every time (for testing)"), - M("--jit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"), - M("--jit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"), - M("--jit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: 100)"), - M("--jit-min-calls=num", "", "Number of calls to trigger JIT (for testing, default: 10000)"), + M("--mjit-warnings", "", "Enable printing JIT warnings"), + M("--mjit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"), + M("--mjit-wait", "", "Wait until JIT compilation finishes every time (for testing)"), + M("--mjit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"), + M("--mjit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"), + M("--mjit-max-cache=num", "", "Max number of methods to be JIT-ed in a cache (default: 100)"), + M("--mjit-min-calls=num", "", "Number of calls to trigger JIT (for testing, default: 10000)"), }; static const struct message yjit_options[] = { #if YJIT_STATS @@ -952,12 +957,20 (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/