aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-04-09 16:08:28 -0400
committerAustin Clements <austin@google.com>2021-04-11 20:07:18 +0000
commit352d329c44d99b5c6cb325940006ca52f88195f3 (patch)
tree9de5e1d1a594d21f6a004636f0b3d33fc9d22e43 /src/runtime/proc.go
parent189c6946f598dc668946499e4179775c06295f9d (diff)
downloadgo-352d329c44d99b5c6cb325940006ca52f88195f3.tar.gz
go-352d329c44d99b5c6cb325940006ca52f88195f3.zip
runtime: move zero-sized frame check from newproc to newproc1
If GOEXPERIMENT=regabidefer is enabled, newproc currently checks that the call frame for new goroutines is empty. But there's one place in the runtime (debugCallWrap), where we call newproc1, and it happens to pass a non-empty frame. The current check didn't catch that. Move the empty call frame check from newproc to newproc1 to catch this. Updates #40724. Change-Id: I9998faf1e07e7b7af88e06a8177127f998c40252 Reviewed-on: https://go-review.googlesource.com/c/go/+/309034 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index d545a143a0..6c1c5dd917 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -4020,12 +4020,6 @@ func malg(stacksize int32) *g {
//
//go:nosplit
func newproc(siz int32, fn *funcval) {
- if goexperiment.RegabiDefer && siz != 0 {
- // TODO: When we commit to GOEXPERIMENT=regabidefer,
- // rewrite newproc's comment, since it will no longer
- // have a funny stack layout or need to be nosplit.
- throw("go with non-empty frame")
- }
argp := add(unsafe.Pointer(&fn), sys.PtrSize)
gp := getg()
pc := getcallerpc()
@@ -4051,6 +4045,14 @@ func newproc(siz int32, fn *funcval) {
//
//go:systemstack
func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerpc uintptr) *g {
+ if goexperiment.RegabiDefer && narg != 0 {
+ // 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.
+ throw("go with non-empty frame")
+ }
+
_g_ := getg()
if fn == nil {