Commit 46137f22 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: update comment on stack allocator

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9665046
parent a2ec8abd
...@@ -81,13 +81,10 @@ runtime·stackalloc(uint32 n) ...@@ -81,13 +81,10 @@ runtime·stackalloc(uint32 n)
if(g != m->g0) if(g != m->g0)
runtime·throw("stackalloc not on scheduler stack"); runtime·throw("stackalloc not on scheduler stack");
// Stack allocator uses malloc/free most of the time, // Stacks are usually allocated with a fixed-size free-list allocator,
// but if we're in the middle of malloc and need stack, // but if we need a stack of non-standard size, we fall back on malloc
// we have to do something else to avoid deadlock. // (assuming that inside malloc and GC all the stack frames are small,
// In that case, we fall back on a fixed-size free-list // so that we do not deadlock).
// allocator, assuming that inside malloc all the stack
// frames are small, so that all the stack allocations
// will be a single size, the minimum (right now, 5k).
if(n == FixedStack || m->mallocing || m->gcing) { if(n == FixedStack || m->mallocing || m->gcing) {
if(n != FixedStack) { if(n != FixedStack) {
runtime·printf("stackalloc: in malloc, size=%d want %d\n", FixedStack, n); runtime·printf("stackalloc: in malloc, size=%d want %d\n", FixedStack, n);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment