mirror of
https://github.com/golang/go
synced 2024-09-30 02:34:40 -06:00
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 <rlh@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
ca42f1f50e
commit
e1024b6030
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user