• Russ Cox's avatar
    [dev.garbage] cmd/gc, runtime: implement write barriers in terms of writebarrierptr · b035e973
    Russ Cox authored
    This CL implements the many multiword write barriers by calling
    writebarrierptr, so that only writebarrierptr needs the actual barrier.
    In lieu of an actual barrier, writebarrierptr checks that the value
    being copied is not a small non-zero integer. This is enough to
    shake out bugs where the barrier is being called when it should not
    (for non-pointer values). It also found a few tests in sync/atomic
    that were being too clever.
    
    This CL adds a write barrier for the memory moved during the
    builtin copy function, which I forgot when inserting barriers for Go 1.4.
    
    This CL re-enables some write barriers that were disabled for Go 1.4.
    Those were disabled because it is possible to change the generated
    code so that they are unnecessary most of the time, but we have not
    changed the generated code yet. For safety they must be enabled.
    
    None of this is terribly efficient. We are aiming for correct first.
    
    LGTM=rlh
    R=rlh
    CC=golang-codereviews
    https://golang.org/cl/168770043
    b035e973
wbfat.go 4.37 KB