diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-03-30 11:40:06 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-03-31 16:31:20 +0000 |
commit | 0323895cc015aa155013a945caf05f08615ccdcc (patch) | |
tree | 0a8b4e13f2856f0130855c7584c2e2a2c77114fe /src/cmd/compile/internal/ssa | |
parent | ca33e1097155019d0636a0da805054b4182e9b7d (diff) | |
download | go-0323895cc015aa155013a945caf05f08615ccdcc.tar.gz go-0323895cc015aa155013a945caf05f08615ccdcc.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/ssa')
-rw-r--r-- | src/cmd/compile/internal/ssa/config.go | 3 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/export_test.go | 1 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/func.go | 1 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/writebarrier.go | 3 |
4 files changed, 0 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 912fb16d8b..96a4c2b8ae 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -80,9 +80,6 @@ type Logger interface { // Fatal reports a compiler error and exits. Fatalf(pos src.XPos, msg string, args ...interface{}) - // Error reports a compiler error but keep going. - Error(pos src.XPos, msg string, args ...interface{}) - // Warnl writes compiler messages in the form expected by "errorcheck" tests Warnl(pos src.XPos, fmt_ string, args ...interface{}) diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go index c26df1b964..f7a80a8c00 100644 --- a/src/cmd/compile/internal/ssa/export_test.go +++ b/src/cmd/compile/internal/ssa/export_test.go @@ -124,7 +124,6 @@ func (d DummyFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, arg func (d DummyFrontend) Log() bool { return true } func (d DummyFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) } -func (d DummyFrontend) Error(_ src.XPos, msg string, args ...interface{}) { d.t.Errorf(msg, args...) } func (d DummyFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) } func (d DummyFrontend) Debug_checknil() bool { return false } func (d DummyFrontend) Debug_wb() bool { return false } diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go index 17860957cf..5093d0e7fc 100644 --- a/src/cmd/compile/internal/ssa/func.go +++ b/src/cmd/compile/internal/ssa/func.go @@ -37,7 +37,6 @@ type Func struct { scheduled bool // Values in Blocks are in final order NoSplit bool // true if function is marked as nosplit. Used by schedule check pass. - NoWB bool // write barrier is not allowed WBPos src.XPos // line number of first write barrier // when register allocation is done, maps value ids to locations diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go index 35be9a09d7..1b6e51c674 100644 --- a/src/cmd/compile/internal/ssa/writebarrier.go +++ b/src/cmd/compile/internal/ssa/writebarrier.go @@ -208,9 +208,6 @@ func writebarrier(f *Func) { memElse.Aux = w.Aux } - if f.NoWB { - f.fe.Error(pos, "write barrier prohibited") - } if !f.WBPos.IsKnown() { f.WBPos = pos } |