mirror of
https://github.com/golang/go
synced 2024-11-26 04:07:59 -07:00
runtime: call unlockOSThread directly in Windows syscall functions
Windows syscall functions (e.g. syscall.Syscall9) are defined as cgo_unsafe_args (because it takes the address of one argument and use that to access all arguments) which makes them ABI0. In some case we may need ABI wrappers for them. Because those functions have a large number of arguments, the wrapper can take a non-trivial amount of stack frame, causing nosplit overflow when inlining is disabled. The overflow call chain involves deferreturn. This CL changes a deferred call to unlockOSThread to a direct call. If the syscall functions panics, it is likely a fatal error anyway. Fixes #45698. Change-Id: I280be826644de1205f9c8f5efaa4ec5e1b4eebc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/316650 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
f39997b2be
commit
4dbad79510
@ -482,12 +482,12 @@ func syscall_Syscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err ui
|
||||
//go:cgo_unsafe_args
|
||||
func syscall_Syscall9(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) {
|
||||
lockOSThread()
|
||||
defer unlockOSThread()
|
||||
c := &getg().m.syscall
|
||||
c.fn = fn
|
||||
c.n = nargs
|
||||
c.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
cgocall(asmstdcallAddr, unsafe.Pointer(c))
|
||||
unlockOSThread()
|
||||
return c.r1, c.r2, c.err
|
||||
}
|
||||
|
||||
@ -496,12 +496,12 @@ func syscall_Syscall9(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1
|
||||
//go:cgo_unsafe_args
|
||||
func syscall_Syscall12(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 uintptr) (r1, r2, err uintptr) {
|
||||
lockOSThread()
|
||||
defer unlockOSThread()
|
||||
c := &getg().m.syscall
|
||||
c.fn = fn
|
||||
c.n = nargs
|
||||
c.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
cgocall(asmstdcallAddr, unsafe.Pointer(c))
|
||||
unlockOSThread()
|
||||
return c.r1, c.r2, c.err
|
||||
}
|
||||
|
||||
@ -510,12 +510,12 @@ func syscall_Syscall12(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
||||
//go:cgo_unsafe_args
|
||||
func syscall_Syscall15(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) {
|
||||
lockOSThread()
|
||||
defer unlockOSThread()
|
||||
c := &getg().m.syscall
|
||||
c.fn = fn
|
||||
c.n = nargs
|
||||
c.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
cgocall(asmstdcallAddr, unsafe.Pointer(c))
|
||||
unlockOSThread()
|
||||
return c.r1, c.r2, c.err
|
||||
}
|
||||
|
||||
@ -524,11 +524,11 @@ func syscall_Syscall15(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
|
||||
//go:cgo_unsafe_args
|
||||
func syscall_Syscall18(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 uintptr) (r1, r2, err uintptr) {
|
||||
lockOSThread()
|
||||
defer unlockOSThread()
|
||||
c := &getg().m.syscall
|
||||
c.fn = fn
|
||||
c.n = nargs
|
||||
c.args = uintptr(noescape(unsafe.Pointer(&a1)))
|
||||
cgocall(asmstdcallAddr, unsafe.Pointer(c))
|
||||
unlockOSThread()
|
||||
return c.r1, c.r2, c.err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user