From 88bd92bb6dd7997b415723c9c4a8d26ebe17634b Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 3 Aug 2021 17:03:42 -0400 Subject: [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 Run-TryBot: Austin Clements TryBot-Result: Go Bot Reviewed-by: Cherry Mui --- src/runtime/panic.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/runtime/panic.go b/src/runtime/panic.go index b2158d376e..48b1b5dd9d 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -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) -- cgit v1.2.3-54-g00ecf