summaryrefslogtreecommitdiff
path: root/test/inline_sync.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-06-17 13:06:16 -0400
committerCherry Mui <cherryyz@google.com>2023-05-12 21:11:51 +0000
commitbe4fe08b57b3365f3f5db2e2def296904557442d (patch)
treeeaedb1439aa3dffee0649bb1e0190f5c0d5da9b5 /test/inline_sync.go
parent0ac72f8b96166c8aa3953d27f4fd3d33fb9e51cf (diff)
downloadgo-git-be4fe08b57b3365f3f5db2e2def296904557442d.tar.gz
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>
Diffstat (limited to 'test/inline_sync.go')
-rw-r--r--test/inline_sync.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/inline_sync.go b/test/inline_sync.go
index 5533c7b3fc..69e2a0ead6 100644
--- a/test/inline_sync.go
+++ b/test/inline_sync.go
@@ -42,12 +42,12 @@ func small7() { // ERROR "can inline small7"
var rwmutex *sync.RWMutex
-func small8() {
+func small8() { // ERROR "can inline small8"
// the RUnlock fast path should be inlined
rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" "inlining call to atomic\.\(\*Int32\)\.Add"
}
-func small9() {
+func small9() { // ERROR "can inline small9"
// the RLock fast path should be inlined
rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" "inlining call to atomic\.\(\*Int32\)\.Add"
}