зеркало из https://github.com/golang/tools.git
bfc94c967a
This change moves ssa.forEachReachable into internal/typesinternal.ForEachElement, simplifies the signature (by internalizing the type map part) and adds a test. There are two copies of this algorithm (the other in go/callgraph/rta), and we will need it again in ssautil.Reachable (see golang/go#69291). A follow-up change will make the copy in rta delegate to this one (small steps). Also, make ssa.Program.RuntimeTypes do the type analysis when it is called, instead of doing it eagerly each time we encounter a MakeInterface instruction. This should reduce eventually costs since RuntimeTypes shouldn't be needed: it was added for the pointer analysis (since deleted) and it used by ssautil.AllFunctions (to be replaced, see golang/go#69291), and in both cases it is the wrong tool for the job because: (a) it is more precise to accumulate runtime types in the subset of the program of interest, while doing some kind of reachability fixed-point computation; and (b) its use in AllFunctions is unsound because although it accounts for all (too many!) MakeInterface operations it does not account for types exposed through public API (see the proposed replacement, ssautil.Reachable) when analyzing incomplete programs. Updates golang/go#69291 Change-Id: Ib369278e50295b9287fe95c06169b81425193e90 Reviewed-on: https://go-review.googlesource.com/c/tools/+/610939 Reviewed-by: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> |
||
---|---|---|
.. | ||
aliases | ||
analysisinternal | ||
apidiff | ||
astutil | ||
bisect | ||
diff | ||
diffp | ||
drivertest | ||
edit | ||
event | ||
facts | ||
fakenet | ||
gcimporter | ||
gocommand | ||
gopathwalk | ||
goroot | ||
imports | ||
jsonrpc2 | ||
jsonrpc2_v2 | ||
memoize | ||
packagesinternal | ||
pkgbits | ||
pprof | ||
proxydir | ||
refactor/inline | ||
robustio | ||
stack | ||
stdlib | ||
testenv | ||
testfiles | ||
tokeninternal | ||
tool | ||
typeparams | ||
typesinternal | ||
versions | ||
xcontext |