diff options
| author | Shohei YOSHIDA <syohex@gmail.com> | 2026-06-03 23:00:00 +0900 |
|---|---|---|
| committer | Oliver Kiddle <opk@zsh.org> | 2026-06-04 04:14:25 +0200 |
| commit | 3d405f871daab11d7f7282ede45c5b0a07b599d4 (patch) | |
| tree | 5df623f8bcbaa8d5058101a93030ad90bdd5a212 /Completion/Unix/Command | |
| parent | 54644: init: add patchlevel to --version output (diff) | |
| download | zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar.gz zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar.bz2 zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar.lz zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar.xz zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.tar.zst zsh-3d405f871daab11d7f7282ede45c5b0a07b599d4.zip | |
54663: update ruby JIT flags
Diffstat (limited to 'Completion/Unix/Command')
| -rw-r--r-- | Completion/Unix/Command/_ruby | 125 |
1 files changed, 107 insertions, 18 deletions
diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 82111b455..eebf6c25f 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -1,8 +1,8 @@ #compdef ruby irb erb ruby-mri -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default- -local curcontext="$curcontext" state line expl desc RUBY ret=1 +local curcontext="$curcontext" state line expl desc RUBY variant ret=1 typeset -A opt_args -local -a opts irb erb all common charsets suf +local -a opts irb erb all common charsets suf jit_opts all=( '*-r+[require the library before executing your script]:library name:->library' @@ -47,23 +47,112 @@ opts=( '--backtrace-limit=[limit the maximum length of backtrace]:number' '!'{-y,--yydebug} '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' - '(--mjit --yjit)--jit[enable jit for the platform]' - '(--jit --yjit)--mjit[enable C compiler-based JIT compiler]' - '(--jit --mjit)--yjit[enable in-process JIT compiler]' - '--mjit-warnings[enable printing JIT warnings]' - '--mjit-debug[enable JIT debugging (very slow)]' - '--mjit-wait[wait until JIT compilation finishes every time (for testing)]' - '--mjit-save-temps[save JIT temporary files]' - '--mjit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]' - '--mjit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]' - '--mjit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]' - '--yjit-stat[enable collecting YJIT statistics]' - '--yjit-exec-mem-size=-[size of executable memory block in MiB]:mem size' - '--yjit-call-threshold=-[number of calls to trigger JIT]:number' - '--yjit-max-versions=-[maximum number of versions per basic block]:versions' - '--yjit-greedy-versioning[greedy versioning mode]' ) +if [[ $service == ruby[0-9.]# ]]; then + _pick_variant -r variant -c "$service --version" \ + ruby_no_jit='ruby ([01].|2.[0-5])' \ + ruby_experimental_jit='ruby (2.[67]|3.0)' \ + ruby31='ruby 3.1' ruby32='ruby 3.2' ruby33='ruby 3.3' ruby34='ruby 3.4' \ + ruby40='ruby 4.0' ruby41_higher + + if [[ $variant != "ruby_no_jit" ]]; then + jit_opts=('(--jit --mjit --yjit --rjit --zjit)--jit[enable default JIT for the platform]') + fi + + case "$variant" in + (ruby_experimental_jit|ruby31) + jit_opts+=( + '--jit-warnings[enable printing JIT warnings]' + '--jit-debug[enable JIT debugging (very slow)]' + '--jit-wait[wait until JIT compilation finishes every time (for testing)]' + '--jit-save-temps[save JIT temporary files]' + '--jit-verbose=-[print JIT logs of level num or less to stderr]:log level' + '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:num' + '--jit-min-calls=-[specify number of calls to trigger JIT]:num' + ) + ;| + (ruby31|ruby32) + jit_opts+=( + '(--jit --mjit --yjit)--mjit[enable C compiler-based JIT compiler]' + '(--jit --mjit --yjit)--yjit[enable in-process JIT compiler]' + ) + ;| + (ruby31|ruby32) + jit_opts+=( + '--mjit-warnings[enable printing JIT warnings]' + '--mjit-debug[enable JIT debugging (very slow)]' + '--mjit-wait[wait until JIT compilation finishes every time (for testing)]' + '--mjit-save-temps[save JIT temporary files]' + '--mjit-verbose=-[print JIT logs of level num or less to stderr]:log level' + '--mjit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:num' + '--mjit-min-calls=-[specify number of calls to trigger JIT]:num' + '--yjit-max-versions=[Maximum number of versions per basic block (default: 4)]:num' + '--yjit-greedy-versioning[Greedy versioning mode (default: disabled)]' + ) + ;| + (ruby32|ruby33|ruby34|ruby40|ruby41_higher) + jit_opts+=( + '--yjit-stats[Enable collecting YJIT statistics]' + '--yjit-exec-mem-size=[Hard limit on executable memory block in MiB]:mem size' + '--yjit-call-threshold=[Number of calls to trigger JIT]:num' + ) + ;| + (ruby33|ruby34|ruby40|ruby41_higher) + # mjit was removed since Ruby 3.3 + jit_opts+=( + '--yjit-cold-threshold=[Global calls after which ISEQs not compiled (default: 200K)]:num' + '--yjit-disable[Disable YJIT for lazily enabling it with RubyVM::YJIT.enable]' + '--yjit-code-gc[Run code GC when the code size reaches the limit]' + '--yjit-perf[Enable frame pointers and perf profiling]' + '--yjit-trace-exits[Record Ruby source location when exiting from generated code]' + '--yjit-trace-exits-sample-rate=[Trace exit locations only every Nth occurrence]:num' + ) + ;| + (ruby34|ruby40|ruby41_higher) + jit_opts+=( + '--yjit-mem-size=[Soft limit on YJIT memory usage in MiB (default: 128)]:mem size' + "--yjit-log=[Enable logging of YJIT's compilation activity]: :_files" + ) + ;| + (ruby33|ruby34) + # ruby 3.3 and 3.4 provide rjit + jit_opts+=( + '(--jit --yjit --rjit)--yjit[Enable in-process JIT compiler]' + '--rjit-exec-mem-size=[Size of executable memory block in MiB (default: 64)]:mem size' + '--rjit-call-threshold=[Number of calls to trigger JIT (default: 10)]:num' + '--rjit-stats[Enable collecting RJIT statistics]' + '--rjit-disable[Disable RJIT for lazily enabling it with RubyVM::RJIT.enable]' + '--rjit-trace[Allow TracePoint during JIT compilation]' + '--rjit-trace-exits[Trace side exit locations]' + ) + ;| + (ruby40|ruby41_higher) + # zjit was introduced since ruby 4 + jit_opts+=( + '(--jit --yjit --zjit)--yjit[Enable in-process JIT compiler]' + '(--jit --yjit --zjit)--zjit[enable method-based JIT compiler]' + '--zjit-mem-size=[Max amount of memory that ZJIT can use in MiB (default: 128)]:mem size' + '--zjit-call-threshold=[Number of calls to trigger JIT (default: 30)]:num' + '--zjit-num-profiles=[Number of profiled calls before JIT (default: 5)]:num' + '--zjit-stats-quiet[Collect ZJIT stats and suppress output]' + '--zjit-stats=-[Collect ZJIT stats]: :_files' + '--zjit-disable[Disable ZJIT for lazily enabling it with RubyVM::ZJIT.enable]' + '--zjit-perf[Dump ISEQ symbols into /tmp/perf-{}.map for Linux perf]' + '--zjit-log-compiled-iseqs=[Log compiled ISEQs to the file. The file will be truncated]: :_files' + '--zjit-trace-exits=-[Record source on side-exit]:counter' + '--zjit-trace-exits-sample-rate=[Frequency at which to record side exits]:frequency' + ) + ;| + (ruby41_higher) + jit_opts+=( + '--zjit-trace-compiles[Record compilation phases as Perfetto trace events]' + '--zjit-trace-invalidation[Record invalidation events as Perfetto trace events]' + ) + ;| + esac +fi + irb=( '-f[suppress read of ~/.irbrc]' $opts[(r)*-d\[*] @@ -121,7 +210,7 @@ case "$service" in ;; ruby[0-9.]#) RUBY=$words[1] - _arguments -C -s -S : $opts $all $common && ret=0 + _arguments -C -s -S : $opts $all $common $jit_opts && ret=0 ;; irb[0-9.]#) RUBY=${words[1]/irb/ruby} |
