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

callgraph improvements using pointer argument pattern #101

Open
kalexmills opened this issue Dec 25, 2020 · 1 comment
Open

callgraph improvements using pointer argument pattern #101

kalexmills opened this issue Dec 25, 2020 · 1 comment
Labels
discussion Maintainers are inviting discussion. enhancement New feature or request vet-bot the issue is part of VetBot's responsibility

Comments

@kalexmills
Copy link
Contributor

kalexmills commented Dec 25, 2020

Once #28 lands, there will be one more thing we can use in the call-graph to disambiguate nodes without using any type information.

Whether we want to do this depends entirely on how many false-positives we see. (EDIT: maybe not; I kind of just want to do it...)

We can use name, arity, and the pattern of pointer arguments to uniquely identify a function in the callgraph.

For instance, a function

func foo(x int, y *int, z int) {
  // ...
}

would have signature {foo, 3, [false, true, false]}.

We can easily construct this graph for function signatures. However, using the graph at the call-site without type information is a little bit trickier. We can use the position where the pointer argument(s) are being passed to lookup the set of all the nodes in the call-graph whose signatures match and run our BFS starting from those nodes.

That lookup is only a tiny bit tricky. I think it's easiest trading off space for time by using an index.

Functions which do not take any pointer arguments are also totally useless for our purposes. I think we can just ignore them in every case (see #102). Any edges which we may miss couldn't have a pointer crossing them in any case.

@kalexmills kalexmills added enhancement New feature or request vet-bot the issue is part of VetBot's responsibility labels Dec 25, 2020
@kalexmills
Copy link
Contributor Author

That last paragraph is actually much simpler to implement; and not wholly irrelevant. We only care about the portion of the callgraph which makes use of pointer arguments.

So let's open a new issue for that and do it first.

@kalexmills kalexmills added the discussion Maintainers are inviting discussion. label Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Maintainers are inviting discussion. enhancement New feature or request vet-bot the issue is part of VetBot's responsibility
Projects
None yet
Development

No branches or pull requests

1 participant