mirror of
https://github.com/golang/go
synced 2024-11-17 11:14:46 -07:00
[dev.typeparams] runtime: simplify freedefer
Currently, freedefer manually zeros all the fields in the _defer because simply assigning _defer{} used to cause a nosplit stack overflow. freedefer is no longer nosplit, so go back to the simpler, more robust code. Change-Id: I881f557bab3b1ee7ab29b68e7fb56d0fe6d35d8d Reviewed-on: https://go-review.googlesource.com/c/go/+/339669 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
1a0630aef4
commit
88bd92bb6d
@ -372,19 +372,7 @@ func freedefer(d *_defer) {
|
||||
unlock(&sched.deferlock)
|
||||
}
|
||||
|
||||
// These lines used to be simply `*d = _defer{}` but that
|
||||
// started causing a nosplit stack overflow via typedmemmove.
|
||||
d.started = false
|
||||
d.openDefer = false
|
||||
d.sp = 0
|
||||
d.pc = 0
|
||||
d.framepc = 0
|
||||
d.varp = 0
|
||||
d.fd = nil
|
||||
// d._panic and d.fn must be nil already.
|
||||
// If not, we would have called freedeferpanic or freedeferfn above,
|
||||
// both of which throw.
|
||||
d.link = nil
|
||||
*d = _defer{}
|
||||
|
||||
pp.deferpool = append(pp.deferpool, d)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user