@@ -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
@@ -2079,8 +2080,9 @@ def graph(*args)
2079
2080
describe = false
2080
2081
json = false
2081
2082
seafoam_args = [ ]
2082
- igv = args . delete ( '--igv' )
2083
2083
2084
+ # Must be handled before ruby_options() otherwise that would consume it
2085
+ igv = args . delete ( '--igv' )
2084
2086
args . unshift '--igv-network' if igv
2085
2087
2086
2088
vm_args , remaining_args , _parsed_options = ruby_options ( { } , args )
@@ -2175,7 +2177,7 @@ def graph(*args)
2175
2177
FileUtils . cp graph , 'graph.bgv'
2176
2178
graph = 'graph.bgv'
2177
2179
2178
- list = run_gem_test_pack_gem_or_install ( ' seafoam' , SEAFOAM_VERSION , '--json' , graph , 'list' , capture : :out , no_print_cmd : true )
2180
+ list = seafoam ( '--json' , graph , 'list' , capture : :out , no_print_cmd : true )
2179
2181
decoded = JSON . parse ( list )
2180
2182
graph_names = decoded . map { |entry | entry . fetch ( 'graph_name_components' ) . last }
2181
2183
before_lowering_regexp = /Before.+Lowering/
@@ -2185,7 +2187,7 @@ def graph(*args)
2185
2187
2186
2188
json_args = json ? %w[ --json ] : [ ]
2187
2189
action = describe ? 'describe' : 'render'
2188
- 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 )
2189
2191
end
2190
2192
2191
2193
break unless watch
@@ -2197,6 +2199,16 @@ def graph(*args)
2197
2199
end
2198
2200
end
2199
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
+
2200
2212
def igv
2201
2213
clone_enterprise
2202
2214
graal_enterprise = File . expand_path '../graal-enterprise/graal-enterprise' , TRUFFLERUBY_DIR
0 commit comments