-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Fixed an issue with ReduceLabel flows spoiling node reachability cache
#61265
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
base: main
Are you sure you want to change the base?
Fixed an issue with ReduceLabel flows spoiling node reachability cache
#61265
Conversation
src/compiler/checker.ts
Outdated
| const saveAntecedents = target.antecedent; | ||
| target.antecedent = (flow as FlowReduceLabel).node.antecedents; | ||
| const result = isReachableFlowNodeWorker((flow as FlowReduceLabel).antecedent, /*noCacheCheck*/ false); | ||
| const result = isReachableFlowNodeWorker((flow as FlowReduceLabel).antecedent, FlowNodeReachableCacheFlags.None); |
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.
as the comment in this block says:
// Cache is unreliable once we start adjusting labelsWe can't let this isReachableFlowNodeWorker call here to populate the cache as that would create entries based on the temporary antecedent(s). Anything computed below this call can't be preserved, at least not without including the id of this ReduceLabel flow in the cache key or smth.
So this disables cache writes. As later on that would be used on the same shared flow but with "correct" antecedents (and that's the only result the compiler should cache and trust).
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'm still considering 2 things here:
- should this code maybe save & restore
flowNodeReachable[getFlowNodeId(target)]? - should reads be permanently disabled here? this would make the previous consideration obsolete
I have not been able to produce a test case that would prove either to be required so far but I have only spent a little bit of time on it.
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.
cc @ahejlsberg who has been thinking about this sort of thing recently and I believe had ideas on how to simplify the flow node logic here
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.
fwiw, Corsa still suffers from this (checked at microsoft/typescript-go@a92eff4 )
2a860e8 to
4552c20
Compare
…ling-reachability-cache
fixes #61259
fixes #63004