From 372300dd9891f1ecaf10aeea9691329227ada0b6 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 4 Sep 2014 00:54:06 -0400 Subject: runtime: correct various Go -> C function calls Some things get converted. Other things (too complex or too many C deps) get onM calls. Other things (too simple) get #pragma textflag NOSPLIT. After this CL, the offending function list is basically: - panic.c - netpoll.goc - mem*.c - race stuff - readgstatus - entersyscall/exitsyscall LGTM=r, iant R=golang-codereviews, r, iant CC=dvyukov, golang-codereviews, khr https://codereview.appspot.com/140930043 --- src/pkg/runtime/debug.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/pkg/runtime/debug.go') diff --git a/src/pkg/runtime/debug.go b/src/pkg/runtime/debug.go index ed11fb1b1..bb4bd60ed 100644 --- a/src/pkg/runtime/debug.go +++ b/src/pkg/runtime/debug.go @@ -24,10 +24,15 @@ func UnlockOSThread() // The number of logical CPUs on the local machine can be queried with NumCPU. // This call will go away when the scheduler improves. func GOMAXPROCS(n int) int { - return int(gomaxprocsfunc(int32(n))) + g := getg() + g.m.scalararg[0] = uintptr(n) + onM(gomaxprocs_m) + n = int(g.m.scalararg[0]) + g.m.scalararg[0] = 0 + return n } -func gomaxprocsfunc(int32) int32 // proc.c +func gomaxprocs_m() // proc.c // NumCPU returns the number of logical CPUs on the local machine. func NumCPU() int { -- cgit v1.2.1