Skip to content
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

Dataflow: Add type-based call-edge pruning. #13982

Merged

Conversation

aschackmull
Copy link
Contributor

@aschackmull aschackmull commented Aug 16, 2023

This extends data flow with a cartesian over-approximation of precise type-based call-contexts. Essentially this boils down to a type-flow analysis interleaved with data-flow.
Using a pruned call graph the type flow analysis determines possible types for arguments and parameters and uses this to filter impossible call edges. As one of the primary motivations, this improves dispatch to lambda callbacks, but it also improves on things like Object.toString dispatch and dispatch in e.g. the visitor pattern.
Currently this is enabled for Java and C#. Other languages may follow, e.g. by defining a simple type system that merely distinguishes different lambdas. By assigning a specific type to a lambda and the value of the instance argument in the lambda body, the data flow library is able to link the two and improve dispatch.

@github-actions github-actions bot added the Java label Aug 16, 2023
@aschackmull aschackmull force-pushed the dataflow/typeflow-calledge-pruning branch 2 times, most recently from a446f57 to 96f3601 Compare August 31, 2023 14:14
@aschackmull aschackmull force-pushed the dataflow/typeflow-calledge-pruning branch from fef0c49 to dc5ade3 Compare September 4, 2023 14:34
@aschackmull aschackmull marked this pull request as ready for review September 5, 2023 08:10
@aschackmull aschackmull requested review from a team as code owners September 5, 2023 08:10
@aschackmull
Copy link
Contributor Author

Postponing type-based pruning until stage 3 seems to generally perform better and filters the same set of FPs.

@aschackmull aschackmull force-pushed the dataflow/typeflow-calledge-pruning branch from 2a2733d to e4821bc Compare September 13, 2023 11:28
@aschackmull aschackmull force-pushed the dataflow/typeflow-calledge-pruning branch from e4821bc to 74787bf Compare September 13, 2023 13:43
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great to me. A lot of questions mostly.

@aschackmull aschackmull merged commit 13f7daf into github:main Sep 21, 2023
33 checks passed
@aschackmull aschackmull deleted the dataflow/typeflow-calledge-pruning branch September 21, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants