]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] runtime: allow newproc split stack
authorCherry Mui <cherryyz@google.com>
Sat, 5 Jun 2021 00:04:57 +0000 (20:04 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 11 Jun 2021 18:32:42 +0000 (18:32 +0000)
newproc 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: I6f39730fb1595c4b0438c74118fef418fe1c082b
Reviewed-on: https://go-review.googlesource.com/c/go/+/325919
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/runtime/proc.go

index 5d2511b83cff8e500ee5b501e1d479fb8be1fc8b..d6f3af690ba1379c47c75948d1edee9d471af18a 100644 (file)
@@ -4220,18 +4220,6 @@ func malg(stacksize int32) *g {
 // Create a new g running fn.
 // Put it on the queue of g's waiting to run.
 // The compiler turns a go statement into a call to this.
-//
-// The stack layout of this call is unusual: it assumes that the
-// arguments to pass to fn are on the stack sequentially immediately
-// after &fn. Hence, they are logically part of newproc's argument
-// frame, even though they don't appear in its signature (and can't
-// because their types differ between call sites).
-//
-// This must be nosplit because this stack layout means there are
-// untyped arguments in newproc's argument frame. Stack copies won't
-// be able to adjust them and stack splits won't be able to copy them.
-//
-//go:nosplit
 func newproc(fn *funcval) {
        gp := getg()
        pc := getcallerpc()
@@ -4250,17 +4238,7 @@ func newproc(fn *funcval) {
 // Create a new g in state _Grunnable, starting at fn. callerpc is the
 // address of the go statement that created this. The caller is responsible
 // for adding the new g to the scheduler.
-//
-// This must run on the system stack because it's the continuation of
-// newproc, which cannot split the stack.
-//
-//go:systemstack
 func newproc1(fn *funcval, callergp *g, callerpc uintptr) *g {
-       // TODO: When we commit to GOEXPERIMENT=regabidefer,
-       // rewrite the comments for newproc and newproc1.
-       // newproc will no longer have a funny stack layout or
-       // need to be nosplit.
-
        _g_ := getg()
 
        if fn == nil {