From: Matthew Dempsky Date: Fri, 4 Mar 2016 15:55:39 +0000 (-0800) Subject: cmd/compile: small cleanup to syslook calls X-Git-Tag: go1.7beta1~1556 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7f13fbf76656790187c53c05d1b3d00c68d844a6;p=gostls13.git cmd/compile: small cleanup to syslook calls 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index af6061464f..94b20b15a5 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -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)