cmd/compile: escape analysis of interface calls to non-exported method names #16001
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
Milestone
Consider this Go source:
At the f.f(&i) call site in H, we can't be sure exactly what method will be called. However, since it's an unexported method name, it must be implemented by a method in the same package. Consequently, if we know that all candidate methods in the package are non-escaping (such as A.f and B.f are), we can still be sure that f.f(&i) is a non-escaping call.
Note that we still have to consider A.f even though A itself doesn't implement Fer, because a downstream package could do something like:
There are probably refinements that could avoid this though.
I happened to notice this because of package net's "exchange" function, which calls the unexported TCPConn.dnsRoundTrip or UDPConn.dnsRoundTrip methods. I haven't investigated how common this situation is though.
/cc @dr2chase @alandonovan
The text was updated successfully, but these errors were encountered: