]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] runtime: remove unnecessary split-prevention from defer code
authorAustin Clements <austin@google.com>
Mon, 26 Jul 2021 16:04:36 +0000 (12:04 -0400)
committerAustin Clements <austin@google.com>
Fri, 30 Jul 2021 18:49:42 +0000 (18:49 +0000)
commit53fd5b1b77aa2801ca042386c93fe59e7e23abc4
tree8c3cd5c00abc6e1aff95f8127feb0c7b5721ac36
parentea94e5d3c57fadea088cdc5002e014b3c7ef4bc1
[dev.typeparams] runtime: remove unnecessary split-prevention from defer code

Prior to regabi, the compiler passed defer arguments to the runtime as
untyped values on the stack. This meant a lot of defer-related runtime
functions had to be very careful not to grow the stack or allow
preemption since the stack could not be safely scanned or moved.
However, with regabi, every defer is now simply a func() from the
runtime's perspective, which means we no longer have untyped values on
the stack when we enter defer-related runtime code.

Hence, this CL removes a lot of the now-unnecessary carefulness in the
defer implementation. Specifically, deferreturn no longer needs to be
nosplit because it doesn't copy untyped defer arguments to its
caller's frame (we also update some stale comments in deferreturn).
freedefer no longer needs to be nosplit because it's none of its
callers are deeply nosplit. And newdefer and freedefer no longer need
to switch to the systemstack on their slow paths to avoid stack
growth.

deferprocStack is the only function that still needs to be nosplit,
but that's because the compiler calls it with uninitialized live
pointer slots on the stack (maybe we should change that, but that's a
very different fix).

Change-Id: I1156ec90bff2613fe4b48b84b375943349ce637d
Reviewed-on: https://go-review.googlesource.com/c/go/+/337651
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>
src/runtime/panic.go