mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: mark arguments to Syscall as noescape
Heap arguments to "async" syscalls will break when/if we have moving GC anyway. With this change is must not break until moving GC, because a user must reference the object in Go to preserve liveness. Otherwise the code is broken already. Reduces number of leaked params from 125 to 36 on linux. R=golang-codereviews, mikioh.mikioh, bradfitz CC=cshapiro, golang-codereviews, khr, rsc https://golang.org/cl/45930043
This commit is contained in:
parent
701982f173
commit
fc37eba149
5 changed files with 66 additions and 2 deletions
|
|
@ -169,7 +169,16 @@ const (
|
|||
_SENDMMSG = 20
|
||||
)
|
||||
|
||||
// Pointers passed to syscalls must not escape (be accessed by OS after the syscall returns).
|
||||
// For heap objects this will break when/if we have moving GC.
|
||||
// And for other objects (global, C allocated) go:noescape has no effect.
|
||||
|
||||
//go:noescape
|
||||
|
||||
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
|
||||
|
||||
//go:noescape
|
||||
|
||||
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
|
||||
|
||||
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue