Commit 77c7f124 authored by Austin Clements's avatar Austin Clements

runtime: update some comments

This updates some comments that became out of date when we moved the
mark bit out of the heap bitmap and started using the high bit for the
first word as a scan/dead bit.

Change-Id: I4a572d16db6114cadff006825466c1f18359f2db
Reviewed-on: https://go-review.googlesource.com/22662Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 5d002dbc
...@@ -850,15 +850,12 @@ func (s *mspan) countFree() int { ...@@ -850,15 +850,12 @@ func (s *mspan) countFree() int {
// because all free objects are marked as noscan during // because all free objects are marked as noscan during
// heapBitsSweepSpan. // heapBitsSweepSpan.
// There can only be one allocation from a given span active at a time, // There can only be one allocation from a given span active at a time,
// so this code is not racing with other instances of itself, // so this code is not racing with other instances of itself, and
// and we don't allocate from a span until it has been swept, // the bitmap for a span always falls on byte boundaries.
// so this code is not racing with heapBitsSweepSpan. // Hence, it can access the bitmap with racing.
// It is, however, racing with the concurrent GC mark phase, //
// which can be setting the mark bit in the leading 2-bit entry // TODO: This still has atomic accesses left over from when it could
// of an allocated block. The block we are modifying is not quite // race with GC accessing mark bits in the bitmap. Remove these.
// allocated yet, so the GC marker is not racing with updates to x's bits,
// but if the start or end of x shares a bitmap byte with an adjacent
// object, the GC marker is racing with updates to those object's mark bits.
func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
const doubleCheck = false // slow but helpful; enable to test modifications to this code const doubleCheck = false // slow but helpful; enable to test modifications to this code
...@@ -1122,8 +1119,8 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -1122,8 +1119,8 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
} }
// Phase 1: Special case for leading byte (shift==0) or half-byte (shift==4). // Phase 1: Special case for leading byte (shift==0) or half-byte (shift==4).
// The leading byte is special because it contains the bits for words 0 and 1, // The leading byte is special because it contains the bits for word 1,
// which do not have the marked bits set. // which does not have the marked bits set.
// The leading half-byte is special because it's a half a byte and must be // The leading half-byte is special because it's a half a byte and must be
// manipulated atomically. // manipulated atomically.
switch { switch {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment