Skip to content

Commit

Permalink
cmd/compile/internal/ir: remove Func.ReflectMethod
Browse files Browse the repository at this point in the history
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 <thanm@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
mdempsky authored and pull[bot] committed Mar 14, 2024
1 parent 6a79f30 commit 4207296
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/cmd/compile/internal/ir/abi.go
Expand Up @@ -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
}
Expand Down
11 changes: 4 additions & 7 deletions src/cmd/compile/internal/ir/func.go
Expand Up @@ -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
Expand All @@ -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 }
Expand All @@ -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) }
Expand Down
2 changes: 0 additions & 2 deletions src/cmd/compile/internal/walk/expr.go
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 4207296

Please sign in to comment.