mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: record only the first occurance in Reachparent graph
In the deadcode pass, a type symbol may be marked twice, one without UsedInIface, one with. For the second time, don't update the Reachparent graph, so it only records the path of the first time the symbol is reached. This ensures the Reachparent graph is acyclic. TODO: add a test. (This only affects GOEXPERIMENT=fieldtrack) Change-Id: I68e8a1a69c3830bc8aee5df946151dc22dcb2b29 Reviewed-on: https://go-review.googlesource.com/c/go/+/254297 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
03a6860691
commit
b22af9b407
1 changed files with 1 additions and 1 deletions
|
|
@ -209,7 +209,7 @@ func (d *deadcodePass) mark(symIdx, parent loader.Sym) {
|
|||
if symIdx != 0 && !d.ldr.AttrReachable(symIdx) {
|
||||
d.wq.push(symIdx)
|
||||
d.ldr.SetAttrReachable(symIdx, true)
|
||||
if objabi.Fieldtrack_enabled != 0 {
|
||||
if objabi.Fieldtrack_enabled != 0 && d.ldr.Reachparent[symIdx] == 0 {
|
||||
d.ldr.Reachparent[symIdx] = parent
|
||||
}
|
||||
if *flagDumpDep {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue