aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcmark.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mgcmark.go')
-rw-r--r--src/runtime/mgcmark.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index aa7f7a7769..e5000ed086 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -106,26 +106,32 @@ func gcMarkRootCheck() {
lock(&allglock)
// Check that stacks have been scanned.
+ var gp *g
if gcphase == _GCmarktermination {
for i := 0; i < len(allgs); i++ {
- gp := allgs[i]
+ gp = allgs[i]
if !(gp.gcscandone && gp.gcscanvalid) && readgstatus(gp) != _Gdead {
- println("gp", gp, "goid", gp.goid,
- "status", readgstatus(gp),
- "gcscandone", gp.gcscandone,
- "gcscanvalid", gp.gcscanvalid)
- throw("scan missed a g")
+ goto fail
}
}
} else {
for i := 0; i < work.nStackRoots; i++ {
- gp := allgs[i]
+ gp = allgs[i]
if !gp.gcscandone {
- throw("scan missed a g")
+ goto fail
}
}
}
unlock(&allglock)
+ return
+
+fail:
+ println("gp", gp, "goid", gp.goid,
+ "status", readgstatus(gp),
+ "gcscandone", gp.gcscandone,
+ "gcscanvalid", gp.gcscanvalid)
+ unlock(&allglock) // Avoid self-deadlock with traceback.
+ throw("scan missed a g")
}
// ptrmask for an allocation containing a single pointer.