-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Dataflow: Refactor access paths to split TypedContent into an explicit pair #12930
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: Refactor access paths to split TypedContent into an explicit pair #12930
Conversation
fd8e96d
to
6f21781
Compare
6f21781
to
71ae090
Compare
DCA is looking good. The few additional results for Java appear to be caused by loss of precise type tracking stored in |
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.
Looks really great; thanks a lot for splitting the work up into individual commits, that helped a lot. I only have one small question, but happy to merge as-is.
@@ -2138,6 +2163,8 @@ module Impl<FullStateConfigSig Config> { | |||
PrevStage::revFlow(node, _) and result = TApproxFrontNil(node.getDataFlowType()) | |||
} | |||
|
|||
Typ getTyp(DataFlowType t) { result = t } |
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.
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.
And same further down.
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 expect it to be extremely likely that the optimiser will in fact inline these, so no need to be explicit about that, I think.
In data flow we're tracking both a type and an access path. These two things are somewhat intertwined as we want to be able to reestablish the tracked type after a store-to-read step sequence.
We used to achieve this by merging the type into the front of the access paths resulting in a list of the form
(typ1, content1) :: (typ2, content2) :: ... :: nil(typn)
. This refactor pulls the front type out of the access path, such that it becomes an explicit pair rather than being merged withContent
. We still need the types nested inside the access path tails, so now, instead of being a list ofTypedContent
s, access paths are a list ofContent
s where each nested tail is paired with aDataFlowType
, i.e.(typ1, content1 :: (typ2, content2 :: ... :: (typn, nil)) ... ))
.In the automaton view of access paths, we're switching from a graph with access-path nodes and type-content-pair-labelled edges to a graph where the nodes are type-access-path pairs and the edges are merely content-labelled.
This refactor is intended to pave the way for a future enhancement where we'll be able to update the tracked type independently from the access path to improve precision.
This PR is intended to be reviewed commit-by-commit. The commits progress by first duplicating the type information from the access paths where needed before replacing
TypedContent
withContent
.