]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: move write barrier insertion to SSA
authorCherry Zhang <cherryyz@google.com>
Mon, 6 Feb 2017 04:43:31 +0000 (23:43 -0500)
committerCherry Zhang <cherryyz@google.com>
Thu, 16 Mar 2017 14:24:21 +0000 (14:24 +0000)
commit9ebf3d5100a52b2c0ebcbf9754c02d1edf7a035f
tree48f33362d4d5c052850fb891595207f94ab984de
parent211c8c9f1a1d11a6f5c42e85ec78cd06a69fbe0c
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>
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/loop_test.go
src/cmd/compile/internal/ssa/shift_test.go
src/cmd/compile/internal/ssa/writebarrier.go
src/cmd/compile/internal/ssa/writebarrier_test.go