• Cherry Zhang's avatar
    cmd/compile: do not use "oaslit" for global · 160914e3
    Cherry Zhang authored
    The compiler did not emit write barrier for assigning global with
    struct literal, like global = T{} where T contains pointer.
    
    The relevant code path is:
    walkexpr OAS var_ OSTRUCTLIT
        oaslit
            anylit OSTRUCTLIT
                walkexpr OAS var_ nil
                return without adding write barrier
        return true
    break (without adding write barrier)
    
    This CL makes oaslit not apply to globals. See also CL
    https://go-review.googlesource.com/c/36355/ for an alternative
    fix.
    
    The downside of this is that it generates static data for zeroing
    struct now. Also this only covers global. If there is any lurking
    bug with implicit zeroing other than globals, this doesn't fix.
    
    Fixes #18956.
    
    Change-Id: Ibcd27e4fae3aa38390ffa94a32a9dd7a802e4b37
    Reviewed-on: https://go-review.googlesource.com/36410Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    160914e3
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...