cmd/compile: mark type namedata symbols content-addressable

Type namedata symbols are for type/field/method names and package
paths. We can use content-addressable symbol mechanism for them.

Change-Id: I923fda17b7094c7a0e46aad7c450622eb3826294
Reviewed-on: https://go-review.googlesource.com/c/go/+/257960
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Cherry Zhang 2020-09-28 13:10:30 -04:00
parent 39dde09126
commit 66770f4b1d
4 changed files with 15 additions and 3 deletions

View file

@ -2153,11 +2153,11 @@ func (l *Loader) LoadNonpkgSyms(arch *sys.Arch) {
l.npkgsyms = l.NSym()
// Preallocate some space (a few hundreds KB) for some symbols.
// As of Go 1.15, linking cmd/compile has ~8000 hashed64 symbols and
// ~13000 hashed symbols.
// ~27000 hashed symbols.
st := loadState{
l: l,
hashed64Syms: make(map[uint64]symAndSize, 10000),
hashedSyms: make(map[goobj.HashType]symAndSize, 15000),
hashedSyms: make(map[goobj.HashType]symAndSize, 30000),
}
for _, o := range l.objs[goObjStart:] {
st.preloadSyms(o.r, hashed64Def)