I am working on a project where we make certain syscalls where we pass Go 
pointers to the syscalls. The syscall we ended up calling is 
https://cs.opensource.google/go/go/+/refs/tags/go1.21.4:src/syscall/syscall_linux.go;l=65.
 
I think Go 1.21 introduced `runtime.Pinner.pin()` .but we realised it 
wasn't necessarily made for the problem we were wanted to solve, or 
investigate. Essentially, I am interested in knowing whether the Go GC will 
move pointer values casted to `uintptr` after they're passed as arguments 
to a syscall. Reading the source of the syscall implementation, I see a 
 `//go:uintptrkeepalive`. The documentation on the directive is not really 
clear to me because it compares `//go:uintptrkeepalive`  to 
`//go:uintptrescapes`, but never clarifies vividly if the pointers passed 
into the syscall will 100% be kept in the goroutine stack or could be moved 
to the heap in the case of `/go:uintptrkeepalive`. I'd appreciate some 
clarification. Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/fec29cf0-57e7-4593-82f6-2ddcdd0cc563n%40googlegroups.com.

Reply via email to