Skip to content

Commit 9e91e0f

Browse files
committed
Be more flexible to detect the "Before lowering" phase
1 parent 10e4464 commit 9e91e0f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tool/jt.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,15 +2150,19 @@ def graph(*args)
21502150
method_glob_pattern = "Isolated:_#{method_glob_pattern}"
21512151
end
21522152

2153-
dumps = Dir.glob('graal_dumps/*').sort.last
2153+
dumps = Dir.glob('graal_dumps/*').select { |path| File.directory?(path) }.sort.last
21542154
raise 'Could not dump directory under graal_dumps/' unless dumps
21552155
graphs = Dir.glob("#{dumps}/*\\[#{method_glob_pattern}*\\].bgv").sort
21562156
graph = graphs.last
21572157
raise "Could not find graph in #{dumps}" unless graph
21582158

21592159
list = run_gem_test_pack_gem_or_install('seafoam', SEAFOAM_VERSION, '--json', graph, 'list', capture: :out, no_print_cmd: true)
21602160
decoded = JSON.parse(list)
2161-
n = decoded.find { |entry| entry['graph_name_components'].last == 'Before phase org.graalvm.compiler.phases.common.LoweringPhase' }['graph_index']
2161+
graph_names = decoded.map { |entry| entry.fetch('graph_name_components').last }
2162+
before_lowering_regexp = /Before.+Lowering/
2163+
before_lowering = graph_names.index { |name| name =~ before_lowering_regexp }
2164+
raise "Could not find #{before_lowering_regexp.inspect} in #{graph_names}" unless before_lowering
2165+
n = decoded.fetch(before_lowering).fetch('graph_index')
21622166

21632167
json_args = json ? %w[--json] : []
21642168
action = describe ? 'describe' : 'render'

0 commit comments

Comments
 (0)