]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add go:nowritebarrierrec annotation
authorAustin Clements <austin@google.com>
Mon, 2 Nov 2015 21:45:07 +0000 (16:45 -0500)
committerAustin Clements <austin@google.com>
Wed, 4 Nov 2015 14:42:04 +0000 (14:42 +0000)
commit3a765430c18f993e291de14cc8d7803d95493fb8
tree5592335db2fab442e76801f286c41ed31f04aca1
parent2780abd645536db2f23d6c1f47bb404bc1da8fea
cmd/compile: add go:nowritebarrierrec annotation

This introduces a recursive variant of the go:nowritebarrier
annotation that prohibits write barriers not only in the annotated
function, but in all functions it calls, recursively. The error
message gives the shortest call stack from the annotated function to
the function containing the prohibited write barrier, including the
names of the functions and the line numbers of the calls.

To demonstrate the annotation, we apply it to gcmarkwb_m, the write
barrier itself.

This is a new annotation rather than a modification of the existing
go:nowritebarrier annotation because, for better or worse, there are
many go:nowritebarrier functions that do call functions with write
barriers. In most of these cases this is benign because the annotation
was conservative, but it prohibits simply coopting the existing
annotation.

Change-Id: I225ca483c8f699e8436373ed96349e80ca2c2479
Reviewed-on: https://go-review.googlesource.com/16554
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/cgen.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/y.go
src/runtime/mbarrier.go