Commit 07b73ce1 authored by Austin Clements's avatar Austin Clements

runtime: simplify gcResetGState

Since allglock is held in this function, there's no point to
tip-toeing around allgs.  Just use a for-range loop.

Change-Id: I1ee61c7e8cac8b8ebc8107c0c22f739db5db9840
Reviewed-on: https://go-review.googlesource.com/5882Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
parent b3d791c7
......@@ -600,18 +600,17 @@ func gcCopySpans() {
// gcResetGState resets the GC state of all G's and returns the length
// of allgs.
func gcResetGState() int {
func gcResetGState() (numgs int) {
// This may be called during a concurrent phase, so make sure
// allgs doesn't change.
lock(&allglock)
local_allglen := allglen
for i := uintptr(0); i < local_allglen; i++ {
gp := allgs[i]
for _, gp := range allgs {
gp.gcworkdone = false // set to true in gcphasework
gp.gcscanvalid = false // stack has not been scanned
}
numgs = len(allgs)
unlock(&allglock)
return int(local_allglen)
return
}
// Hooks for other packages
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment