From d40bb738ff59bada723fe5f834d41531391b532a Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sat, 22 Apr 2017 17:35:28 -0700 Subject: [PATCH] cmd/compile: remove types.Sym.lsym It was just a cache, and the CL series yesterday removed 40% of the calls to types.Linksym in make.bash. Testing atop CL 40693 (backend concurrency) indicates that removing it is actually a very minor performance improvement. Passes toolstash-check. Change-Id: I97c2973036964acdd11b3cb842bc31f33ae60389 Reviewed-on: https://go-review.googlesource.com/41492 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/cmd/compile/internal/types/sizeof_test.go | 2 +- src/cmd/compile/internal/types/sym.go | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cmd/compile/internal/types/sizeof_test.go b/src/cmd/compile/internal/types/sizeof_test.go index d31e169b00..04e2f01e92 100644 --- a/src/cmd/compile/internal/types/sizeof_test.go +++ b/src/cmd/compile/internal/types/sizeof_test.go @@ -22,7 +22,7 @@ func TestSizeof(t *testing.T) { _32bit uintptr // size on 32bit platforms _64bit uintptr // size on 64bit platforms }{ - {Sym{}, 56, 96}, + {Sym{}, 52, 88}, {Type{}, 52, 88}, {Map{}, 20, 40}, {Forward{}, 20, 32}, diff --git a/src/cmd/compile/internal/types/sym.go b/src/cmd/compile/internal/types/sym.go index e316e99ce7..d9b6d92abe 100644 --- a/src/cmd/compile/internal/types/sym.go +++ b/src/cmd/compile/internal/types/sym.go @@ -31,7 +31,6 @@ type Sym struct { flags bitset8 Label *Node // corresponding label (ephemeral) Origpkg *Pkg // original package for . import - lsym *obj.LSym } const ( @@ -78,8 +77,5 @@ func (sym *Sym) Linksym() *obj.LSym { if sym == nil { return nil } - if sym.lsym == nil { - sym.lsym = Ctxt.Lookup(sym.LinksymName()) - } - return sym.lsym + return Ctxt.Lookup(sym.LinksymName()) }