sdk
sdk copied to clipboard
dart2js: remove side effect builder call graph
During global inference we are effectively building 2 call-graph representations at once. One in the typegraphnode representation, the other with the SideEfffectBuilder objects.
Our hope is that we can combine the two:
- remove SideEffectBuilders altogether
- store a SideEffect object on each member
- propagate effects through the callgraph at the end of inference.
Doing so might also let us use a canonical instance for each side-effect in the lattice (it's not that big!).
Note: this has to be done carefully if we reintroduce indirection in type-inference. Up until a92a9f1ba21f7fff440f1197aaf120f5f52c9332 we were using indirection for all ==
methods during inference. That was OK for computing types, but would have been a regression to use the same graph to compute the side-effects.
When using indirection, we want to make sure it is not used globally for all calls, but only for calls that have a large number of possible targets. Then simple calls will likely not be polluted with unnecessary effects.
To clarify, we want to separate the type graph and call graph representations. Then we should be able to store a SideEffect object on each member in the call graph and omit it entirely from the type graph, right?
... separate type graph from call graph representations.
Correct!
... store a SideEffect object on each member in the call graph ... ?
Yes, but there is a representation question here to be considered: should it be on the call graph itself or on the side? Depending on our representation, we may end up with a callgraph that contains no data, or contains an opaque storage for data. That way it can be agnostic of the analysis it will be used for (whether it is side-effects, type graphs, or something else in the future).