Commit da4874cb authored by Austin Clements's avatar Austin Clements

runtime: trivial clean ups to greyobject

Previously, the typeDead check in greyobject was under a separate
!useCheckmark conditional.  Put it with the rest of the !useCheckmark
code.  Also move a comment about atomic update of the marked bit to
where we actually do that update now.

Change-Id: Ief5f16401a25739ad57d959607b8d81ffe0bc211
Reviewed-on: https://go-review.googlesource.com/6271Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
parent b1517c39
......@@ -234,6 +234,10 @@ func (h heapBits) isMarked() bool {
// setMarked sets the marked bit in the heap bits, atomically.
func (h heapBits) setMarked() {
// Each byte of GC bitmap holds info for two words.
// Might be racing with other updates, so use atomic update always.
// We used to be clever here and use a non-atomic update in certain
// cases, but it's not worth the risk.
atomicor8(h.bitp, bitMarked<<h.shift)
}
......
......@@ -577,15 +577,13 @@ func greyobject(obj, base, off uintptr, hbits heapBits, gcw *gcWorkProducer) {
return
}
// Each byte of GC bitmap holds info for two words.
// Might be racing with other updates, so use atomic update always.
// We used to be clever here and use a non-atomic update in certain
// cases, but it's not worth the risk.
hbits.setMarked()
}
if !useCheckmark && hbits.typeBits() == typeDead {
return // noscan object
// If this is a noscan object, fast-track it to black
// instead of greying it.
if hbits.typeBits() == typeDead {
return
}
}
// Queue the obj for scanning. The PREFETCH(obj) logic has been removed but
......
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