]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't generate algs for ... args
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 4 May 2015 22:01:29 +0000 (15:01 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sun, 24 Apr 2016 20:51:04 +0000 (20:51 +0000)
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[[n]T]S and also calls a function f(...T) with n arguments.
In that case, the runtime needs algs for [n]T, but this could
mark the sole [n]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 17k off cmd/go and 13k off golang.org/x/tools/cmd/godoc,
approx 0.14% and 0.07% respectively.

For #6853 and #9930

Change-Id: Iccb6b9fd88ade5497d7090528a903816d340bf0a
Reviewed-on: https://go-review.googlesource.com/19770
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

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

index 7c4d74c8c3e42a3590747ecce83c4d6f4890dcb9..7e160bdd94111ad61d752e0fdef3fc3c902b6804 100644 (file)
@@ -1739,6 +1739,7 @@ func mkdotargslice(lr0, nn []*Node, l *Field, fp int, init *Nodes, ddd *Node) []
        }
 
        tslice := typSlice(l.Type.Elem())
+       tslice.Noalg = true
 
        var n *Node
        if len(lr0) == 0 {