From e1024b6030e181f3994d93cac6099d3d0f341260 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 9 Feb 2016 17:24:26 -0500 Subject: [PATCH] runtime: fix heapBitsSweepSpan comment Currently the heapBitsSweepSpan comment claims that heapBitsSweepSpan sets the heap bitmap for the first two words to dead. In fact, it sets the first *four* words to scalar/dead. This is important because first two words don't actually have a dead bit, so for objects larger than two words it *must* set a dead bit in third word to reset the object to a "noscan" state. For example, we use this in heapBits.hasPointers to detect that an object larger than two words is noscan. Change-Id: Ie166a628bed5060851db083475c7377adb349d6c Reviewed-on: https://go-review.googlesource.com/19630 Reviewed-by: Rick Hudson Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot --- src/runtime/mbitmap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 80c267f7bb..35fc82bf4a 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -558,7 +558,7 @@ func (h heapBits) clearCheckmarkSpan(size, n, total uintptr) { // heapBitsSweepSpan coordinates the sweeping of a span by reading // and updating the corresponding heap bitmap entries. // For each free object in the span, heapBitsSweepSpan sets the type -// bits for the first two words (or one for single-word objects) to typeDead +// bits for the first four words (less for smaller objects) to scalar/dead // and then calls f(p), where p is the object's base address. // f is expected to add the object to a free list. // For non-free objects, heapBitsSweepSpan turns off the marked bit. -- 2.48.1