• Austin Clements's avatar
    runtime: enable write barriers during concurrent scan · 1303957d
    Austin Clements authored
    Currently, write barriers are only enabled after completion of the
    concurrent scan phase, as we enter the concurrent mark phase. However,
    stack barriers are installed during the scan phase and assume that
    write barriers will track changes to frames above the stack
    barriers. Since write barriers aren't enabled until after stack
    barriers are installed, we may miss modifications to the stack that
    happen after installing the stack barriers and before enabling write
    barriers.
    
    Fix this by enabling write barriers during the scan phase.
    
    This commit intentionally makes the minimal change to do this (there's
    only one line of code change; the rest are comment changes). At the
    very least, we should consider eliminating the ragged barrier that's
    intended to synchronize the enabling of write barriers, but now just
    wastes time. I've included a large comment about extensions and
    alternative designs.
    
    Change-Id: Ib20fede794e4fcb91ddf36f99bd97344d7f96421
    Reviewed-on: https://go-review.googlesource.com/10795Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    1303957d
mgc.go 51.9 KB