aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/textflag.h
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-03-10 16:15:26 -0500
committerDavid Crawshaw <crawshaw@golang.org>2016-03-11 21:19:20 +0000
commitcc158403d618eafc476b0727f44e4468c61060f6 (patch)
treeddcb20a36cb4ba84363302c59cc90ba71bfec8df /src/runtime/textflag.h
parent4112f0f7e68f1fa75965aa010f52aa64739912a8 (diff)
downloadgo-cc158403d618eafc476b0727f44e4468c61060f6.tar.gz
go-cc158403d618eafc476b0727f44e4468c61060f6.zip
cmd/compile: track reflect.Type.Method in deadcode
In addition to reflect.Value.Call, exported methods can be invoked by the Func value in the reflect.Method struct. This CL has the compiler track what functions get access to a legitimate reflect.Method struct by looking for interface calls to either of: Method(int) reflect.Method MethodByName(string) (reflect.Method, bool) This is a little overly conservative. If a user implements a type with one of these methods without using the underlying calls on reflect.Type, the linker will assume the worst and include all exported methods. But it's cheap. No change to any of the binary sizes reported in cl/20483. For #14740 Change-Id: Ie17786395d0453ce0384d8b240ecb043b7726137 Reviewed-on: https://go-review.googlesource.com/20489 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/runtime/textflag.h')
-rw-r--r--src/runtime/textflag.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/textflag.h b/src/runtime/textflag.h
index e11c5dc3a2..929e9b36a9 100644
--- a/src/runtime/textflag.h
+++ b/src/runtime/textflag.h
@@ -5,6 +5,8 @@
// This file defines flags attached to various functions
// and data objects. The compilers, assemblers, and linker must
// all agree on these values.
+//
+// Keep in sync with src/cmd/internal/obj/textflag.go.
// Don't profile the marked routine. This flag is deprecated.
#define NOPROF 1
@@ -28,3 +30,5 @@
// Only valid on functions that declare a frame size of 0.
// TODO(mwhudson): only implemented for ppc64x at present.
#define NOFRAME 512
+// Function can call reflect.Type.Method or reflect.Type.MethodByName.
+#define REFLECTMETHOD = 1024