««« CL
15110044 /
95336afd420c
cmd/gc: shorten name used for map bucket type
Before:
type.struct { buckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; oldbuckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable } }
After:
type.map.bucket[string]*"".RangeTable
This makes debugging maps a little nicer, and it takes up less space in the binary.
R=golang-dev, r
CC=golang-dev, khr
https://golang.org/cl/
15110044
»»»
R=golang-dev
CC=golang-dev
https://golang.org/cl/
20050044
return 0;
case TSTRUCT:
+ // Format the bucket struct for map[x]y as map.bucket[x]y.
+ // This avoids a recursive print that generates very long names.
+ if(t->hmap != T) {
+ t = t->hmap;
+ return fmtprint(fp, "map.bucket[%T]%T", t->down, t->type);
+ }
+
if(t->funarg) {
fmtstrcpy(fp, "(");
if(fmtmode == FTypeId || fmtmode == FErr) { // no argument names on function signature, and no "noescape" tags
h->width = offset;
h->local = t->local;
t->hmap = h;
+ h->hmap = t;
return h;
}