-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Rework call graph implementation #10336
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
Conversation
be2e603
to
cd96f9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do a DCA run with meta-queries turned on, so we can see the change in call graph edges?
b66d1e8
to
50e13af
Compare
50e13af
to
ac4d4ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I think it's worth devoting a bit more time to the investigation of the call graph changes from the affected projects. Obviously the changes are too large to review in full. but normally I'd pick a few samples from each project and triage those. It's not really clear to me how much triaging has been done here.
…cker` Instead, use small-step type tracking, as suggested by @RasmusWL offline.
@asgerf: Thanks for the review. I have now spot checked two new call graph edges for each project, and here is what I found:
The general pattern is that we now find more due to the open-world assumption, which is not surprising, and it looks like tests code/mocks are a natural source of potential false positives, but I know we have the same issue in C#. Triaging the results did reveal a couple of bugs around singleton methods, which I have now fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks great 👍
This PR rewrites the call graph computation in the following ways:
require
andrequire_relative
methods.self
(closed-world assumption); instead rely on the type hierarchy, and allow dispatch to any overrides (open-world assumption), as long as the type is not known exactly (such as when constructed withnew
).def x.foo; end
, by taking overriding redefinitions into account:self
):Commit-by-commit review is encouraged.
I spot checked some of the missing results on
opal/opal
, and they look like false positives to me. We were previously generating a lot of flow through this call (included as a sub-module), which now has only 1 call target instead of 42, due to the change 2 above.