summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2023-04-19 14:01:05 -0400
committerGopher Robot <gobot@golang.org>2023-04-21 19:28:56 +0000
commit0f099a4bc569e32fbddefb8e3de6b59cf6d1959d (patch)
treef1d4108465cabff9973a65b5c4ec6655b4218b57 /test
parent03ad1f1a340841e7c60ee635ff894fe19cd99506 (diff)
downloadgo-git-0f099a4bc569e32fbddefb8e3de6b59cf6d1959d.tar.gz
runtime, cmd: rationalize StackLimit and StackGuard
The current definitions of StackLimit and StackGuard only indirectly specify the NOSPLIT stack limit and duplicate a literal constant (928). Currently, they define the stack guard delta, and from there compute the NOSPLIT limit. Rationalize these by defining a new constant, abi.StackNosplitBase, which consolidates and directly specifies the NOSPLIT stack limit (in the default case). From this we then compute the stack guard delta, inverting the relationship between these two constants. While we're here, we rename StackLimit to StackNosplit to make it clearer what's being limited. This change does not affect the values of these constants in the default configuration. It does slightly change how StackGuardMultiplier values other than 1 affect the constants, but this multiplier is a pretty rough heuristic anyway. before after stackNosplit 800 800 _StackGuard 928 928 stackNosplit -race 1728 1600 _StackGuard -race 1856 1728 For #59670. Change-Id: Ia94094c5e47897e7c088d24b4a5e33f5c2768db5 Reviewed-on: https://go-review.googlesource.com/c/go/+/486976 Auto-Submit: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test')
-rw-r--r--test/nosplit.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/test/nosplit.go b/test/nosplit.go
index a695654eaf..2b1bb5492d 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -342,22 +342,15 @@ TestCases:
nosplit := m[3]
body := m[4]
- // The limit was originally 128 but is now 800 (928-128).
+ // The limit was originally 128 but is now 800.
// Instead of rewriting the test cases above, adjust
// the first nosplit frame to use up the extra bytes.
// This isn't exactly right because we could have
// nosplit -> split -> nosplit, but it's good enough.
if !adjusted && nosplit != "" {
+ const stackNosplitBase = 800 // internal/abi.StackNosplitBase
adjusted = true
- size += (928 - 128) - 128
- // Noopt builds have a larger stackguard.
- // See ../src/cmd/dist/buildruntime.go:stackGuardMultiplier
- // This increase is included in objabi.StackGuard
- for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
- if s == "-N" {
- size += 928
- }
- }
+ size += stackNosplitBase - 128
}
if nosplit != "" {