The previous implementation would cause the graph to contain many duplicate edges resulting in very large cross products, so that for some inputs (and random map iteration orders) the running time of DeleteSyntheticNodes was many minutes---more than the pointer analysis! Duplicate edges can arise from an interface call that dispatches to several different wrapper functions each wrapping the same declared method. For example, in the callgraph for go/types, a call to Object.Pos() dispatches to the synthetic functions (*Type).Pos and (*Var).Pos, each of which wrap (*object).Pos(). After DeleteSyntheticNodes, Object.Pos() appeared to call (*object).Pos() twice. This change builds the set of all edges and avoids adding edges already in the set. Also, document findings. LGTM=crawshaw R=crawshaw CC=golang-codereviews https://golang.org/cl/96100043 |
||
---|---|---|
.. | ||
callgraph.go | ||
util.go |