compiler: make heap expression's write barrier conditional
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 10 Jun 2019 21:08:42 +0000 (21:08 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 10 Jun 2019 21:08:42 +0000 (21:08 +0000)
commit35c19de69645b18eeef7dbecfcd98b19f9948c84
tree344882ca7aca8afcf2c908ba8ab684d36c5f7413
parentfc917b42658000f0c4dc87f6602336eef899fadf
compiler: make heap expression's write barrier conditional

    Heap_expression::do_get_backend emits an unconditional write
    barrier if the type has pointers and it is not a stack allocation.
    This CL changes it to use a write barrier for the assignment only
    when write barriers are enabled. While here, also change it to
    call gcWriteBarrier instead of typedmemmove for pointer-shaped
    types.

    For this to work, Function::build needs to be adjusted so that
    Heap_expression::do_get_backend is called when there is a parent
    block.

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

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