aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-07-23 18:40:02 -0400
committerRuss Cox <rsc@golang.org>2013-07-23 18:40:02 -0400
commitdba623b1c7663016c79edbec517f8c8e7feb1437 (patch)
treefd45c976aa89358de98ae2ad6983d493ea5a43c3 /src/pkg/runtime/proc.c
parente97c870692aa80feabd2e22c191476220fc1281f (diff)
downloadgo-dba623b1c7663016c79edbec517f8c8e7feb1437.tar.xz
runtime: reduce frame size for runtime.cgocallback_gofunc
Tying preemption to stack splits means that we have to able to complete the call to exitsyscall (inside cgocallbackg at least for now) without any stack split checks, meaning that the whole sequence has to work within 128 bytes of stack, unless we increase the size of the red zone. This CL frees up 24 bytes along that critical path on amd64. (The 32-bit systems have plenty of space because all their words are smaller.) R=dvyukov CC=golang-dev https://golang.org/cl/11676043
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 9530b9984a..3ae9fe7273 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -651,10 +651,10 @@ runtimeĀ·needm(byte x)
g->stackguard0 = g->stackguard;
// On windows/386, we need to put an SEH frame (two words)
- // somewhere on the current stack. We are called
- // from needm, and we know there is some available
- // space one word into the argument frame. Use that.
- m->seh = (SEH*)((uintptr*)&x + 1);
+ // somewhere on the current stack. We are called from cgocallback_gofunc
+ // and we know that it will leave two unused words below m->curg->sched.sp.
+ // Use those.
+ m->seh = (SEH*)((uintptr*)m->curg->sched.sp - 3);
// Initialize this thread to use the m.
runtimeĀ·asminit();