• Austin Clements's avatar
    runtime: lift systemstack part of gcAssistAlloc · f9e1adb7
    Austin Clements authored
    This lifts the part of gcAssistAlloc that runs on the system stack to
    its own function in preparation for letting assists perform root jobs
    (notably stack scanning). This makes it easy to see that there are no
    references to the user stack once we've entered gcAssistAlloc1, which
    means it's safe to shrink the stack while in gcAssistAlloc1.
    
    This does not yet make assists perform root jobs, so it's not actually
    possible for the stack to shrink yet. That will happen in the next
    commit.
    
    The code in gcAssistAlloc1 is identical to the code that's currently
    passed in a closure to systemstack with one exception. Currently, we
    set the "completed" variable in the enclosing scope to indicate that
    the assist completed the mark phase. This is exactly the sort of
    cross-stack reference lifting this function is meant to prevent. We
    replace this variable with setting gp.param to nil or non-nil to
    indicate the completion status.
    
    Updates #15361.
    
    Change-Id: Iba7cfb758c781070a441aea86c0117b399a24dbd
    Reviewed-on: https://go-review.googlesource.com/32431
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Run-TryBot: Austin Clements <austin@google.com>
    Reviewed-by: default avatarRick Hudson <rlh@golang.org>
    f9e1adb7
mgcmark.go 44.1 KB