Skip to content
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

Implement a new API for go/pointer #341

Closed
dominikh opened this issue Sep 15, 2018 · 1 comment
Closed

Implement a new API for go/pointer #341

dominikh opened this issue Sep 15, 2018 · 1 comment
Labels
idea Ideas for new tools/features/frameworks/... wontfix

Comments

@dominikh
Copy link
Owner

go/pointer is designed around the idea of queries. Before running the actual analysis, one adds objects of interest, for which one can then obtain the points-to sets. go/pointer even has special optimizations to only track information required to satisfy these queries. All in all, go/pointer is designed around one-off queries in support of editor tools (most prominently, guru).

This API doesn't scale well for our needs. For errcheck, we'll want points-to sets for a very large number of objects. And ideally, we won't have to walk the program code twice (once for adding the queries, once for consuming them).

The obvious change to the API is to track all objects, regardless of queries having been made. This prevents us from doing destructuring queries, but this can be worked around in two ways:

  1. some destructuring queries can be answered simply by looking at different objects
  2. we can apply destructuring for all objects during analysis. For example, for a function call, we can automatically track all returned values, even if no ssa.Extract instructions are present.

Another change would be to store points-to information directly in SSA values. This would avoid the use of huge maps (for reasons similar to #340). It would also let us build a points-to graph, with both forward and backward edges (may point to/may be pointed to by).

Unlike #340, this change may actually degrade performance. We may end up "querying" a lot more objects than is necessary. Especially dereferencing queries are very costly.

@dominikh dominikh added the idea Ideas for new tools/features/frameworks/... label Sep 15, 2018
@dominikh dominikh added the started Issues we've started working on label Jan 28, 2019
@dominikh
Copy link
Owner Author

go/pointer is designed for whole-program analysis, something we no longer generally do, with the exception of unused. If/when we're going to work on PTA again, we'll have to design something based on function summaries, or strictly restricted to intra-procedural analysis.

This issue is no longer relevant.

@dominikh dominikh removed the started Issues we've started working on label Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Ideas for new tools/features/frameworks/... wontfix
Projects
None yet
Development

No branches or pull requests

1 participant