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/6271
Reviewed-by: Rick Hudson <rlh@golang.org>
// 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)
}
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