• Cherry Zhang's avatar
    cmd/compile: move write barrier insertion to SSA · 9ebf3d51
    Cherry Zhang authored
    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: 's avatarKeith Randall <khr@golang.org>
    9ebf3d51
ssa.go 154 KB