compiler: stack allocate storage for temp slices.
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 7 Oct 2016 04:14:35 +0000 (04:14 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 7 Oct 2016 04:14:35 +0000 (04:14 +0000)
commit729232db0b630ffb0a17dfcfa0850ff68ac35bbf
tree06aaffbdacfd5be9e586426511018c5a5da5e1a0
parentc9616e9af9b1b7e8d9fa2c3ce5688fa98fcb6504
compiler: stack allocate storage for temp slices.

    During the lowering phase, the variable arguments to a varargs call are
    packaged up into a temporary slice object; the storage for this slice
    was being unconditionally allocated on the heap.  Heap allocation is not
    necessary, however, if the varargs call correspond to an "append", since
    the append runtime routine only reads the slice storage (as opposed to
    stashing away the storage pointer). Enhance the lowering code to keep
    the slice storage on the stack for append() calls, to improve
    performance.

    Addresses issue golang/go#17304.

    Reviewed-on: https://go-review.googlesource.com/30136

From-SVN: r240853
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h