cmd/compile: simplify funcsyms

Sym.Fsym is used only to avoid adding duplicate
entries to funcsyms, but that is easily
accomplished by detecting the first lookup
vs subsequent lookups of the func sym name.

This avoids creating an unnecessary ONAME node
during funcsym, which eliminates a dependency
in the backend on Curfn and lineno.

It also makes the code a lot simpler and clearer.

Updates #15756

Passes toolstash-check -all.
No compiler performance changes.
funcsymname does generate garbage via string
concatenation, but it is not called very much,
and this CL also eliminates allocation of several
Nodes and Names.

Change-Id: I7116c78fa39d975b7bd2c65a1d228749cf0dd46b
Reviewed-on: https://go-review.googlesource.com/38605
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2017-03-24 11:33:29 -07:00
parent 3a89065c6c
commit 2c50bffee1
5 changed files with 44 additions and 28 deletions

View file

@ -26,7 +26,7 @@ func TestSizeof(t *testing.T) {
{Name{}, 36, 56},
{Param{}, 28, 56},
{Node{}, 84, 136},
{Sym{}, 64, 112},
{Sym{}, 60, 104},
{Type{}, 52, 88},
{MapType{}, 20, 40},
{ForwardType{}, 20, 32},