diff options
author | Austin Clements <austin@google.com> | 2021-08-03 17:03:42 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2021-08-03 21:23:25 +0000 |
commit | 88bd92bb6dd7997b415723c9c4a8d26ebe17634b (patch) | |
tree | 887790b3ebe50857a2f2af3f231ba8b269d8e283 | |
parent | 1a0630aef474320e71595ed1a4a984fc7c7bbc0a (diff) | |
download | go-88bd92bb6dd7997b415723c9c4a8d26ebe17634b.tar.gz go-88bd92bb6dd7997b415723c9c4a8d26ebe17634b.zip |
[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>
-rw-r--r-- | src/runtime/panic.go | 14 |
1 files changed, 1 insertions, 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) |