Skip to content

Commit ca56270

Browse files
committed
add nosplit
1 parent 43c8603 commit ca56270

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cmd/mkcgo/generate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ func generateGo(src *mkcgo.Source, w io.Writer) {
6969
fmt.Fprintf(w, "}\n\n")
7070
}
7171

72-
// Generate error wrapper noescape function.
72+
// Generate error wrapper noescape function, which hides the
73+
// error state pointer from the Go garbage collector.
74+
fmt.Fprintf(w, "//go:nosplit\n")
7375
fmt.Fprintf(w, "func %s(p **C.%s) **C.%s {\n", errStateNoEscapeName, errStateStructName, errStateStructName)
7476
fmt.Fprintf(w, "\tx := uintptr(unsafe.Pointer(p))\n")
7577
fmt.Fprintf(w, "\treturn (**C.%s)(unsafe.Pointer(x ^ 0))\n", errStateStructName)

zossl.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)