mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
211c8c9f1a
commit
9ebf3d5100
7 changed files with 63 additions and 30 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue