aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-07-27 12:41:46 -0400
committerRuss Cox <rsc@golang.org>2011-07-27 12:41:46 -0400
commit100a034120e7f68ba5ca687b98bb930f4f539b9b (patch)
treec5493462840c06f18f880eb5a0ab9f874fd22aa6
parentc913cb8ba517bdcfc5fc5a46df70145e3a30338b (diff)
downloadgo-100a034120e7f68ba5ca687b98bb930f4f539b9b.tar.gz
go-100a034120e7f68ba5ca687b98bb930f4f539b9b.zip
runtime: higher goroutine arg limit, clearer error
Fixes #591. R=ken2 CC=golang-dev https://golang.org/cl/4803054
-rw-r--r--src/pkg/runtime/proc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 13bc52bb68..ffaf44ddd8 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -1054,8 +1054,13 @@ runtime·newproc1(byte *fn, byte *argp, int32 narg, int32 nret, void *callerpc)
//printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret);
siz = narg + nret;
siz = (siz+7) & ~7;
- if(siz > 1024)
- runtime·throw("runtime.newproc: too many args");
+
+ // We could instead create a secondary stack frame
+ // and make it look like goexit was on the original but
+ // the call to the actual goroutine function was split.
+ // Not worth it: this is almost always an error.
+ if(siz > StackMin - 1024)
+ runtime·throw("runtime.newproc: function arguments too large for new goroutine");
schedlock();