]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: small cleanup to syslook calls
authorMatthew Dempsky <mdempsky@google.com>
Fri, 4 Mar 2016 15:55:39 +0000 (07:55 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 4 Mar 2016 17:44:02 +0000 (17:44 +0000)
Passing copy==1 to syslook is only necessary to support subsequent
calls to substArgTypes.  typ2Itab and concatstring* don't have "any"
parameters, so no point in deep copying their function signatures at
every call site.

For a couple other syslook calls (makemap and conv[IET]2[IET]), move
them closer to their corresponding substArgTypes calls so it's easier
to see that all syslook(fn, 1) calls are necessary.

Change-Id: I4a0588ab2b8b5b8ce7a0a44b24c8cf8fda489af6
Reviewed-on: https://go-review.googlesource.com/20215
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/walk.go

index af6061464fb657d6aa196215c54b8aed1468887d..94b20b15a5bf1d03fbc63ea78d4548e400ccd773 100644 (file)
@@ -957,11 +957,6 @@ opswitch:
                        break
                }
 
-               // Build name of function: convI2E etc.
-               // Not all names are possible
-               // (e.g., we'll never generate convE2E or convE2I).
-               buf := "conv" + type2IET(n.Left.Type) + "2" + type2IET(n.Type)
-               fn := syslook(buf, 1)
                var ll *NodeList
                if !Isinter(n.Left.Type) {
                        ll = list(ll, typename(n.Left.Type))
@@ -1002,7 +997,7 @@ opswitch:
                                typecheck(&n1, Etop)
                                appendNodeSeqNode(init, n1)
 
-                               fn := syslook("typ2Itab", 1)
+                               fn := syslook("typ2Itab", 0)
                                n1 = Nod(OCALL, fn, nil)
                                setNodeSeq(&n1.List, ll)
                                typecheck(&n1, Erv)
@@ -1051,6 +1046,11 @@ opswitch:
                        ll = list(ll, r)
                }
 
+               // Build name of function: convI2E etc.
+               // Not all names are possible
+               // (e.g., we'll never generate convE2E or convE2I).
+               buf := "conv" + type2IET(n.Left.Type) + "2" + type2IET(n.Type)
+               fn := syslook(buf, 1)
                if !Isinter(n.Left.Type) {
                        substArgTypes(fn, n.Left.Type, n.Left.Type, n.Type)
                } else {
@@ -1377,8 +1377,6 @@ opswitch:
        case OMAKEMAP:
                t := n.Type
 
-               fn := syslook("makemap", 1)
-
                a := nodnil() // hmap buffer
                r := nodnil() // bucket buffer
                if n.Esc == EscNone {
@@ -1401,6 +1399,7 @@ opswitch:
                        r = Nod(OADDR, var_, nil)
                }
 
+               fn := syslook("makemap", 1)
                substArgTypes(fn, hmap(t), mapbucket(t), t.Down, t.Type)
                n = mkcall1(fn, n.Type, init, typename(n.Type), conv(n.Left, Types[TINT64]), a, r)
 
@@ -2760,7 +2759,7 @@ func addstr(n *Node, init nodesOrNodeListPtr) *Node {
                slice.Esc = EscNone
        }
 
-       cat := syslook(fn, 1)
+       cat := syslook(fn, 0)
        r := Nod(OCALL, cat, nil)
        setNodeSeq(&r.List, args)
        typecheck(&r, Erv)