53c9b95 runtime: check held locks with staticlockranking

Authored and Committed by Michael Pratt 3 years ago
    runtime: check held locks with staticlockranking
    
    When lock ranking is enabled, we can now assert that lock preconditions
    are met by checking that the caller holds required locks on function
    entry.
    
    This change adds the infrastructure to add assertions. Actual assertions
    will be added for various locks in subsequent changes.
    
    Some functions are protected by locks that are not directly accessible
    in the function. In that case, we can use assertRankHeld to check that
    any lock with the rank is held. This is less precise, but it avoids
    requiring passing the lock into the functions.
    
    Updates #40677
    
    Change-Id: I843c6874867f975e90a063f087b6e2ffc147877b
    Reviewed-on: https://go-review.googlesource.com/c/go/+/245484
    Run-TryBot: Michael Pratt <mpratt@google.com>
    TryBot-Result: Go Bot <gobot@golang.org>
    Trust: Michael Pratt <mpratt@google.com>
    Reviewed-by: Michael Knyszek <mknyszek@google.com>
    
        
file modified
+8 -0
file modified
+67 -3