aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/internal/testplugin/plugin_test.go
diff options
context:
space:
mode:
authorthepudds <thepudds1460@gmail.com>2023-06-21 14:18:56 -0400
committerGopher Robot <gobot@golang.org>2023-09-07 01:47:02 +0000
commita2f28a48415adb8b8736aa1d5c335f99375b2f3a (patch)
treeabf70700fba05ba6318a278395a0480d8d8b21c1 /src/cmd/cgo/internal/testplugin/plugin_test.go
parent0eed32bd0d3fa713a4f5077462e402119dc761cb (diff)
downloadgo-a2f28a48415adb8b8736aa1d5c335f99375b2f3a.tar.xz
fmt: avoid reflect.Value.Pointer to help escape analysis
This is part of a series of CLs that aim to reduce how often interface arguments escape for the print functions in fmt. Prior to this change, one reason arguments escape is because fmtPointer calls reflect.Value.Pointer: ./print.go:551:39: parameter value leaks to <heap> for (*pp).fmtPointer with derefs=0: ./print.go:551:39: flow: <heap> ← value: ./print.go:551:39: from reflect.Value.Pointer(value) (call parameter) at ./print.go:555:20 printValue also has its value argument escape for this reason, among others. This CL changes those uses to reflect.Value.UnsafePointer instead, which does not cause an escape. Arguments still escape for other reasons. Change-Id: I81c4f737f11fe835c5ccb122caee40a39b553451 Reviewed-on: https://go-review.googlesource.com/c/go/+/524939 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: t hepudds <thepudds1460@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/cgo/internal/testplugin/plugin_test.go')
0 files changed, 0 insertions, 0 deletions