• Austin Clements's avatar
    runtime: avoid double-scanning of stacks · 724f8298
    Austin Clements authored
    Currently there's a race between stopg scanning another G's stack and
    the G reaching a preemption point and scanning its own stack. When
    this race occurs, the G's stack is scanned twice. Currently this is
    okay, so this race is benign.
    
    However, we will shortly be adding stack barriers during the first
    stack scan, so scanning will no longer be idempotent. To prepare for
    this, this change ensures that each stack is scanned only once during
    each GC phase by checking the flag that indicates that the stack has
    been scanned in this phase before scanning the stack.
    
    Change-Id: Id9f4d5e2e5b839bc3f200ec1723a4a12dd677ab4
    Reviewed-on: https://go-review.googlesource.com/10458Reviewed-by: default avatarRick Hudson <rlh@golang.org>
    724f8298
stack1.go 25 KB