compiler: omit a couple of write barriers
commitd3c55148e764347be12d921fe393e1fd91b30c1c
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Sep 2018 00:45:55 +0000 (13 00:45 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Sep 2018 00:45:55 +0000 (13 00:45 +0000)
treef2ea2103f31f5a039dac854bf39c87a5c9daa85d
parent0107f53c7f0f9d6c4b38fd68392d9785970043ce
compiler: omit a couple of write barriers

    Omit a write barrier for
        s = s[0:]
    for a slice s.  In this case the pointer is not changing and no write
    barrier is required.

    Omit a write barrier for
        s = append(s, v)
    in the case where len(s) < cap(s) (and similarly when appending more
    values).  When the slice has enough capacity the pointer is not
    changing and no write barrier is required.

    These changes are required to avoid write barriers in the method
    randomOrder.reset in the runtime package.  That method is called from
    procresize, at a point where we do not want to allocate memory.
    Otherwise that method can use a write barrier, allocate memory, and
    break TestReadMemStats.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264259 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/statements.cc
gcc/go/gofrontend/statements.h
gcc/go/gofrontend/wb.cc