mirror of
https://github.com/golang/go
synced 2024-11-18 20:34:39 -07:00
[dev.link] cmd/link: delete ctxt.Reachparent
It is no longer needed as we have converted the fieldtrack pass to using the loader. Also free loader.Reachparent after we are done with it. Change-Id: Ibc4b29f282e1e4aea363a1b549755e31f84b0295 Reviewed-on: https://go-review.googlesource.com/c/go/+/229322 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
9570fc8f71
commit
245a2f5780
@ -45,7 +45,7 @@ type deadcodePass struct {
|
||||
func (d *deadcodePass) init() {
|
||||
d.ldr.InitReachable()
|
||||
d.ifaceMethod = make(map[methodsig]bool)
|
||||
if d.ctxt.Reachparent != nil {
|
||||
if objabi.Fieldtrack_enabled != 0 {
|
||||
d.ldr.Reachparent = make([]loader.Sym, d.ldr.NSym())
|
||||
}
|
||||
heap.Init(&d.wq)
|
||||
@ -190,7 +190,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 d.ctxt.Reachparent != nil {
|
||||
if objabi.Fieldtrack_enabled != 0 {
|
||||
d.ldr.Reachparent[symIdx] = parent
|
||||
}
|
||||
if *flagDumpDep {
|
||||
|
@ -383,6 +383,7 @@ func fieldtrack(arch *sys.Arch, l *loader.Loader) {
|
||||
}
|
||||
}
|
||||
}
|
||||
l.Reachparent = nil // we are done with it
|
||||
if *flagFieldTrack == "" {
|
||||
return
|
||||
}
|
||||
|
@ -2812,7 +2812,7 @@ func (ctxt *Link) loadlibfull() {
|
||||
}
|
||||
|
||||
// Pull the symbols out.
|
||||
ctxt.loader.ExtractSymbols(ctxt.Syms, ctxt.Reachparent)
|
||||
ctxt.loader.ExtractSymbols(ctxt.Syms)
|
||||
ctxt.lookup = ctxt.Syms.ROLookup
|
||||
|
||||
// Recreate dynexp using *sym.Symbol instead of loader.Sym
|
||||
|
@ -82,9 +82,6 @@ type Link struct {
|
||||
|
||||
tramps []loader.Sym // trampolines
|
||||
|
||||
// Used to implement field tracking.
|
||||
Reachparent map[*sym.Symbol]*sym.Symbol
|
||||
|
||||
compUnits []*sym.CompilationUnit // DWARF compilation units
|
||||
runtimeCU *sym.CompilationUnit // One of the runtime CUs, the last one seen.
|
||||
|
||||
|
@ -35,7 +35,6 @@ import (
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/sys"
|
||||
"cmd/link/internal/benchmark"
|
||||
"cmd/link/internal/sym"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
@ -156,9 +155,6 @@ func Main(arch *sys.Arch, theArch Arch) {
|
||||
}
|
||||
}
|
||||
|
||||
if objabi.Fieldtrack_enabled != 0 {
|
||||
ctxt.Reachparent = make(map[*sym.Symbol]*sym.Symbol)
|
||||
}
|
||||
checkStrictDups = *FlagStrictDups
|
||||
|
||||
startProfile()
|
||||
|
@ -2128,7 +2128,7 @@ func (l *Loader) PropagateLoaderChangesToSymbols(toconvert []Sym, anonVerReplace
|
||||
|
||||
// ExtractSymbols grabs the symbols out of the loader for work that hasn't been
|
||||
// ported to the new symbol type.
|
||||
func (l *Loader) ExtractSymbols(syms *sym.Symbols, rp map[*sym.Symbol]*sym.Symbol) {
|
||||
func (l *Loader) ExtractSymbols(syms *sym.Symbols) {
|
||||
// Add symbols to the ctxt.Syms lookup table. This explicitly skips things
|
||||
// created via loader.Create (marked with versions less than zero), since
|
||||
// if we tried to add these we'd wind up with collisions. We do, however,
|
||||
@ -2148,13 +2148,6 @@ func (l *Loader) ExtractSymbols(syms *sym.Symbols, rp map[*sym.Symbol]*sym.Symbo
|
||||
}
|
||||
}
|
||||
|
||||
for i, s := range l.Reachparent {
|
||||
if i == 0 {
|
||||
continue
|
||||
}
|
||||
rp[l.Syms[i]] = l.Syms[s]
|
||||
}
|
||||
|
||||
// Provide lookup functions for sym.Symbols.
|
||||
l.SymLookup = func(name string, ver int) *sym.Symbol {
|
||||
i := l.LookupOrCreateSym(name, ver)
|
||||
|
Loading…
Reference in New Issue
Block a user