[dev.link] create runtime.funcnametab

Move the function names out of runtime.pclntab_old, creating
runtime.funcnametab.  There is an unfortunate artifact in this change in
that calculating the funcID still requires loading the name. Future work
will likely pull this out and put it into the object file Funcs.

ls -l cmd/compile (darwin):
  before: 18524016
  after:  18519952

The difference in size can be attributed to alignment in pclntab_old.

Change-Id: Ibcbb230d4632178f8fcd0667165f5335786381f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/243223
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Jeremy Faller 2020-07-16 16:18:49 -04:00
parent 3067a8dc02
commit 6ac9914383
9 changed files with 221 additions and 79 deletions

View file

@ -709,6 +709,22 @@ func (l *Loader) NReachableSym() int {
return l.attrReachable.Count()
}
// SymNameLen returns the length of the symbol name, trying hard not to load
// the name.
func (l *Loader) SymNameLen(i Sym) int {
// Not much we can do about external symbols.
if l.IsExternal(i) {
return len(l.SymName(i))
}
r, li := l.toLocal(i)
le := r.Sym(li).NameLen(r.Reader)
if !r.NeedNameExpansion() {
return le
}
// Just load the symbol name. We don't know how expanded it'll be.
return len(l.SymName(i))
}
// Returns the raw (unpatched) name of the i-th symbol.
func (l *Loader) RawSymName(i Sym) string {
if l.IsExternal(i) {