From: Matthew Dempsky Date: Thu, 14 Sep 2023 10:03:52 +0000 (-0700) Subject: cmd/compile/internal/ir: remove Func.ReflectMethod X-Git-Tag: go1.22rc1~837 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a03f1aeb557e0e4547c7dfdc1bd64d1f6f3a56ec;p=gostls13.git cmd/compile/internal/ir: remove Func.ReflectMethod This flag doesn't serve any purpose anymore. The only place that it's currently set happens after it's checked. Change-Id: Idb6455416f68e502e0b0b1d80e2d6bb5956ee45b Reviewed-on: https://go-review.googlesource.com/c/go/+/528435 Reviewed-by: Than McIntosh Auto-Submit: Matthew Dempsky LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/compile/internal/ir/abi.go b/src/cmd/compile/internal/ir/abi.go index 041448fb29..ebe0fbfb2a 100644 --- a/src/cmd/compile/internal/ir/abi.go +++ b/src/cmd/compile/internal/ir/abi.go @@ -50,9 +50,6 @@ func setupTextLSym(f *Func, flag int) { if f.Pragma&Nosplit != 0 { flag |= obj.NOSPLIT } - if f.ReflectMethod() { - flag |= obj.REFLECTMETHOD - } if f.IsPackageInit() { flag |= obj.PKGINIT } diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go index ea575a4206..5a71a73c15 100644 --- a/src/cmd/compile/internal/ir/func.go +++ b/src/cmd/compile/internal/ir/func.go @@ -217,11 +217,10 @@ type Mark struct { type ScopeID int32 const ( - funcDupok = 1 << iota // duplicate definitions ok - funcWrapper // hide frame from users (elide in tracebacks, don't count as a frame for recover()) - funcABIWrapper // is an ABI wrapper (also set flagWrapper) - funcNeedctxt // function uses context register (has closure variables) - funcReflectMethod // function calls reflect.Type.Method or MethodByName + funcDupok = 1 << iota // duplicate definitions ok + funcWrapper // hide frame from users (elide in tracebacks, don't count as a frame for recover()) + funcABIWrapper // is an ABI wrapper (also set flagWrapper) + funcNeedctxt // function uses context register (has closure variables) // true if closure inside a function; false if a simple function or a // closure in a global variable initialization funcIsHiddenClosure @@ -244,7 +243,6 @@ func (f *Func) Dupok() bool { return f.flags&funcDupok != 0 } func (f *Func) Wrapper() bool { return f.flags&funcWrapper != 0 } func (f *Func) ABIWrapper() bool { return f.flags&funcABIWrapper != 0 } func (f *Func) Needctxt() bool { return f.flags&funcNeedctxt != 0 } -func (f *Func) ReflectMethod() bool { return f.flags&funcReflectMethod != 0 } func (f *Func) IsHiddenClosure() bool { return f.flags&funcIsHiddenClosure != 0 } func (f *Func) IsDeadcodeClosure() bool { return f.flags&funcIsDeadcodeClosure != 0 } func (f *Func) HasDefer() bool { return f.flags&funcHasDefer != 0 } @@ -259,7 +257,6 @@ func (f *Func) SetDupok(b bool) { f.flags.set(funcDupok, b) } func (f *Func) SetWrapper(b bool) { f.flags.set(funcWrapper, b) } func (f *Func) SetABIWrapper(b bool) { f.flags.set(funcABIWrapper, b) } func (f *Func) SetNeedctxt(b bool) { f.flags.set(funcNeedctxt, b) } -func (f *Func) SetReflectMethod(b bool) { f.flags.set(funcReflectMethod, b) } func (f *Func) SetIsHiddenClosure(b bool) { f.flags.set(funcIsHiddenClosure, b) } func (f *Func) SetIsDeadcodeClosure(b bool) { f.flags.set(funcIsDeadcodeClosure, b) } func (f *Func) SetHasDefer(b bool) { f.flags.set(funcHasDefer, b) } diff --git a/src/cmd/compile/internal/walk/expr.go b/src/cmd/compile/internal/walk/expr.go index b4e42470b9..9047211879 100644 --- a/src/cmd/compile/internal/walk/expr.go +++ b/src/cmd/compile/internal/walk/expr.go @@ -1033,8 +1033,6 @@ func usemethod(n *ir.CallExpr) { r.Type = objabi.R_USENAMEDMETHOD r.Sym = staticdata.StringSymNoCommon(name) } else { - ir.CurFunc.SetReflectMethod(true) - // The LSym is initialized at this point. We need to set the attribute on the LSym. ir.CurFunc.LSym.Set(obj.AttrReflectMethod, true) } }