aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-08-23 22:38:58 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-08-23 22:38:58 +0000
commit6ae361ae458d4056d6c36fa42f1775c417457b10 (patch)
tree2abbeb7a9dc1276b8a53259a89738319fdee0f45 /libgo
parent457dac402027dd7e14543fbd59a75858422cf6c6 (diff)
downloadgcc-6ae361ae458d4056d6c36fa42f1775c417457b10.zip
gcc-6ae361ae458d4056d6c36fa42f1775c417457b10.tar.gz
gcc-6ae361ae458d4056d6c36fa42f1775c417457b10.tar.bz2
compiler: record pointer var values to remove write barriers
Record when a local pointer variable is set to a value such that indirecting through the pointer does not require a write barrier. Use that to eliminate write barriers when indirecting through that local pointer variable. Only keep this information per-block, so it's not all that applicable. This reduces the number of write barriers generated when compiling the runtime package from 553 to 524. The point of this is to eliminate a bad write barrier in the bytes function in runtime/print.go. Mark that function nowritebarrier so that the problem does not recur. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191581 From-SVN: r274890
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/print.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/libgo/go/runtime/print.go b/libgo/go/runtime/print.go
index 8c39644..14d546d 100644
--- a/libgo/go/runtime/print.go
+++ b/libgo/go/runtime/print.go
@@ -35,6 +35,7 @@ import (
// should use printhex instead of printuint (decimal).
type hex uint64
+//go:nowritebarrier
func bytes(s string) (ret []byte) {
rp := (*slice)(unsafe.Pointer(&ret))
sp := stringStructOf(&s)