cmd/compile: remove MarkUsedIfaceMethodIndex mechanism
We don't need it any more, after CL 357835.
Change-Id: I1ff5f24b5540c3e80c4b35be8215a1c378952274
Reviewed-on: https://go-review.googlesource.com/c/go/+/357894
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 474a059..fc5b0ee 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -1523,18 +1523,12 @@
// needed methods.
func markTypeUsed(t *types.Type, lsym *obj.LSym) {
if t.IsInterface() {
- // Mark all the methods of the interface as used.
- // TODO: we should really only mark the interface methods
- // that are actually called in the application.
- for i, _ := range t.AllMethods().Slice() {
- reflectdata.MarkUsedIfaceMethodIndex(lsym, t, i)
- }
- } else {
- // TODO: This is somewhat overkill, we really only need it
- // for types that are put into interfaces.
- // Note: this relocation is also used in cmd/link/internal/ld/dwarf.go
- reflectdata.MarkTypeUsedInInterface(t, lsym)
+ return
}
+ // TODO: This is somewhat overkill, we really only need it
+ // for types that are put into interfaces.
+ // Note: this relocation is also used in cmd/link/internal/ld/dwarf.go
+ reflectdata.MarkTypeUsedInInterface(t, lsym)
}
// getDictionarySym returns the dictionary for the named generic function gf, which
@@ -1735,18 +1729,6 @@
se := n.(*ir.SelectorExpr)
srctype = subst.Typ(se.X.Type())
dsttype = subst.Typ(info.shapeToBound[se.X.Type()])
- found := false
- for i, m := range dsttype.AllMethods().Slice() {
- if se.Sel == m.Sym {
- // Mark that this method se.Sel is
- // used for the dsttype interface, so
- // it won't get deadcoded.
- reflectdata.MarkUsedIfaceMethodIndex(lsym, dsttype, i)
- found = true
- break
- }
- }
- assert(found)
case ir.ODOTTYPE, ir.ODOTTYPE2:
srctype = subst.Typ(n.(*ir.TypeAssertExpr).Type())
dsttype = subst.Typ(n.(*ir.TypeAssertExpr).X.Type())
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 369ee75..b4ed96c 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -2033,16 +2033,6 @@
r.Type = objabi.R_USEIFACEMETHOD
}
-// MarkUsedIfaceMethodIndex marks that that method number ix (in the AllMethods list)
-// of interface type ityp is used, and should be attached to lsym.
-func MarkUsedIfaceMethodIndex(lsym *obj.LSym, ityp *types.Type, ix int) {
- tsym := TypeLinksym(ityp)
- r := obj.Addrel(lsym)
- r.Sym = tsym
- r.Add = InterfaceMethodOffset(ityp, int64(ix))
- r.Type = objabi.R_USEIFACEMETHOD
-}
-
// getDictionary returns the dictionary for the given named generic function
// or method, with the given type arguments.
func getDictionary(gf *types.Sym, targs []*types.Type) ir.Node {