diff options
author | Russ Cox <rsc@golang.org> | 2014-09-04 00:54:06 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-09-04 00:54:06 -0400 |
commit | 372300dd9891f1ecaf10aeea9691329227ada0b6 (patch) | |
tree | 90043b702d96ea24888836a6d754fca65ab36ed8 /src/pkg/runtime/debug.go | |
parent | 60dc8fe1e2129e3e0ae0f0e09d8a78f35c8fdc30 (diff) | |
download | go-372300dd9891f1ecaf10aeea9691329227ada0b6.tar.gz |
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
Diffstat (limited to 'src/pkg/runtime/debug.go')
-rw-r--r-- | src/pkg/runtime/debug.go | 9 |
1 files changed, 7 insertions, 2 deletions
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 { |