mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: cache dwarfSym
Follow-up to review feedback from mdempsky on CL 40507. Reduces mutex contention by about 1%. Change-Id: I540ea6772925f4a59e58f55a3458eff15880c328 Reviewed-on: https://go-review.googlesource.com/40575 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
adc80c0665
commit
7b5f94e76c
2 changed files with 10 additions and 6 deletions
|
|
@ -329,6 +329,7 @@ type FuncInfo struct {
|
||||||
Text *Prog
|
Text *Prog
|
||||||
Autom []*Auto
|
Autom []*Auto
|
||||||
Pcln Pcln
|
Pcln Pcln
|
||||||
|
dwarfSym *LSym
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attribute is a set of symbol attributes.
|
// Attribute is a set of symbol attributes.
|
||||||
|
|
|
||||||
|
|
@ -560,7 +560,10 @@ func (ctxt *Link) dwarfSym(s *LSym) *LSym {
|
||||||
if s.Type != STEXT {
|
if s.Type != STEXT {
|
||||||
ctxt.Diag("dwarfSym of non-TEXT %v", s)
|
ctxt.Diag("dwarfSym of non-TEXT %v", s)
|
||||||
}
|
}
|
||||||
return ctxt.Lookup(dwarf.InfoPrefix+s.Name, int(s.Version))
|
if s.FuncInfo.dwarfSym == nil {
|
||||||
|
s.FuncInfo.dwarfSym = ctxt.Lookup(dwarf.InfoPrefix+s.Name, int(s.Version))
|
||||||
|
}
|
||||||
|
return s.FuncInfo.dwarfSym
|
||||||
}
|
}
|
||||||
|
|
||||||
// populateDWARF fills in the DWARF Debugging Information Entry for TEXT symbol s.
|
// populateDWARF fills in the DWARF Debugging Information Entry for TEXT symbol s.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue