diff options
author | zikaeroh <zikaeroh@gmail.com> | 2021-07-29 21:15:52 -0700 |
---|---|---|
committer | Martin Möhrmann <martin@golang.org> | 2021-08-23 19:46:36 +0000 |
commit | 6b9e3f883e6820a1e94448ca81eba62341cd4836 (patch) | |
tree | a75e8f51cc7f107e2b5328a8ea6c2a510e6993df /test | |
parent | 3081f817da8c194982596ddddf5d3ec321c859af (diff) | |
download | go-6b9e3f883e6820a1e94448ca81eba62341cd4836.tar.gz go-6b9e3f883e6820a1e94448ca81eba62341cd4836.zip |
cmd/compile: don't emit write barriers for offsets of global addresses
Currently, write barriers aren't emitted for global addresses, but they
are emitted for addresses offset of global addresses.
This CL changes IsGlobalAddr to recognize offsets of global addresses
as globals too, removing write barriers for staticuint64s based
addresses. The logic added is the same as used in IsStackAddr.
Updates #37612
Change-Id: I537579f85b9ad02987d94f3ee0b4508b90097959
Reviewed-on: https://go-review.googlesource.com/c/go/+/342129
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/writebarrier.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/writebarrier.go b/test/writebarrier.go index dbf0b6dde2..1b30fa509e 100644 --- a/test/writebarrier.go +++ b/test/writebarrier.go @@ -289,3 +289,17 @@ func f27(p *int) []interface{} { p, // ERROR "write barrier" } } + +var g28 [256]uint64 + +func f28() []interface{} { + return []interface{}{ + false, // no write barrier + true, // no write barrier + 0, // no write barrier + 1, // no write barrier + uint8(127), // no write barrier + int8(-4), // no write barrier + &g28[5], // no write barrier + } +} |