mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: when pruning methods also prune funcType
Remove method type information for pruned methods from any program that does not reflect on methods. This can be a significant saving: addr2line: -310KB (8.8%) A future update might want to consider a more aggressive variant of this: setting the Type and Func fields of reflect.Method to nil for unexported methods. That would shrink cmd/go by 2% and jujud by 2.6% but could be considered an API change. So this CL sticks to the uncontroversial change. For #6853. Change-Id: I5d186d9f822dc118ee89dc572c4912a3b3c72577 Reviewed-on: https://go-review.googlesource.com/20701 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
41f9f6f471
commit
d06b0db5bd
2 changed files with 57 additions and 33 deletions
|
|
@ -504,18 +504,10 @@ func dextratypeData(s *Sym, ot int, t *Type) int {
|
|||
ot = dgostringptr(s, ot, a.name)
|
||||
|
||||
ot = dgopkgpath(s, ot, a.pkg)
|
||||
ot = dsymptr(s, ot, dtypesym(a.mtype), 0)
|
||||
ot = dsymptr(s, ot, dtypesym(a.type_), 0)
|
||||
if a.isym != nil {
|
||||
ot = dmethodptr(s, ot, a.isym)
|
||||
} else {
|
||||
ot = duintptr(s, ot, 0)
|
||||
}
|
||||
if a.tsym != nil {
|
||||
ot = dmethodptr(s, ot, a.tsym)
|
||||
} else {
|
||||
ot = duintptr(s, ot, 0)
|
||||
}
|
||||
ot = dmethodptr(s, ot, dtypesym(a.mtype))
|
||||
ot = dmethodptr(s, ot, dtypesym(a.type_))
|
||||
ot = dmethodptr(s, ot, a.isym)
|
||||
ot = dmethodptr(s, ot, a.tsym)
|
||||
}
|
||||
return ot
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue