From 84570aa9a18fa46dba1402004a54cedc7cf5e043 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 7 Mar 2014 15:11:16 -0500 Subject: runtime: round stack size to power of 2. Fixes build on windows/386 and plan9/386. Fixes #7487. LGTM=mattn.jp, dvyukov, rsc R=golang-codereviews, mattn.jp, dvyukov, 0intro, rsc CC=golang-codereviews https://golang.org/cl/72360043 --- src/pkg/runtime/stack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pkg/runtime/stack.c') diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index d1ba2bfdb9..ead9ba59c1 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -555,8 +555,8 @@ copystack(G *gp, uintptr nframes, uintptr newsize) } // round x up to a power of 2. -static int32 -round2(int32 x) +int32 +runtime·round2(int32 x) { int32 s; @@ -683,7 +683,7 @@ runtime·newstack(void) if(framesize < StackMin) framesize = StackMin; framesize += StackSystem; - framesize = round2(framesize); + framesize = runtime·round2(framesize); stk = runtime·stackalloc(gp, framesize); if(gp->stacksize > runtime·maxstacksize) { runtime·printf("runtime: goroutine stack exceeds %D-byte limit\n", (uint64)runtime·maxstacksize); -- cgit v1.3