aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-03 12:22:19 -0400
committerRuss Cox <rsc@golang.org>2014-10-03 12:22:19 -0400
commit904ec0098137f742e0dd96da3bc033d6a0b615d1 (patch)
tree6a05a91443927524fcb78ac82df0142d8e6ae71f /src/runtime/stack.h
parentd42328c9f749140adf947833e0381fc639c32737 (diff)
parentc65a47f890e33eeed6ee9d8b6d965a5534fb6e0e (diff)
downloadgo-904ec0098137f742e0dd96da3bc033d6a0b615d1.tar.xz
[dev.garbage] merge default into dev.garbage
Diffstat (limited to 'src/runtime/stack.h')
-rw-r--r--src/runtime/stack.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/runtime/stack.h b/src/runtime/stack.h
index b30e322166..f97dc4ed8d 100644
--- a/src/runtime/stack.h
+++ b/src/runtime/stack.h
@@ -69,16 +69,19 @@ enum {
#endif // Plan 9
#endif // Windows
- // The amount of extra stack to allocate beyond the size
- // needed for the single frame that triggered the split.
- StackExtra = 2048,
+ // The minimum size of stack used by Go code
+ StackMin = 2048,
- // The minimum stack segment size to allocate.
- // If the amount needed for the splitting frame + StackExtra
- // is less than this number, the stack will have this size instead.
- StackMin = 8192,
- StackSystemRounded = StackSystem + (-StackSystem & (StackMin-1)),
- FixedStack = StackMin + StackSystemRounded,
+ // The minimum stack size to allocate.
+ // The hackery here rounds FixedStack0 up to a power of 2.
+ FixedStack0 = StackMin + StackSystem,
+ FixedStack1 = FixedStack0 - 1,
+ FixedStack2 = FixedStack1 | (FixedStack1 >> 1),
+ FixedStack3 = FixedStack2 | (FixedStack2 >> 2),
+ FixedStack4 = FixedStack3 | (FixedStack3 >> 4),
+ FixedStack5 = FixedStack4 | (FixedStack4 >> 8),
+ 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