diff options
| author | Max Bernstein <rubybugs@bernsteinbear.com> | 2025-10-22 10:56:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-22 17:56:02 +0000 |
| commit | 87fdd6d53b51f2d5eb944c7f97aebf728b1ab439 (patch) | |
| tree | 3826cced22cd3e49698703c980e0fcaa645bc99d | |
| parent | 4c60fc48b1e88327521ebe0646843d6427dcfe17 (diff) | |
ZJIT: Support make in zjit_bisect.rb (#14584)
Find ZJIT options in RUN_OPTS/SPECOPTS and put new ones from the bisection script
there too.
| -rw-r--r-- | .github/auto_request_review.yml | 1 | ||||
| -rwxr-xr-x | tool/zjit_bisect.rb | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/.github/auto_request_review.yml b/.github/auto_request_review.yml index 51e0e4db97..814150c90e 100644 --- a/.github/auto_request_review.yml +++ b/.github/auto_request_review.yml @@ -11,6 +11,7 @@ files: 'doc/zjit*': [team:jit] 'test/ruby/test_zjit*': [team:jit] 'defs/jit.mk': [team:jit] + 'tool/zjit_bisect.rb': [team:jit] # Skip github workflow files because the team don't necessarily need to review dependabot updates for GitHub Actions. It's noisy in notifications, and they're auto-merged anyway. options: ignore_draft: true diff --git a/tool/zjit_bisect.rb b/tool/zjit_bisect.rb index 175bbe5feb..997c572f51 100755 --- a/tool/zjit_bisect.rb +++ b/tool/zjit_bisect.rb @@ -72,7 +72,31 @@ def run_bisect(command, items) bisect_impl(command, [], items) end +def add_zjit_options cmd + if RUBY == "make" + # Automatically detect that we're running a make command instead of a Ruby + # one. Pass the bisection options via RUN_OPTS/SPECOPTS instead. + zjit_opts = cmd.select { |arg| arg.start_with?("--zjit") } + run_opts_index = cmd.find_index { |arg| arg.start_with?("RUN_OPTS=") } + specopts_index = cmd.find_index { |arg| arg.start_with?("SPECOPTS=") } + if run_opts_index + run_opts = Shellwords.split(cmd[run_opts_index].delete_prefix("RUN_OPTS=")) + run_opts.concat(zjit_opts) + cmd[run_opts_index] = "RUN_OPTS=#{run_opts.shelljoin}" + elsif specopts_index + specopts = Shellwords.split(cmd[specopts_index].delete_prefix("SPECOPTS=")) + specopts.concat(zjit_opts) + cmd[specopts_index] = "SPECOPTS=#{specopts.shelljoin}" + else + raise "Expected RUN_OPTS or SPECOPTS to be present in make command" + end + cmd = cmd - zjit_opts + end + cmd +end + def run_ruby *cmd + cmd = add_zjit_options(cmd) pid = Process.spawn(*cmd, { in: :close, out: [File::NULL, File::RDWR], @@ -128,7 +152,7 @@ File.open("jitlist.txt", "w") do |file| file.puts(result) end puts "Run:" -command = [RUBY, "--zjit-allowed-iseqs=jitlist.txt", *OPTIONS].shelljoin -puts command +jitlist_path = File.expand_path("jitlist.txt") +puts add_zjit_options([RUBY, "--zjit-allowed-iseqs=#{jitlist_path}", *OPTIONS]).shelljoin puts "Reduced JIT list (available in jitlist.txt):" puts result |
