cmd/compile: inlining after devirtualization #52193
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
In #33160 we talked about an escape analysis pass after devirtualization, to prevent arguments of devirtualized interface method calls from escaping to the heap. This made it possible to use
crypto/sha256.New256().Write(buf)
without leakingbuf
. ✨Separately, I've been using the mid-stack inliner to outline allocations into the caller, enabling allocation-free APIs that ergonomically return a
[]byte
. 🎉I am now designing the crypto/ecdh API, and I'd like to combine these two techniques, because the cleanest API we could come up with @rsc so far is something like this
which you'd use like this
Unfortunately, there is no inlining pass after devirtualization, so although
p256.GenerateKey
et al get devirtualized, they don't get inlined, and their allocations don't end up on the caller's stack.How doable would it be to have an inlining pass after devirtualization and before escape analysis? (It doesn't have to come before crypto/ecdh, but how likely it is to come later will influence whether we go with this or with more verbose concrete return values.)
/cc @mdempsky @randall77
The text was updated successfully, but these errors were encountered: