diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-13 08:00:09 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-13 15:18:54 +0000 |
| commit | 7b5f94e76c2d2adc0bc380aa50dfd7b5227cb958 (patch) | |
| tree | 430609e2cc27638ebbd4dfa41c64452870dfa159 /src/cmd/internal/obj | |
| parent | adc80c0665c0aa9a4a504e5c5dd2ddf981d3a8c3 (diff) | |
| download | go-7b5f94e76c2d2adc0bc380aa50dfd7b5227cb958.tar.xz | |
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>
Diffstat (limited to 'src/cmd/internal/obj')
| -rw-r--r-- | src/cmd/internal/obj/link.go | 11 | ||||
| -rw-r--r-- | src/cmd/internal/obj/objfile.go | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index fc0305344f..893ccf674a 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -324,11 +324,12 @@ type LSym struct { // A FuncInfo contains extra fields for STEXT symbols. type FuncInfo struct { - Args int32 - Locals int32 - Text *Prog - Autom []*Auto - Pcln Pcln + Args int32 + Locals int32 + Text *Prog + Autom []*Auto + Pcln Pcln + dwarfSym *LSym } // Attribute is a set of symbol attributes. diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index a4a9091bb9..518aab18da 100644 --- a/src/cmd/internal/obj/objfile.go +++ b/src/cmd/internal/obj/objfile.go @@ -560,7 +560,10 @@ func (ctxt *Link) dwarfSym(s *LSym) *LSym { if s.Type != STEXT { 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. |
