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

x/tools/cmd/godoc: incomplete list of callers #13235

mdempsky opened this issue Nov 13, 2015 · 2 comments


None yet
3 participants
Copy link

commented Nov 13, 2015

At head (f762d0d, golang/tools@d94e6fe), if I run

GOPATH= godoc -http=:6060 -analysis=type,pointer

and go to http://localhost:6060/src/runtime/runtime2.go, and click "func" in

81  func efaceOf(ep *interface{}) *eface {

it lists only two callers:

Callers of runtime.efaceOf:
getgcmask at line 1640
BenchSetType at line 134

But there's at least several more:

$ grep efaceOf *.go
error.go:   e := efaceOf(&x)
export_test.go: e := *efaceOf(&x)
heapdump.go:        eface := efaceOf(&p.arg)
mbitmap.go: typ := (*ptrtype)(unsafe.Pointer(efaceOf(&x)._type)).elem
mbitmap.go: e := *efaceOf(&ep)
mfinal.go:  e := efaceOf(&obj)
mfinal.go:  f := efaceOf(&finalizer)
mfinal.go:      if assertE2I2(ityp, *efaceOf(&obj), nil) {
runtime2.go:func efaceOf(ep *interface{}) *eface {

CC @alandonovan

@mdempsky mdempsky added this to the Unreleased milestone Nov 13, 2015


This comment has been minimized.

Copy link

commented Nov 13, 2015

The pointer analysis treats calls to exported functions in the runtime package specially because when the analysis was written, the package was mostly C code so there wasn't much to analyze. Instead of looking at the source for that package, the analysis has built-in knowledge of the aliasing and callgraph effects of the important functions, which are few.

Even though the runtime package is now in Go, I would not revisit this decision because the package makes such extensive use of unsafe.Pointer conversions, which the pointer analysis handles unsoundly: it treats a conversion from unsafe.Pointer to T just like new(T).

You can see the list of PTA intrinsics in

So, working as intended, and tough luck if you work on the runtime. :(


This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2015

Hm, I'm having trouble understanding how PTA and package runtime instrinsics would be relevant to the particular issue I pointed out. All of the efaceOf calls are direct calls via the function's name, so it's odd to me that it finds a couple of them, but not all?

@golang golang locked and limited conversation to collaborators Dec 29, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.