This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Omit a couple of write barriers


This patch to the Go frontend omits a couple of write barriers.

We 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.

We 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.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]