]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: catch and report nowritebarrier violations later
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 18:40:06 +0000 (11:40 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 31 Mar 2017 16:31:20 +0000 (16:31 +0000)
commit0323895cc015aa155013a945caf05f08615ccdcc
tree0a8b4e13f2856f0130855c7584c2e2a2c77114fe
parentca33e1097155019d0636a0da805054b4182e9b7d
cmd/compile: catch and report nowritebarrier violations later

Prior to this CL, the SSA backend reported violations
of the //go:nowritebarrier annotation immediately.
This necessitated emitting errors during SSA compilation,
which is not compatible with a concurrent backend.

Instead, check for such violations later.
We already save the data required to do a late check
for violations of the //go:nowritebarrierrec annotation.
Use the same data, and check //go:nowritebarrier at the same time.

One downside to doing this is that now only a single
violation will be reported per function.
Given that this is for the runtime only,
and violations are rare, this seems an acceptable cost.

While we are here, remove several 'nerrors != 0' checks
that are rendered pointless.

Updates #15756
Fixes #19250 (as much as it ever can be)

Change-Id: Ia44c4ad5b6fd6f804d9f88d9571cec8d23665cb3
Reviewed-on: https://go-review.googlesource.com/38973
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/writebarrier.go