mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: add support to new deadcode for field tracking
Fix up the new dead code pass to include support for populating the ctxt "Reachparent" map, which is needed to support field tracking. Since we don't have sym.Symbols created at the point where new dead code runs, keep track of reachability using global symbol indices, and then once loader.LoadFull is complete we can translate the index mappings into symbol mappings. The fieldtracking output is unfortunately different relative to master, due to differences in the order in which symbols are encountered in deadcode, but I have eyeballed the results to make sure they look reasonable. Change-Id: I48c7a4597f05c00f15af3bfd37fc15ab4d0017c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/204342 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
63815923fc
commit
219922e95b
3 changed files with 39 additions and 15 deletions
|
|
@ -112,6 +112,11 @@ type Loader struct {
|
|||
Syms []*sym.Symbol // indexed symbols. XXX we still make sym.Symbol for now.
|
||||
|
||||
Reachable bitmap // bitmap of reachable symbols, indexed by global index
|
||||
|
||||
// Used to implement field tracking; created during deadcode if
|
||||
// field tracking is enabled. Reachparent[K] contains the index of
|
||||
// the symbol that triggered the marking of symbol K as live.
|
||||
Reachparent []Sym
|
||||
}
|
||||
|
||||
func NewLoader() *Loader {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue