From da4874cba431d502a9c0764b8a68685af7bc7c35 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 27 Feb 2015 12:41:20 -0500 Subject: [PATCH] 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/6271 Reviewed-by: Rick Hudson --- src/runtime/mbitmap.go | 4 ++++ src/runtime/mgcmark.go | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 702fccae98..4592044363 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -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<