mirror of
https://github.com/golang/go
synced 2024-11-02 09:28:34 +00: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
1 changed files with 1 additions and 13 deletions
|
@ -372,19 +372,7 @@ func freedefer(d *_defer) {
|
||||||
unlock(&sched.deferlock)
|
unlock(&sched.deferlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
// These lines used to be simply `*d = _defer{}` but that
|
*d = _defer{}
|
||||||
// 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
|
|
||||||
|
|
||||||
pp.deferpool = append(pp.deferpool, d)
|
pp.deferpool = append(pp.deferpool, d)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue