1
0
mirror of https://github.com/golang/go synced 2024-11-26 10:58:16 -07:00

[dev.typeparams] runtime: allow deferproc split stack

deferproc was not allowed to split stack because it had a special
stack layout, where the go'd function's arguments were passed on
stack but not included in the signature (therefore the stack map).
Now it no longer has argument, so it does not need to be nosplit.

Change-Id: I6d4b5302bd6fea6642bb4202984d86e3ebbc9054
Reviewed-on: https://go-review.googlesource.com/c/go/+/325920
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Cherry Mui 2021-06-04 20:07:50 -04:00
parent 83da32749c
commit b80a4c56f0

View File

@ -226,7 +226,6 @@ func panicmemAddr(addr uintptr) {
// Create a new deferred function fn, which has no arguments and results.
// The compiler turns a defer statement into a call to this.
//go:nosplit
func deferproc(fn func()) {
gp := getg()
if gp.m.curg != gp {
@ -234,11 +233,6 @@ func deferproc(fn func()) {
throw("defer on system stack")
}
// the arguments of fn are in a perilous state. The stack map
// for deferproc does not describe them. So we can't let garbage
// collection or stack copying trigger until we've copied them out
// to somewhere safe. The memmove below does that.
// Until the copy completes, we can only call nosplit routines.
sp := getcallersp()
callerpc := getcallerpc()