mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: early devirtualization of interface method calls
After inlining, add a pass that looks for interface calls where we can statically determine the interface value's concrete type. If such a case is found, insert an explicit type assertion to the concrete type so that escape analysis can see it. Fixes #33160. Change-Id: I36932c691693f0069e34384086d63133e249b06b Reviewed-on: https://go-review.googlesource.com/c/go/+/264837 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
f2c0c2b902
commit
5cc43c51c9
3 changed files with 68 additions and 11 deletions
|
|
@ -701,6 +701,13 @@ func Main(archInit func(*Arch)) {
|
|||
})
|
||||
}
|
||||
|
||||
for _, n := range xtop {
|
||||
if n.Op == ODCLFUNC {
|
||||
devirtualize(n)
|
||||
}
|
||||
}
|
||||
Curfn = nil
|
||||
|
||||
// Phase 6: Escape analysis.
|
||||
// Required for moving heap allocations onto stack,
|
||||
// which in turn is required by the closure implementation,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue