]> Cypherpunks.ru repositories - gostls13.git/commit
reflect: do not escape Value.Type
authorCherry Mui <cherryyz@google.com>
Fri, 17 Jun 2022 17:06:16 +0000 (13:06 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 12 May 2023 21:11:51 +0000 (21:11 +0000)
commitbe4fe08b57b3365f3f5db2e2def296904557442d
treeeaedb1439aa3dffee0649bb1e0190f5c0d5da9b5
parent0ac72f8b96166c8aa3953d27f4fd3d33fb9e51cf
reflect: do not escape Value.Type

Types are either static (for compiler-created types) or heap
allocated and always reachable (for reflection-created types, held
in the central map). So there is no need to escape types.

With CL 408826 reflect.Value does not always escape. Some functions
that escapes Value.typ would make the Value escape without this CL.

Had to add a special case for the inliner to keep (*Value).Type
still inlineable.

Change-Id: I7c14d35fd26328347b509a06eb5bd1534d40775f
Reviewed-on: https://go-review.googlesource.com/c/go/+/413474
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/inline/inl.go
src/reflect/deepequal.go
src/reflect/makefunc.go
src/reflect/type.go
src/reflect/value.go
src/runtime/export_test.go
test/inline_sync.go