mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[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:
parent
3067a8dc02
commit
6ac9914383
9 changed files with 221 additions and 79 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue