OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 Stack layout parameters. | 6 Stack layout parameters. |
7 Included both by runtime (compiled via 6c) and linkers (compiled via gcc). | 7 Included both by runtime (compiled via 6c) and linkers (compiled via gcc). |
8 | 8 |
9 The per-goroutine g->stackguard is set to point StackGuard bytes | 9 The per-goroutine g->stackguard is set to point StackGuard bytes |
10 above the bottom of the stack. Each function compares its stack | 10 above the bottom of the stack. Each function compares its stack |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 */ | 53 */ |
54 | 54 |
55 enum { | 55 enum { |
56 // StackSystem is a number of additional bytes to add | 56 // StackSystem is a number of additional bytes to add |
57 // to each stack below the usual guard area for OS-specific | 57 // to each stack below the usual guard area for OS-specific |
58 // purposes like signal handling. Used on Windows because | 58 // purposes like signal handling. Used on Windows because |
59 // it does not use a separate stack. | 59 // it does not use a separate stack. |
60 #ifdef GOOS_windows | 60 #ifdef GOOS_windows |
61 StackSystem = 512 * sizeof(uintptr), | 61 StackSystem = 512 * sizeof(uintptr), |
62 #else | 62 #else |
| 63 #ifdef GOOS_plan9 |
| 64 StackSystem = 512, |
| 65 #else |
63 StackSystem = 0, | 66 StackSystem = 0, |
64 #endif | 67 #endif» // Plan 9 |
| 68 #endif» // Windows |
65 | 69 |
66 // The amount of extra stack to allocate beyond the size | 70 // The amount of extra stack to allocate beyond the size |
67 // needed for the single frame that triggered the split. | 71 // needed for the single frame that triggered the split. |
68 StackExtra = 1024, | 72 StackExtra = 1024, |
69 | 73 |
70 // The minimum stack segment size to allocate. | 74 // The minimum stack segment size to allocate. |
71 // If the amount needed for the splitting frame + StackExtra | 75 // If the amount needed for the splitting frame + StackExtra |
72 // is less than this number, the stack will have this size instead. | 76 // is less than this number, the stack will have this size instead. |
73 StackMin = 4096, | 77 StackMin = 4096, |
74 FixedStack = StackMin + StackSystem, | 78 FixedStack = StackMin + StackSystem, |
(...skipping 18 matching lines...) Expand all Loading... |
93 | 97 |
94 // The maximum number of bytes that a chain of NOSPLIT | 98 // The maximum number of bytes that a chain of NOSPLIT |
95 // functions can use. | 99 // functions can use. |
96 StackLimit = StackGuard - StackSystem - StackSmall, | 100 StackLimit = StackGuard - StackSystem - StackSmall, |
97 ········ | 101 ········ |
98 // The assumed size of the top-of-stack data block. | 102 // The assumed size of the top-of-stack data block. |
99 // The actual size can be smaller than this but cannot be larger. | 103 // The actual size can be smaller than this but cannot be larger. |
100 // Checked in proc.c's runtime.malg. | 104 // Checked in proc.c's runtime.malg. |
101 StackTop = 72, | 105 StackTop = 72, |
102 }; | 106 }; |
OLD | NEW |