]> git.ipfire.org Git - thirdparty/gcc.git/commit
compiler: optimize string concatenations
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Jun 2019 15:13:53 +0000 (15:13 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Jun 2019 15:13:53 +0000 (15:13 +0000)
commit4349775a30600906f5811ba7c743a5c22bdb3d7d
treea603f337ecccb290e61a1766664dd5ec30b5bb58
parent7a907deeeb0b17ed332eb6e3a181a35b1873daf5
compiler: optimize string concatenations

    runtime.concatstring{2,3,4,5} are just wrappers of concatstrings.
    These wrappers don't provide any benefit, at least in the C
    calling convention we use, where passing arrays by value isn't an
    efficient thing. Change it to always use concatstrings.

    Also, the cap field of the slice passed to concatstrings is not
    necessary. So change it to pass a pointer and a length directly,
    which is more efficient than passing a slice header by value.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182539

From-SVN: r272476
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/runtime.def
libgo/go/runtime/string.go