mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: remove ctxt.Syms.Allsym
Replace remaining uses with loader.Syms. Reduces some memory usage. Change-Id: I6f295b42b8cd734c6c18f08c61a5473506675075 Reviewed-on: https://go-review.googlesource.com/c/go/+/229992 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
2a874562bf
commit
a742d0ed5f
7 changed files with 36 additions and 12 deletions
|
|
@ -147,6 +147,16 @@ func (bm Bitmap) Has(i Sym) bool {
|
|||
func (bm Bitmap) Len() int {
|
||||
return len(bm) * 32
|
||||
}
|
||||
|
||||
// return the number of bits set.
|
||||
func (bm Bitmap) Count() int {
|
||||
s := 0
|
||||
for _, x := range bm {
|
||||
s += bits.OnesCount32(x)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func MakeBitmap(n int) Bitmap {
|
||||
return make(Bitmap, (n+31)/32)
|
||||
}
|
||||
|
|
@ -625,6 +635,11 @@ func (l *Loader) NDef() int {
|
|||
return int(l.extStart)
|
||||
}
|
||||
|
||||
// Number of reachable symbols.
|
||||
func (l *Loader) NReachableSym() int {
|
||||
return l.attrReachable.Count()
|
||||
}
|
||||
|
||||
// Returns the raw (unpatched) name of the i-th symbol.
|
||||
func (l *Loader) RawSymName(i Sym) string {
|
||||
if l.IsExternal(i) {
|
||||
|
|
@ -2195,7 +2210,6 @@ func (l *Loader) ExtractSymbols(syms *sym.Symbols) {
|
|||
if s == nil {
|
||||
continue
|
||||
}
|
||||
syms.Allsym = append(syms.Allsym, s) // XXX still add to Allsym for now, as there are code looping through Allsym
|
||||
if s.Version < 0 {
|
||||
s.Version = int16(anonVerReplacement)
|
||||
}
|
||||
|
|
@ -2209,7 +2223,6 @@ func (l *Loader) ExtractSymbols(syms *sym.Symbols) {
|
|||
}
|
||||
s := l.allocSym(name, ver)
|
||||
l.installSym(i, s)
|
||||
syms.Allsym = append(syms.Allsym, s) // XXX see above
|
||||
return s
|
||||
}
|
||||
syms.Lookup = l.SymLookup
|
||||
|
|
@ -2221,7 +2234,6 @@ func (l *Loader) ExtractSymbols(syms *sym.Symbols) {
|
|||
i := l.newExtSym(name, ver)
|
||||
s := l.allocSym(name, ver)
|
||||
l.installSym(i, s)
|
||||
syms.Allsym = append(syms.Allsym, s) // XXX see above
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue