aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-04-20 16:10:15 +0000
committerAustin Clements <austin@google.com>2023-04-20 16:19:49 +0000
commit466e6dae9570ac88ef15c5f1bda9a59d7253cfee (patch)
tree916fcafde3a860e6c399a6342d4ac2c426113ef2 /src/runtime/stack.go
parentd11ff3f08155b7614485d9b555e97f7a9555ede5 (diff)
downloadgo-466e6dae9570ac88ef15c5f1bda9a59d7253cfee.tar.xz
Revert "internal/abi, runtime, cmd: merge StackSmall, StackBig consts into internal/abi"
This reverts commit CL 486379. Submitted out of order and breaks bootstrap. Change-Id: Ie20a61cc56efc79a365841293ca4e7352b02d86b Reviewed-on: https://go-review.googlesource.com/c/go/+/486917 TryBot-Bypass: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 39dbed5114..e1e6c7e82a 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -85,6 +85,13 @@ const (
_FixedStack6 = _FixedStack5 | (_FixedStack5 >> 16)
_FixedStack = _FixedStack6 + 1
+ // Functions that need frames bigger than this use an extra
+ // instruction to do the stack split check, to avoid overflow
+ // in case SP - framesize wraps below zero.
+ // This value can be no bigger than the size of the unmapped
+ // space at zero.
+ _StackBig = 4096
+
// The stack guard is a pointer this many bytes above the
// bottom of the stack.
//
@@ -94,10 +101,15 @@ const (
// This arithmetic must match that in cmd/internal/objabi/stack.go:StackLimit.
_StackGuard = 928*sys.StackGuardMultiplier + _StackSystem
+ // 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
+
// The maximum number of bytes that a chain of NOSPLIT
// functions can use.
// This arithmetic must match that in cmd/internal/objabi/stack.go:StackLimit.
- _StackLimit = _StackGuard - _StackSystem - abi.StackSmall
+ _StackLimit = _StackGuard - _StackSystem - _StackSmall
)
const (