]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: increase nosplit area to 192
authorRuss Cox <rsc@golang.org>
Sat, 30 Aug 2014 04:56:52 +0000 (00:56 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 30 Aug 2014 04:56:52 +0000 (00:56 -0400)
In CL 131450043, which raised it to 160,
I'd raise it to 192 if necessary.
Apparently it is necessary on windows/amd64.

One note for those concerned about the growth:
in the old segmented stack world, we wasted this much
space at the bottom of every stack segment.
In the new contiguous stack world, each goroutine has
only one stack segment, so we only waste this much space
once per goroutine. So even raising the limit further might
still be a net savings.

Fixes windows/amd64 build.

TBR=r
CC=golang-codereviews
https://golang.org/cl/132480043

src/pkg/runtime/stack.go
src/pkg/runtime/stack.h
src/pkg/runtime/stack_test.go
test/nosplit.go

index ae7e96a0051d8290e74f84331f0df9b10bc9348a..ea27c1fb709e26eb4ed680f080916581c9b152d3 100644 (file)
@@ -86,7 +86,7 @@ const (
        // 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 = 96
+       stackSmall = 64
 
        // The maximum number of bytes that a chain of NOSPLIT
        // functions can use.
index b2de78d898db3f4a157453bf46873736202ed471..dc9da74887a37ecd96f97d5ffa2e87732b4d59bc 100644 (file)
@@ -47,7 +47,7 @@ above checks (without allocating a full frame), which might trigger
 a call to morestack.  This sequence needs to fit in the bottom
 section of the stack.  On amd64, morestack's frame is 40 bytes, and
 deferproc's frame is 56 bytes.  That fits well within the
-StackGuard - StackSmall = 128 bytes at the bottom.  
+StackGuard - StackSmall bytes at the bottom.  
 The linkers explore all possible call traces involving non-splitting
 functions to make sure that this limit cannot be violated.
  */
@@ -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 = 96,
+       StackSmall = 64,
 
        // The maximum number of bytes that a chain of NOSPLIT
        // functions can use.
index 956c282136d4a931ebfcd0ccd89d5095c2043aff..2877074f76df6a849c5d659650e2cab38bea9165 100644 (file)
@@ -15,7 +15,7 @@ import (
 // See stack.h.
 const (
        StackGuard = 256
-       StackSmall = 96
+       StackSmall = 64
        StackLimit = StackGuard - StackSmall
 )
 
index 39bb3fcb47868342b0764c0c3dbddcc3f68e76f2..3854f2420330e420878824360e571195a239776d 100644 (file)
@@ -256,11 +256,11 @@ TestCases:
                                name := m[1]
                                size, _ := strconv.Atoi(m[2])
 
-                               // CL 131450043 raised the limit from 128 to 160.
+                               // The limit was originally 128 but is now 192.
                                // Instead of rewriting the test cases above, adjust
                                // the first stack frame to use up the extra 32 bytes.
                                if i == 0 {
-                                       size += 32
+                                       size += 192 - 128
                                }
 
                                if goarch == "amd64" && size%8 == 4 {