Skip to content

Commit 8519c94

Browse files
committed
[GR-19220] On jt graph, keep the graph file around (#2712)
PullRequest: truffleruby/3471
2 parents 5c6ddc7 + f03b02d commit 8519c94

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ doc/user/README.md
100100
# Ignore .rb files at the root, it's temporary files to debug some issue
101101
/*.rb
102102

103-
# Ignore Seafoam generated illustrations
103+
# Ignore graphs and Seafoam generated illustrations
104+
/*.bgv
104105
/*.pdf
105106
/*.svg
106107

lib/cext/ABI_check.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8
1+
9

src/main/c/cext/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void rb_str_set_len(VALUE string, long length) {
175175
if (length > capacity || length < 0) {
176176
rb_raise(rb_eRuntimeError, "probable buffer overflow: %ld for %ld", length, capacity);
177177
}
178-
rb_tr_wrap(polyglot_invoke(RUBY_CEXT, "rb_str_set_len", rb_tr_unwrap(string), length));
178+
polyglot_invoke(RUBY_CEXT, "rb_str_set_len", rb_tr_unwrap(string), length);
179179
}
180180

181181
VALUE rb_str_new_frozen(VALUE value) {

test/mri/excludes/TestOpenURI.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
exclude :test_encoding, "needs investigation"
2-
exclude :test_open_timeout, "transient" if RUBY_PLATFORM.start_with?('aarch64-darwin')
2+
exclude :test_open_timeout, "different exception due to different logic in Net::HTTP#connect [GR-40759]"

tool/jt.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ def help
841841
--simplify simplify the graph by disabling some optimizations which tend to duplicate parts of the graph
842842
--igv send the graphs to IGV over the network instead of using seafoam
843843
--describe describe the shape of the graph (linear, branches, loops, calls, deopts)
844+
SEAFOAM_DIR use the seafoam in the given directory
844845
jt igv launches IdealGraphVisualizer
845846
jt next tell you what to work on next (give you a random core library spec)
846847
jt install [jvmci|eclipse] install [the right JVMCI JDK | Eclipse] in the parent directory
@@ -2069,6 +2070,7 @@ def profile(*args)
20692070
end
20702071

20712072
def graph(*args)
2073+
in_truffleruby_repo_root!
20722074
truffleruby_compiler!
20732075

20742076
test_file = nil
@@ -2078,8 +2080,9 @@ def graph(*args)
20782080
describe = false
20792081
json = false
20802082
seafoam_args = []
2081-
igv = args.delete('--igv')
20822083

2084+
# Must be handled before ruby_options() otherwise that would consume it
2085+
igv = args.delete('--igv')
20832086
args.unshift '--igv-network' if igv
20842087

20852088
vm_args, remaining_args, _parsed_options = ruby_options({}, args)
@@ -2171,7 +2174,10 @@ def graph(*args)
21712174
graph = graphs.last
21722175
raise "Could not find graph in #{dumps}" unless graph
21732176

2174-
list = run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, '--json', graph, 'list', capture: :out, no_print_cmd: true)
2177+
FileUtils.cp graph, 'graph.bgv'
2178+
graph = 'graph.bgv'
2179+
2180+
list = seafoam('--json', graph, 'list', capture: :out, no_print_cmd: true)
21752181
decoded = JSON.parse(list)
21762182
graph_names = decoded.map { |entry| entry.fetch('graph_name_components').last }
21772183
before_lowering_regexp = /Before.+Lowering/
@@ -2181,7 +2187,7 @@ def graph(*args)
21812187

21822188
json_args = json ? %w[--json] : []
21832189
action = describe ? 'describe' : 'render'
2184-
run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, *json_args, "#{graph}:#{n}", action, *seafoam_args)
2190+
seafoam(*json_args, "#{graph}:#{n}", action, *seafoam_args)
21852191
end
21862192

21872193
break unless watch
@@ -2193,6 +2199,16 @@ def graph(*args)
21932199
end
21942200
end
21952201

2202+
private def seafoam(*args)
2203+
seafoam_dir = ENV['SEAFOAM_DIR']
2204+
if seafoam_dir
2205+
sh(RbConfig.ruby, "-I#{seafoam_dir}/lib", "#{seafoam_dir}/bin/seafoam", *args)
2206+
else
2207+
run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, *args)
2208+
end
2209+
end
2210+
ruby2_keywords :seafoam if respond_to?(:ruby2_keywords, true)
2211+
21962212
def igv
21972213
clone_enterprise
21982214
graal_enterprise = File.expand_path '../graal-enterprise/graal-enterprise', TRUFFLERUBY_DIR

0 commit comments

Comments
 (0)