Skip to content

Commit 2fc8f95

Browse files
committed
cmd/compile: don't generate algs for map buckets
Note that this is only safe because the compiler generates multiple distinct gc.Types. If we switch to having canonical gc.Types, then this will need to be updated to handle the case in which the user uses both map[T]S and also map[[8]T]S. In that case, the runtime needs algs for [8]T, but this could mark the sole [8]T type as Noalg. This is a general problem with having a single bool to represent whether alg generation is needed for a type. Cuts 5k off cmd/go and 22k off golang.org/x/tools/cmd/godoc, approx 0.04% and 0.12% respectively. For golang#6853 and golang#9930 Change-Id: I30a15ec72ecb62e2aa053260a7f0f75015fc0ade
1 parent a81283d commit 2fc8f95

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/cmd/compile/internal/gc/reflect.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func mapbucket(t *Type) *Type {
8787
arr.Type = keytype
8888
arr.Bound = BUCKETSIZE
8989
field = append(field, makefield("keys", arr))
90+
arr.Noalg = true
9091
arr = typ(TARRAY)
9192
arr.Type = valtype
9293
arr.Bound = BUCKETSIZE

0 commit comments

Comments
 (0)