Skip to content

Conversation

@MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Oct 16, 2024

This uses the existing "lambda resolution" mechanism in the dataflow library to resolve calls through function pointers.

We already track function addresses flowing into MaD models that specify a function pointer as an input (which was added in e9cd2dc). However, we never went the extra mile and added it when you call the function pointer in the source code.

This PR adds the one line which enables this. This should hopefully mean that we resolve a lot more function pointers.

Ideally, I would have liked to also remove the old function pointer resolution and virtual dispatch code, but since this is such a small change I think we should just get this improvement in now.

@bdrodes noted that he would also like for the call target resolution to be exposed as a predicate. I've snuck that into this PR in a99d576

All the results look like new genuine results with no performance problems in sight 🥳

@github-actions github-actions bot added the C++ label Oct 16, 2024
@MathiasVP MathiasVP marked this pull request as ready for review October 16, 2024 16:38
@MathiasVP MathiasVP requested a review from a team as a code owner October 16, 2024 16:38
*
* Note that `call` may be a call to a function pointer expression.
*/
Function getARuntimeTarget(Call call) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm always slightly confused. Is DataFlowUtil the file whose contents users may still depend upon, although it's located in internal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct:

I don't know why this was done like this. This file structure is also present in the old AST dataflow, and we just copied it for IR dataflow.

We could actually change this, and maybe rename DataFlowUtil to DataFlowPublic to clear this confusion like it's been done for newer languages:

Screenshot 2024-10-17 at 11 01 15

(although it looks like every language still stores the file in internal for some reason 🤔)

…olution.md

Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
Copy link
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

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

LGTM

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