]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix heapBitsSweepSpan comment
authorAustin Clements <austin@google.com>
Tue, 9 Feb 2016 22:24:26 +0000 (17:24 -0500)
committerAustin Clements <austin@google.com>
Thu, 25 Feb 2016 23:37:09 +0000 (23:37 +0000)
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 <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/mbitmap.go

index 80c267f7bb35e5638a7aacf654d5039803a638a1..35fc82bf4ac3aedf998f7ffdd0e5cdb2237481f9 100644 (file)
@@ -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.