aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/cgi
diff options
context:
space:
mode:
authordoujiang24 <doujiang24@gmail.com>2023-08-25 17:06:31 +0000
committerGopher Robot <gobot@golang.org>2023-08-25 17:39:23 +0000
commit24b9ef1a7366fe751880ab2098cff630144b8ac8 (patch)
tree0f1de5cac722c84485bdfd9c1cc80f6422d7a037 /src/net/http/cgi
parent1a01cb22f9ab07d55ee61c95a34e1e18e49596c0 (diff)
downloadgo-24b9ef1a7366fe751880ab2098cff630144b8ac8.tar.xz
cmd/cgo: add #cgo noescape/nocallback annotations
When passing pointers of Go objects from Go to C, the cgo command generate _Cgo_use(pN) for the unsafe.Pointer type arguments, so that the Go compiler will escape these object to heap. Since the C function may callback to Go, then the Go stack might grow/shrink, that means the pointers that the C function have will be invalid. After adding the #cgo noescape annotation for a C function, the cgo command won't generate _Cgo_use(pN), and the Go compiler won't force the object escape to heap. After adding the #cgo nocallback annotation for a C function, which means the C function won't callback to Go, if it do callback to Go, the Go process will crash. Fixes #56378 Change-Id: Ifdca070584e0d349c7b12276270e50089e481f7a GitHub-Last-Rev: f1a17b08b0590eca2670e404bbfedad5461df72f GitHub-Pull-Request: golang/go#60399 Reviewed-on: https://go-review.googlesource.com/c/go/+/497837 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/net/http/cgi')
0 files changed, 0 insertions, 0 deletions