cmd/link: use side table instead of sym.Symbol 'Reachparent' field

The sym.Symbol 'Reachparent' field is used only when field tracking
is enabled. So as to use less memory for the common case where
field tracking is not enabled, remove this field and use a side
table stored in the context to achieve the same functionality.

Updates #26186

Change-Id: Idc5f8b0aa323689d4d51dddb5d1b0341a37bb7d2
Reviewed-on: https://go-review.googlesource.com/121915
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Than McIntosh 2018-06-28 15:42:20 -04:00 committed by Brad Fitzpatrick
parent 0e0cd70ecf
commit 32bc0976f9
5 changed files with 22 additions and 13 deletions

View file

@ -190,7 +190,9 @@ func (d *deadcodepass) mark(s, parent *sym.Symbol) {
fmt.Printf("%s -> %s\n", p, s.Name)
}
s.Attr |= sym.AttrReachable
s.Reachparent = parent
if d.ctxt.Reachparent != nil {
d.ctxt.Reachparent[s] = parent
}
d.markQueue = append(d.markQueue, s)
}