mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
ZJIT: Use shellwords in bisect script
This commit is contained in:
parent
0b30cf3b40
commit
fd6d6a45cd
1 changed files with 9 additions and 4 deletions
|
@ -1,11 +1,13 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'logger'
|
||||
require 'open3'
|
||||
require 'shellwords'
|
||||
require 'tempfile'
|
||||
require 'timeout'
|
||||
|
||||
RUBY = ARGV[0] || raise("Usage: ruby jit_bisect.rb <path_to_ruby> <options>")
|
||||
OPTIONS = ARGV[1] || raise("Usage: ruby jit_bisect.rb <path_to_ruby> <options>")
|
||||
OPTIONS = ARGV[1..]
|
||||
raise("Usage: ruby jit_bisect.rb <path_to_ruby> -- <options>") if OPTIONS.empty?
|
||||
TIMEOUT_SEC = 5
|
||||
LOGGER = Logger.new($stdout)
|
||||
|
||||
|
@ -65,7 +67,8 @@ def run_with_jit_list(ruby, options, jit_list)
|
|||
temp_file.flush
|
||||
temp_file.close
|
||||
# Run the JIT with the temporary file
|
||||
Open3.capture3("#{ruby} --zjit-allowed-iseqs=#{temp_file.path} #{options}")
|
||||
command = Shellwords.join [ruby, "--zjit-allowed-iseqs=#{temp_file.path}", *options]
|
||||
Open3.capture3(command)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -77,7 +80,8 @@ end
|
|||
# Collect the JIT list from the failing Ruby process
|
||||
jit_list = nil
|
||||
Tempfile.create "jit_list" do |temp_file|
|
||||
Open3.capture3("#{RUBY} --zjit-log-compiled-iseqs=#{temp_file.path} #{OPTIONS}")
|
||||
command = Shellwords.join [RUBY, "--zjit-log-compiled-iseqs=#{temp_file.path}", *OPTIONS]
|
||||
Open3.capture3(command)
|
||||
jit_list = File.readlines(temp_file.path).map(&:strip).reject(&:empty?)
|
||||
end
|
||||
LOGGER.info("Starting with JIT list of #{jit_list.length} items.")
|
||||
|
@ -94,6 +98,7 @@ File.open("jitlist.txt", "w") do |file|
|
|||
file.puts(result)
|
||||
end
|
||||
puts "Run:"
|
||||
puts "#{RUBY} --zjit-allowed-iseqs=jitlist.txt #{OPTIONS}"
|
||||
command = Shellwords.join [RUBY, "--zjit-allowed-iseqs=jitlist.txt", *OPTIONS]
|
||||
puts command
|
||||
puts "Reduced JIT list (available in jitlist.txt):"
|
||||
puts result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue