aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-08-27 14:08:26 -0400
committerRuss Cox <rsc@golang.org>2014-08-27 14:08:26 -0400
commitfe91006a02b4892d95d1625889632aa4e0fe2b58 (patch)
treeb47072b97b0cc713b958d8c2f98fc1d3ad582f1c /src/pkg
parent9a5654abeff85c8ac9b1b43bf7da9aa9f4bdfa15 (diff)
downloadgo-fe91006a02b4892d95d1625889632aa4e0fe2b58.tar.xz
runtime: give nosplit functions 32 more bytes of headroom
The Go calling convention uses more stack space than C. On 64-bit systems we've been right up against the limit (128 bytes, so only 16 words) and doing awful things to our source code to work around it. Instead of continuing to do awful things, raise the limit to 160 bytes. I am prepared to raise the limit to 192 bytes if necessary, but I think this will be enough. Should fix current link-time stack overflow errors on - nacl/arm - netbsd/amd64 - openbsd/amd64 - solaris/amd64 - windows/amd64 TBR=r CC=golang-codereviews, iant https://golang.org/cl/131450043
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/stack.h2
-rw-r--r--src/pkg/runtime/stack_test.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/runtime/stack.h b/src/pkg/runtime/stack.h
index ee5fd351d5..b2de78d898 100644
--- a/src/pkg/runtime/stack.h
+++ b/src/pkg/runtime/stack.h
@@ -94,7 +94,7 @@ enum {
// After a stack split check the SP is allowed to be this
// many bytes below the stack guard. This saves an instruction
// in the checking sequence for tiny frames.
- StackSmall = 128,
+ StackSmall = 96,
// The maximum number of bytes that a chain of NOSPLIT
// functions can use.
diff --git a/src/pkg/runtime/stack_test.go b/src/pkg/runtime/stack_test.go
index 08282afd42..956c282136 100644
--- a/src/pkg/runtime/stack_test.go
+++ b/src/pkg/runtime/stack_test.go
@@ -15,7 +15,8 @@ import (
// See stack.h.
const (
StackGuard = 256
- StackLimit = 128
+ StackSmall = 96
+ StackLimit = StackGuard - StackSmall
)
// Test stack split logic by calling functions of every frame size