cmd/internal/obj: move STEXT-only LSym fields into new FuncInfo struct

Shrinks LSym somewhat for non-STEXT LSyms, which are much more common.

While here, switch to tracking Automs in a slice instead of a linked
list. (Previously, this would have made LSyms larger.)

Passes toolstash-check.

Change-Id: I082e50e1d1f1b544c9e06b6e412a186be6a4a2b5
Reviewed-on: https://go-review.googlesource.com/37872
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Matthew Dempsky 2017-03-03 16:45:21 -08:00
parent 7a98bdf1c2
commit 9cb2ee0ff2
6 changed files with 44 additions and 36 deletions

View file

@ -436,6 +436,10 @@ func gendebug(fnsym *obj.LSym, decls []*Node) {
return
}
if fnsym.FuncInfo == nil {
fnsym.FuncInfo = new(obj.FuncInfo)
}
for _, n := range decls {
if n.Op != ONAME { // might be OTYPE or OLITERAL
continue
@ -461,8 +465,13 @@ func gendebug(fnsym *obj.LSym, decls []*Node) {
Gotype: Linksym(ngotype(n)),
}
a.Link = fnsym.Autom
fnsym.Autom = a
fnsym.Autom = append(fnsym.Autom, a)
}
// Reverse to make toolstash happy.
// TODO(mdempsky): Remove.
for i, j := 0, len(fnsym.Autom)-1; i < j; i, j = i+1, j-1 {
fnsym.Autom[i], fnsym.Autom[j] = fnsym.Autom[j], fnsym.Autom[i]
}
}