aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-09-13 15:53:47 -0700
committerIan Lance Taylor <iant@golang.org>2017-09-22 18:17:13 +0000
commit332719f7cee2abafb3963009d44ad7cc93474707 (patch)
tree39371a6dbd9e627f28b1ee585a2b6c629ed3e3a7 /src/runtime/runtime2.go
parent9daee931214a7ad68579f4bb2695bba561067c58 (diff)
downloadgo-332719f7cee2abafb3963009d44ad7cc93474707.tar.xz
runtime: don't call lockOSThread for every cgo call
For a trivial benchmark with a do-nothing cgo call: name old time/op new time/op delta Call-4 64.5ns ± 7% 63.0ns ± 6% -2.25% (p=0.027 n=20+16) Because Windows uses the cgocall mechanism to make system calls, and passes arguments in a struct held in the m, we need to do the lockOSThread/unlockOSThread in that code. Because deferreturn was getting a nosplit stack overflow error, change it to avoid calling typedmemmove. Updates #21827. Change-Id: I9b1d61434c44faeb29805b46b409c812c9acadc2 Reviewed-on: https://go-review.googlesource.com/64070 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 174a73bdb3..27b1e37803 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -675,7 +675,8 @@ func extendRandom(r []byte, n int) {
}
}
-// deferred subroutine calls
+// A _defer holds an entry on the list of deferred calls.
+// If you add a field here, add code to clear it in freedefer.
type _defer struct {
siz int32
started bool