mirror of https://github.com/golang/go.git
cmd/compile: use s.temp for creating defer struct
Follow discussion in go.dev/cl/521676. Change-Id: Ie5c0ce66b60fcbfd59385e8c2c45d431133ab53a Reviewed-on: https://go-review.googlesource.com/c/go/+/522115 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
079dfdcac0
commit
86f0f08461
|
|
@ -5249,19 +5249,12 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
|
|||
|
||||
var call *ssa.Value
|
||||
if k == callDeferStack {
|
||||
// Make a defer struct d on the stack.
|
||||
if stksize != 0 {
|
||||
s.Fatalf("deferprocStack with non-zero stack size %d: %v", stksize, n)
|
||||
}
|
||||
|
||||
// Make a defer struct on the stack.
|
||||
t := deferstruct()
|
||||
d := typecheck.TempAt(n.Pos(), s.curfn, t)
|
||||
|
||||
if t.HasPointers() {
|
||||
s.vars[memVar] = s.newValue1A(ssa.OpVarDef, types.TypeMem, d, s.mem())
|
||||
}
|
||||
addr := s.addr(d)
|
||||
|
||||
_, addr := s.temp(n.Pos(), t)
|
||||
s.store(closure.Type,
|
||||
s.newValue1I(ssa.OpOffPtr, closure.Type.PtrTo(), t.FieldOff(deferStructFnField), addr),
|
||||
closure)
|
||||
|
|
|
|||
Loading…
Reference in New Issue