]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] runtime: allow deferproc split stack
authorCherry Mui <cherryyz@google.com>
Sat, 5 Jun 2021 00:07:50 +0000 (20:07 -0400)
committerCherry Mui <cherryyz@google.com>
Tue, 8 Jun 2021 21:45:35 +0000 (21:45 +0000)
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>
src/runtime/panic.go

index dc3f6956eb9fff4da5c8250e389fbaf6b1b0e75b..5f35abc43b968d7bfcc383bc5720df005810d6c3 100644 (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()