Skip to content

Commit 2a84e02

Browse files
committed
[GR-17457] Support passing arguments straight to seafoam and add jt --verbose
PullRequest: truffleruby/3176
2 parents bbc64ad + 41ecb3a commit 2a84e02

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tool/jt.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,8 @@ def help
740740
* 'ruby' which uses the current Ruby executable in the PATH
741741
Default value is --use jvm, therefore all commands run on truffleruby-jvm by default.
742742
The default can be changed with `export RUBY_BIN=RUBY_SELECTOR`
743-
--silent Does not print the command and which Ruby is used
743+
--silent|-q Does not print the command and which Ruby is used
744+
--verbose|-v Print more details and commands
744745
--jdk Specifies which version of the JDK should be used: 11 (default) or 17
745746
746747
jt build [graalvm|parser|options|core-symbols] ... by default it builds graalvm
@@ -826,7 +827,7 @@ def help
826827
Ruby and cache the result, such as benchmark bench/mri/bm_vm1_not.rb --cache
827828
jt benchmark bench/mri/bm_vm1_not.rb --use-cache
828829
jt profile profiles an application, including the TruffleRuby runtime, and generates a flamegraph
829-
jt graph [ruby options] [--method Object#foo] [--watch] [--no-simplify] file.rb
830+
jt graph [ruby options] [--method Object#foo] [--watch] [--no-simplify] file.rb [-- seafoam options]
830831
render a graph of Object#foo within file.rb
831832
--describe describe the shape of the graph (linear, branches, loops, calls, deopts)
832833
jt igv launches IdealGraphVisualizer
@@ -2045,6 +2046,7 @@ def graph(*args)
20452046
simplify = true
20462047
describe = false
20472048
json = false
2049+
seafoam_args = []
20482050

20492051
vm_args, remaining_args, _parsed_options = ruby_options({}, args)
20502052
args = remaining_args
@@ -2064,7 +2066,8 @@ def graph(*args)
20642066
when '--describe'
20652067
describe = true
20662068
when '--'
2067-
raise
2069+
seafoam_args = args.dup
2070+
args.clear
20682071
when /^-/
20692072
vm_args << arg
20702073
else
@@ -2102,7 +2105,7 @@ def graph(*args)
21022105
loop do # for --watch
21032106
compiled = false
21042107
command = [ruby_launcher, *vm_args, test_file]
2105-
# STDERR.puts bold "$ #{printable_cmd(command)}"
2108+
STDERR.puts bold "$ #{printable_cmd(command)}" if @verbose
21062109
IO.popen(command, err: [:child, :out]) do |pipe|
21072110
pipe.each_line do |line|
21082111
puts line
@@ -2132,7 +2135,7 @@ def graph(*args)
21322135

21332136
json_args = json ? %w[--json] : []
21342137
action = describe ? 'describe' : 'render'
2135-
run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, *json_args, "#{graph}:#{n}", action)
2138+
run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, *json_args, "#{graph}:#{n}", action, *seafoam_args)
21362139

21372140
break unless watch
21382141
puts # newline between runs
@@ -2960,6 +2963,7 @@ def process_pre_args(args)
29602963
needs_build = false
29612964
needs_rebuild = false
29622965
@silent = false
2966+
@verbose = false
29632967
@jdk_version = Integer(ENV['JT_JDK'] || 11)
29642968

29652969
until args.empty?
@@ -2973,6 +2977,8 @@ def process_pre_args(args)
29732977
@ruby_name = args.shift
29742978
when '-q', '--silent'
29752979
@silent = true
2980+
when '-v', '--verbose'
2981+
@verbose = true
29762982
when '--jdk'
29772983
@jdk_version = Integer(args.shift)
29782984
when '-h', '-help', '--help'

0 commit comments

Comments
 (0)