@@ -841,6 +841,7 @@ def help
841
841
--simplify simplify the graph by disabling some optimizations which tend to duplicate parts of the graph
842
842
--igv send the graphs to IGV over the network instead of using seafoam
843
843
--describe describe the shape of the graph (linear, branches, loops, calls, deopts)
844
+ SEAFOAM_DIR use the seafoam in the given directory
844
845
jt igv launches IdealGraphVisualizer
845
846
jt next tell you what to work on next (give you a random core library spec)
846
847
jt install [jvmci|eclipse] install [the right JVMCI JDK | Eclipse] in the parent directory
@@ -2069,6 +2070,7 @@ def profile(*args)
2069
2070
end
2070
2071
2071
2072
def graph ( *args )
2073
+ in_truffleruby_repo_root!
2072
2074
truffleruby_compiler!
2073
2075
2074
2076
test_file = nil
@@ -2078,8 +2080,9 @@ def graph(*args)
2078
2080
describe = false
2079
2081
json = false
2080
2082
seafoam_args = [ ]
2081
- igv = args . delete ( '--igv' )
2082
2083
2084
+ # Must be handled before ruby_options() otherwise that would consume it
2085
+ igv = args . delete ( '--igv' )
2083
2086
args . unshift '--igv-network' if igv
2084
2087
2085
2088
vm_args , remaining_args , _parsed_options = ruby_options ( { } , args )
@@ -2171,7 +2174,10 @@ def graph(*args)
2171
2174
graph = graphs . last
2172
2175
raise "Could not find graph in #{ dumps } " unless graph
2173
2176
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 )
2175
2181
decoded = JSON . parse ( list )
2176
2182
graph_names = decoded . map { |entry | entry . fetch ( 'graph_name_components' ) . last }
2177
2183
before_lowering_regexp = /Before.+Lowering/
@@ -2181,7 +2187,7 @@ def graph(*args)
2181
2187
2182
2188
json_args = json ? %w[ --json ] : [ ]
2183
2189
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 )
2185
2191
end
2186
2192
2187
2193
break unless watch
@@ -2193,6 +2199,16 @@ def graph(*args)
2193
2199
end
2194
2200
end
2195
2201
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
+
2196
2212
def igv
2197
2213
clone_enterprise
2198
2214
graal_enterprise = File . expand_path '../graal-enterprise/graal-enterprise' , TRUFFLERUBY_DIR
0 commit comments