From 96265610307eab2b160a271169632b52ad7cc455 Mon Sep 17 00:00:00 2001
From: Russ Cox <rsc@golang.org>
Date: Thu, 7 May 2015 15:29:48 -0400
Subject: [PATCH] runtime: fix gccheckmark mode and enable by default

It was testing the mark bits on what roots pointed at,
but not the remainder of the live heap, because in
CL 2991 I accidentally inverted this check during
refactoring.

The next CL will turn it back off by default again,
but I want one run on the builders with the full
checkmark checks.

Change-Id: Ic166458cea25c0a56e5387fc527cb166ff2e5ada
Reviewed-on: https://go-review.googlesource.com/9824
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
---
 src/runtime/mgcmark.go  | 2 +-
 src/runtime/runtime1.go | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index f69166ee22..9d78ddecae 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -673,7 +673,7 @@ func greyobject(obj, base, off uintptr, hbits heapBits, span *mspan, gcw *gcWork
 
 			throw("checkmark found unmarked object")
 		}
-		if !hbits.isCheckmarked() {
+		if hbits.isCheckmarked() {
 			return
 		}
 		hbits.setCheckmarked()
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index ea3883018b..3bf0b95f6d 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -336,6 +336,7 @@ var dbgvars = []dbgVar{
 }
 
 func parsedebugvars() {
+	debug.gccheckmark=1
 	for p := gogetenv("GODEBUG"); p != ""; {
 		field := ""
 		i := index(p, ",")
-- 
2.30.9