-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GR-52483] Native Image call graph imprecision #8496
Comments
Thanks for reporting this issue. I created an internal ticket to track this effort: GR-52483 |
@cstancu I believe this issue is a potential problem for anyone trying to extract the call graph and run some client analysis on it, as it unnecessarily decreases the precision of the call graph. Would you be okay with either reimplementing the existing CSV mode or creating a third one if the authors of the current approach would like it to stay unchanged? I've discussed it with @mv02 and he is willing to implement it. |
I would prefer a simpler output format that creates three files connected by one-to-many mappings: |
Hello @galderz, if I am not mistaken you are the author of the CSV format? What is your opinion on this issue? Have we missed something or is the imprecision indeed in there? |
@d-kozak It's indeed an issue in the CSV output format. Looking at the text format it all looks as expected:
@fernando-valdez you have assigned this to you, are you already trying to fix it? Otherwise just assign it to me and I'll look into a fix. |
I've already implemented the format described by @d-kozak, which eliminates the issue. The report consists of 3 files. call_tree_methods.csv
call_tree_invokes.csv
call_tree_targets.csv
Resulting call graph (vs the previous one) If no one needs the current CSV format to stay unchanged, I can create a PR. |
I think it's fine to change it. I'm not aware of specific usages of the information that has been left out. I originally kept the same kind of edges found in the text format, that's why you had a virtual call different to a monomorphic call, and why the override edges were there. I blogged on how to use the CSV output here. |
Resolved in #8774 |
Describe the issue
When generating a call graph using the
-H:+PrintAnalysisCallTree
and-H:PrintAnalysisCallTreeType=CSV
options with Native Image, virtual invokes are handled by creating a "virtual node" in the graph, which causes imprecision.I created a reproducer script that parses CSV reports from a simple program compilation and outputs the call graph in DOT language. The
Animal.makeSound
virtual node can be seen, which creates a path fromMain.foo
toCow.makeSound
and, similarly, a path fromMain.bar
toDog.makeSound
, while these methods can never call those specific implementations of the virtual method, therefore these paths should not exist in the call graph.Steps to reproduce the issue
git clone https://gist.github.com/758955c93fa3f6eaed8d90057182eaad.git
javac Main.java
native-image Main -H:+PrintAnalysisCallTree -H:PrintAnalysisCallTreeType=CSV
python3 issue.py | dot -Tpdf -o graph.pdf
Describe GraalVM and your environment:
More details
Picture of the generated call graph
Reproducer gist
The text was updated successfully, but these errors were encountered: