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)
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 {
}
}
}
+ l.Reachparent = nil // we are done with it
if *flagFieldTrack == "" {
return
}
}
// 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
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.
"cmd/internal/objabi"
"cmd/internal/sys"
"cmd/link/internal/benchmark"
- "cmd/link/internal/sym"
"flag"
"log"
"os"
}
}
- if objabi.Fieldtrack_enabled != 0 {
- ctxt.Reachparent = make(map[*sym.Symbol]*sym.Symbol)
- }
checkStrictDups = *FlagStrictDups
startProfile()
// 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,
}
}
- 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)