-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Data flow: Call context virtual dispatch pruning in stage 1 #12124
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
) { | ||
exists(DataFlowCall ctx | | ||
fwdFlowIsEntered(ctx, _, config) and | ||
result = viableImplInCallContextExt(call, ctx) |
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.
I was about to say that something looked wrong here, but that was because I was thinking about prunedViableImplInCallContext
rather than viableImplInCallContextExt
. Could you add a flow test that fails if prunedViableImplInCallContext
was mistakenly used here instead of viableImplInCallContextExt
?
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.
Done.
( | ||
cc = false | ||
or | ||
not reducedViableImplInCallContext(call, _, _) |
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.
I think we need cc = true and
here in order to not get tuple duplication in this pipeline split.
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.
Can't hurt.
fwdFlowOutFromArg(call, node, config) and | ||
fwdFlowIsEntered(call, cc, config) | ||
) | ||
} | ||
|
||
// inline to reduce the number of iterations | ||
pragma[inline] |
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.
Did you compare performance of this inlining against the nomagic
alternative?
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.
Don't remember, but it probably doesn't matter that much. The logic was previously manually inlined into fwdFlow
and fwdFlowIsEntered
, so I decided to keep it that way.
Extracted from #11531.
When resolving dispatch targets in the first pruning stage, we may be able to restrict the number of viable targets by taking possible call contexts into account. That is, we don't actually track the precise call context, but instead we rely on all calls that might be a call context (in the same way that we handle flow through and field reads), using non-linear recursion.
Tuple counts before:
Tuple counts after: