• Josh Bleecher Snyder's avatar
    cmd/compile: catch and report nowritebarrier violations later · 0323895c
    Josh Bleecher Snyder authored
    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: 's avatarCherry Zhang <cherryyz@google.com>
    0323895c
func.go 17.9 KB