aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/export_test.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2017-02-05 23:43:31 -0500
committerCherry Zhang <cherryyz@google.com>2017-03-16 14:24:21 +0000
commit9ebf3d5100a52b2c0ebcbf9754c02d1edf7a035f (patch)
tree48f33362d4d5c052850fb891595207f94ab984de /src/cmd/compile/internal/ssa/export_test.go
parent211c8c9f1a1d11a6f5c42e85ec78cd06a69fbe0c (diff)
downloadgo-9ebf3d5100a52b2c0ebcbf9754c02d1edf7a035f.tar.gz
go-9ebf3d5100a52b2c0ebcbf9754c02d1edf7a035f.zip
cmd/compile: move write barrier insertion to SSA
When the compiler insert write barriers, the frontend makes conservative decisions at an early stage. This sometimes have false positives because of the lack of information, for example, writes on stack. SSA's writebarrier pass identifies writes on stack and eliminates write barriers for them. This CL moves write barrier insertion into SSA. The frontend no longer makes decisions about write barriers, and simply does normal assignments and emits normal Store ops when building SSA. SSA writebarrier pass inserts write barrier for Stores when needed. There, it has better information about the store because Phi and Copy propagation are done at that time. This CL only changes StoreWB to Store in gc/ssa.go. A followup CL simplifies SSA building code. Updates #17583. Change-Id: I4592d9bc0067503befc169c50b4e6f4765673bec Reviewed-on: https://go-review.googlesource.com/36839 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/export_test.go')
-rw-r--r--src/cmd/compile/internal/ssa/export_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go
index b687076a28..699e0efc20 100644
--- a/src/cmd/compile/internal/ssa/export_test.go
+++ b/src/cmd/compile/internal/ssa/export_test.go
@@ -88,6 +88,9 @@ func (DummyFrontend) AllocFrame(f *Func) {
func (DummyFrontend) Syslook(s string) *obj.LSym {
return obj.Linklookup(TestCtxt, s, 0)
}
+func (DummyFrontend) UseWriteBarrier() bool {
+ return true // only writebarrier_test cares
+}
func (d DummyFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
func (d DummyFrontend) Log() bool { return true }