1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:04:46 -07:00
go/cmd/guru
Alan Donovan 608d57b3ae cmd/guru: call{ers,stack}: avoid pointer analysis where possible
As an optimization, the callers and callstack queries now avoid the
relatively costly pointer analysis in some common cases:

The callers of a function that is never address-taken can be enumerated
directly from the SSA representation.

Similarly, the callstack can be computed initially by ignoring dynamic
call edges; we run the pointer analysis only if no path is found in this
partial callgraph.  As a bonus, this also causes the tool to
preferentially report all-static callpaths.

A callers query on fmt.Errorf now completes in 3 seconds instead of 8,
and a callstack query completes in 2 seconds instead of 8.

The new code is covered by the existing tests.

Change-Id: I777ea07a1cdb6cadcc2a94952f553b6b036e7382
Reviewed-on: https://go-review.googlesource.com/19496
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-12 23:38:00 +00:00
..
serial cmd/guru: rename oracle to guru, copying it to a single package 2016-02-12 03:38:58 +00:00
testdata/src cmd/guru: describe: show selectable fields when describing a type 2016-02-12 23:35:49 +00:00
callees.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
callers.go cmd/guru: call{ers,stack}: avoid pointer analysis where possible 2016-02-12 23:38:00 +00:00
callstack.go cmd/guru: call{ers,stack}: avoid pointer analysis where possible 2016-02-12 23:38:00 +00:00
definition.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
describe.go cmd/guru: describe: show selectable fields when describing a type 2016-02-12 23:35:49 +00:00
emacs-test.bash cmd/guru: clean ups to command-line interface 2016-02-12 21:50:49 +00:00
freevars.go cmd/guru: freevars: reenable test of labels (and improve output) 2016-02-12 03:59:51 +00:00
guru_test.go cmd/guru: remove vestiges of -pos flag 2016-02-12 22:00:14 +00:00
guru.el cmd/guru: clean ups to command-line interface 2016-02-12 21:50:49 +00:00
guru.go cmd/guru: remove vestiges of -pos flag 2016-02-12 22:00:14 +00:00
guru.vim cmd/guru: clean ups to command-line interface 2016-02-12 21:50:49 +00:00
implements.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
main.go cmd/guru: call{ers,stack}: avoid pointer analysis where possible 2016-02-12 23:38:00 +00:00
peers.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
pointsto.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
pos.go cmd/guru: remove vestiges of -pos flag 2016-02-12 22:00:14 +00:00
referrers.go cmd/guru: fix bad import, and run gofmt 2016-02-12 03:58:01 +00:00
what.go cmd/guru: rename oracle to guru, copying it to a single package 2016-02-12 03:38:58 +00:00
whicherrs.go cmd/guru: rename oracle to guru, copying it to a single package 2016-02-12 03:38:58 +00:00