]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: cache dwarfSym
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 13 Apr 2017 15:00:09 +0000 (08:00 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 13 Apr 2017 15:18:54 +0000 (15:18 +0000)
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>
src/cmd/internal/obj/link.go
src/cmd/internal/obj/objfile.go

index fc0305344f0d0a5ab36a0cface063a1bfc599900..893ccf674a7a257598c94d8460233b96e5b0e86a 100644 (file)
@@ -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.
index a4a9091bb91e063b965287596c30426d376096b2..518aab18dae60fbf6bfd3fbbff256e6e4ec8d249 100644 (file)
@@ -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.