Commit 266a3b66 authored by Marvin Stenger's avatar Marvin Stenger Committed by Josh Bleecher Snyder

cmd/compile/internal/gc: rename signatlist to signatset

Also change type from map[*types.Type]bool to map[*types.Type]struct{}.
This is basically a clean-up.

Change-Id: I167583eff0fa1070a7522647219476033b52b840
Reviewed-on: https://go-review.googlesource.com/41859Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 12137766
...@@ -34,8 +34,8 @@ type ptabEntry struct { ...@@ -34,8 +34,8 @@ type ptabEntry struct {
// runtime interface and reflection data structures // runtime interface and reflection data structures
var ( var (
signatlistmu sync.Mutex // protects signatlist signatsetmu sync.Mutex // protects signatset
signatlist = make(map[*types.Type]bool) signatset = make(map[*types.Type]struct{})
itabs []itabEntry itabs []itabEntry
ptabs []ptabEntry ptabs []ptabEntry
...@@ -944,9 +944,9 @@ func typenamesym(t *types.Type) *types.Sym { ...@@ -944,9 +944,9 @@ func typenamesym(t *types.Type) *types.Sym {
Fatalf("typenamesym %v", t) Fatalf("typenamesym %v", t)
} }
s := typesym(t) s := typesym(t)
signatlistmu.Lock() signatsetmu.Lock()
addsignat(t) addsignat(t)
signatlistmu.Unlock() signatsetmu.Unlock()
return s return s
} }
...@@ -1412,11 +1412,11 @@ func itabsym(it *obj.LSym, offset int64) *obj.LSym { ...@@ -1412,11 +1412,11 @@ func itabsym(it *obj.LSym, offset int64) *obj.LSym {
} }
func addsignat(t *types.Type) { func addsignat(t *types.Type) {
signatlist[t] = true signatset[t] = struct{}{}
} }
func addsignats(dcls []*Node) { func addsignats(dcls []*Node) {
// copy types from dcl list to signatlist // copy types from dcl list to signatset
for _, n := range dcls { for _, n := range dcls {
if n.Op == OTYPE { if n.Op == OTYPE {
addsignat(n.Type) addsignat(n.Type)
...@@ -1425,15 +1425,15 @@ func addsignats(dcls []*Node) { ...@@ -1425,15 +1425,15 @@ func addsignats(dcls []*Node) {
} }
func dumpsignats() { func dumpsignats() {
// Process signatlist. Use a loop, as dtypesym adds // Process signatset. Use a loop, as dtypesym adds
// entries to signatlist while it is being processed. // entries to signatset while it is being processed.
signats := make([]typeAndStr, len(signatlist)) signats := make([]typeAndStr, len(signatset))
for len(signatlist) > 0 { for len(signatset) > 0 {
signats = signats[:0] signats = signats[:0]
// Transfer entries to a slice and sort, for reproducible builds. // Transfer entries to a slice and sort, for reproducible builds.
for t := range signatlist { for t := range signatset {
signats = append(signats, typeAndStr{t: t, short: typesymname(t), regular: t.String()}) signats = append(signats, typeAndStr{t: t, short: typesymname(t), regular: t.String()})
delete(signatlist, t) delete(signatset, t)
} }
sort.Sort(typesByString(signats)) sort.Sort(typesByString(signats))
for _, ts := range signats { for _, ts := range signats {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment