Skip to content

Commit a03f1ae

Browse files
mdempskygopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Matthew Dempsky <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent d2e2da8 commit a03f1ae

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

src/cmd/compile/internal/ir/abi.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ func setupTextLSym(f *Func, flag int) {
5050
if f.Pragma&Nosplit != 0 {
5151
flag |= obj.NOSPLIT
5252
}
53-
if f.ReflectMethod() {
54-
flag |= obj.REFLECTMETHOD
55-
}
5653
if f.IsPackageInit() {
5754
flag |= obj.PKGINIT
5855
}

src/cmd/compile/internal/ir/func.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,10 @@ type Mark struct {
217217
type ScopeID int32
218218

219219
const (
220-
funcDupok = 1 << iota // duplicate definitions ok
221-
funcWrapper // hide frame from users (elide in tracebacks, don't count as a frame for recover())
222-
funcABIWrapper // is an ABI wrapper (also set flagWrapper)
223-
funcNeedctxt // function uses context register (has closure variables)
224-
funcReflectMethod // function calls reflect.Type.Method or MethodByName
220+
funcDupok = 1 << iota // duplicate definitions ok
221+
funcWrapper // hide frame from users (elide in tracebacks, don't count as a frame for recover())
222+
funcABIWrapper // is an ABI wrapper (also set flagWrapper)
223+
funcNeedctxt // function uses context register (has closure variables)
225224
// true if closure inside a function; false if a simple function or a
226225
// closure in a global variable initialization
227226
funcIsHiddenClosure
@@ -244,7 +243,6 @@ func (f *Func) Dupok() bool { return f.flags&funcDupok != 0 }
244243
func (f *Func) Wrapper() bool { return f.flags&funcWrapper != 0 }
245244
func (f *Func) ABIWrapper() bool { return f.flags&funcABIWrapper != 0 }
246245
func (f *Func) Needctxt() bool { return f.flags&funcNeedctxt != 0 }
247-
func (f *Func) ReflectMethod() bool { return f.flags&funcReflectMethod != 0 }
248246
func (f *Func) IsHiddenClosure() bool { return f.flags&funcIsHiddenClosure != 0 }
249247
func (f *Func) IsDeadcodeClosure() bool { return f.flags&funcIsDeadcodeClosure != 0 }
250248
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) }
259257
func (f *Func) SetWrapper(b bool) { f.flags.set(funcWrapper, b) }
260258
func (f *Func) SetABIWrapper(b bool) { f.flags.set(funcABIWrapper, b) }
261259
func (f *Func) SetNeedctxt(b bool) { f.flags.set(funcNeedctxt, b) }
262-
func (f *Func) SetReflectMethod(b bool) { f.flags.set(funcReflectMethod, b) }
263260
func (f *Func) SetIsHiddenClosure(b bool) { f.flags.set(funcIsHiddenClosure, b) }
264261
func (f *Func) SetIsDeadcodeClosure(b bool) { f.flags.set(funcIsDeadcodeClosure, b) }
265262
func (f *Func) SetHasDefer(b bool) { f.flags.set(funcHasDefer, b) }

src/cmd/compile/internal/walk/expr.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,6 @@ func usemethod(n *ir.CallExpr) {
10331033
r.Type = objabi.R_USENAMEDMETHOD
10341034
r.Sym = staticdata.StringSymNoCommon(name)
10351035
} else {
1036-
ir.CurFunc.SetReflectMethod(true)
1037-
// The LSym is initialized at this point. We need to set the attribute on the LSym.
10381036
ir.CurFunc.LSym.Set(obj.AttrReflectMethod, true)
10391037
}
10401038
}

0 commit comments

Comments
 (0)