mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: populate AuxCall fields for OpClosureCall
Change-Id: Ib5f62826d5249c1727b57d9f8ff2f3a1d6dc5032 Reviewed-on: https://go-review.googlesource.com/c/go/+/240185 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
acde81e0a9
commit
39da81da5e
2 changed files with 8 additions and 4 deletions
|
|
@ -4306,7 +4306,7 @@ func (s *state) openDeferExit() {
|
||||||
v := s.load(r.closure.Type.Elem(), r.closure)
|
v := s.load(r.closure.Type.Elem(), r.closure)
|
||||||
s.maybeNilCheckClosure(v, callDefer)
|
s.maybeNilCheckClosure(v, callDefer)
|
||||||
codeptr := s.rawLoad(types.Types[TUINTPTR], v)
|
codeptr := s.rawLoad(types.Types[TUINTPTR], v)
|
||||||
call = s.newValue3A(ssa.OpClosureCall, types.TypeMem, ssa.ClosureAuxCall(), codeptr, v, s.mem())
|
call = s.newValue3A(ssa.OpClosureCall, types.TypeMem, ssa.ClosureAuxCall(ACArgs, ACResults), codeptr, v, s.mem())
|
||||||
} else {
|
} else {
|
||||||
// Do a static call if the original call was a static function or method
|
// Do a static call if the original call was a static function or method
|
||||||
call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, ssa.StaticAuxCall(fn.Sym.Linksym(), ACArgs, ACResults), s.mem())
|
call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, ssa.StaticAuxCall(fn.Sym.Linksym(), ACArgs, ACResults), s.mem())
|
||||||
|
|
@ -4512,7 +4512,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
|
||||||
// critical that we not clobber any arguments already
|
// critical that we not clobber any arguments already
|
||||||
// stored onto the stack.
|
// stored onto the stack.
|
||||||
codeptr = s.rawLoad(types.Types[TUINTPTR], closure)
|
codeptr = s.rawLoad(types.Types[TUINTPTR], closure)
|
||||||
call = s.newValue3A(ssa.OpClosureCall, types.TypeMem, ssa.ClosureAuxCall(), codeptr, closure, s.mem())
|
call = s.newValue3A(ssa.OpClosureCall, types.TypeMem, ssa.ClosureAuxCall(ACArgs, ACResults), codeptr, closure, s.mem())
|
||||||
case codeptr != nil:
|
case codeptr != nil:
|
||||||
call = s.newValue2A(ssa.OpInterCall, types.TypeMem, ssa.InterfaceAuxCall(ACArgs, ACResults), codeptr, s.mem())
|
call = s.newValue2A(ssa.OpInterCall, types.TypeMem, ssa.InterfaceAuxCall(ACArgs, ACResults), codeptr, s.mem())
|
||||||
case sym != nil:
|
case sym != nil:
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,10 @@ type AuxCall struct {
|
||||||
results []Param
|
results []Param
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns
|
||||||
|
// "AuxCall{<fn>(<args>)}" if len(results) == 0;
|
||||||
|
// "AuxCall{<fn>(<args>)<results[0]>}" if len(results) == 1;
|
||||||
|
// "AuxCall{<fn>(<args>)(<results>)}" otherwise.
|
||||||
func (a *AuxCall) String() string {
|
func (a *AuxCall) String() string {
|
||||||
var fn string
|
var fn string
|
||||||
if a.Fn == nil {
|
if a.Fn == nil {
|
||||||
|
|
@ -125,8 +129,8 @@ func InterfaceAuxCall(args []Param, results []Param) *AuxCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClosureAuxCall returns an AuxCall for a closure call.
|
// ClosureAuxCall returns an AuxCall for a closure call.
|
||||||
func ClosureAuxCall() *AuxCall {
|
func ClosureAuxCall(args []Param, results []Param) *AuxCall {
|
||||||
return &AuxCall{}
|
return &AuxCall{Fn: nil, args: args, results: results}
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue