]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: mark memclrHasPointers calls as write barriers
authorAustin Clements <austin@google.com>
Wed, 5 Dec 2018 20:21:17 +0000 (15:21 -0500)
committerAustin Clements <austin@google.com>
Wed, 5 Dec 2018 21:54:52 +0000 (21:54 +0000)
commitc8ca793176cfae8a9fc501d6e37896304f483f2e
treefd5f5ef367df1ff8f021df2fe21c74d2cee29f31
parent162de6b5f0c332ca0a1ac5879682cd48c2f93ead
cmd/compile: mark memclrHasPointers calls as write barriers

There are two places where the compiler generates memclrHasPointers
calls. These are effectively write barriers, but the compiler doesn't
currently record them as such in the function. As a result code like

  for i := range a {
    a[i] = nil
  }

inserts a write barrier for the assignment to a[i], but the compiler
doesn't report this. Hence, it's not reported in the -d=wb output, and
it's not checked against //go:nowritebarrier annotations.

Change-Id: I40299ebc9824f05cf516cba494d4c086b80ffb53
Reviewed-on: https://go-review.googlesource.com/c/152722
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/walk.go