cmd/compile: PGO devirtualization of partial interface implementations #64673
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
Callees that only partially implement an interface (they are embedded in another type that completes the interface) cannot be devirtualized.
e.g., consider:
io.nopCloser
embedsReader
, so the PGO profile will report a call fromfoo -> bytes.Reader.Read
. Devirtualization will consider this candidate, determine thatbytes.Reader
does not implementio.ReadCloser
and decide that it must not be valid, but it is valid because of the wrapper type not visible from the profile.Devirtualization could be more lenient and only type-check the single method that is called rather than the entire interface, though this risks more false positives in ambiguous situations.
cc @cherrymui @aclements
The text was updated successfully, but these errors were encountered: