Open nirvdrum opened 1 year ago
I looked into this a bit today and the language isn't being detected because at this point in the graph all we see are org.graalvm and java.lang nodes. We may need to broaden the heuristic used for language detection, but we need to be careful to not misattribute the language in polyglot cases.
For this case, many other nodes, including BoxNode feeding into the Return
, have org.truffleruby
in their node source sections.
I wouldn't be too worried about polyglot cases, those are likely too big to look at with seafoam (IGV would work better for such cases), and one could override this detection via a command-line option maybe.
One way would be to look at the AST
subdirectory and the graph there. That has a RubyMethodRootNode and even a field.polyglotRef = org.truffleruby.RubyLanguage@65a3abc7
I just took a look at this with TruffleRuby 24.1.0-dev JVM CE and none of the source positions mentioned "org.truffleruby" as far as I can tell. The AST graphs are now merged into the same BGV file as the compilation graphs. I suppose we could strip the phase number off the command input and then look at a higher level phase to determine the language. It's a bit ugly, but should work.
I checked on 24.0.0 native, and https://github.com/Shopify/seafoam/issues/77#issuecomment-1624028358 is still accurate and seems the easiest way to find if it's a Ruby graph.
IOW we need to look at the AST graph as the compilation graphs or Call Tree indeed have no trace left of TruffleRuby (on 24.0.0 Native, on JVM nodeSourcePosition usually helps (seen in IGV)). AST graph on Native:
When looking at the graph generated by the following Ruby code:
you'll see that the two arguments
a
andb
are represented in the Seafoam's simplified output asT(8)
andT(9)
. These should render asT(args[0])
andT(args[1])
using the language translator pass. However, the translator is failing to detect that these are correspond to a TruffleRuby method.