mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.unified] cmd/compile: fix missing method value wrapper in unified IR
Unified IR uses to generate wrappers after the global inlining pass, so it needs to apply inlining for the wrappers itself. However, inlining may reveal new method value nodes which have not been seen yet, thus unified IR never generates wrappers for them. To fix it, just visiting the wrapper function body once more time after inlining, and generate wrappers for any new method value nodes. Fixes #52128 Change-Id: I78631c4faa0b00357d4f84704d3525fd38a52cd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/410344 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
3a1f1e1575
commit
a8780f94c3
5 changed files with 68 additions and 0 deletions
|
|
@ -2468,6 +2468,15 @@ func finishWrapperFunc(fn *ir.Func, target *ir.Package) {
|
|||
// so we're responsible for applying inlining ourselves here.
|
||||
inline.InlineCalls(fn)
|
||||
|
||||
// The body of wrapper function after inlining may reveal new ir.OMETHVALUE node,
|
||||
// we don't know whether wrapper function has been generated for it or not, so
|
||||
// generate one immediately here.
|
||||
ir.VisitList(fn.Body, func(n ir.Node) {
|
||||
if n, ok := n.(*ir.SelectorExpr); ok && n.Op() == ir.OMETHVALUE {
|
||||
wrapMethodValue(n.X.Type(), n.Selection, target, true)
|
||||
}
|
||||
})
|
||||
|
||||
target.Decls = append(target.Decls, fn)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue