Commit b275e55d authored by Austin Clements's avatar Austin Clements

runtime: clean up more traces of the old mark bit

Commit 59877bfa renamed bitMarked to bitScan, since the bitmap is no
longer used for marking. However, there were several other references
to this strewn about comments and in some other constant names. Fix
these up, too.

Change-Id: I4183d28c6b01977f1d75a99ad55b150f2211772d
Reviewed-on: https://go-review.googlesource.com/28450
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 4d5bb762
...@@ -80,11 +80,11 @@ const ( ...@@ -80,11 +80,11 @@ const (
bitPointer = 1 << 0 bitPointer = 1 << 0
bitScan = 1 << 4 bitScan = 1 << 4
heapBitsShift = 1 // shift offset between successive bitPointer or bitMarked entries heapBitsShift = 1 // shift offset between successive bitPointer or bitScan entries
heapBitmapScale = sys.PtrSize * (8 / 2) // number of data bytes described by one heap bitmap byte heapBitmapScale = sys.PtrSize * (8 / 2) // number of data bytes described by one heap bitmap byte
// all mark/pointer bits in a byte // all scan/pointer bits in a byte
bitMarkedAll = bitScan | bitScan<<heapBitsShift | bitScan<<(2*heapBitsShift) | bitScan<<(3*heapBitsShift) bitScanAll = bitScan | bitScan<<heapBitsShift | bitScan<<(2*heapBitsShift) | bitScan<<(3*heapBitsShift)
bitPointerAll = bitPointer | bitPointer<<heapBitsShift | bitPointer<<(2*heapBitsShift) | bitPointer<<(3*heapBitsShift) bitPointerAll = bitPointer | bitPointer<<heapBitsShift | bitPointer<<(2*heapBitsShift) | bitPointer<<(3*heapBitsShift)
) )
...@@ -481,7 +481,7 @@ func (h heapBits) forward(n uintptr) heapBits { ...@@ -481,7 +481,7 @@ func (h heapBits) forward(n uintptr) heapBits {
return heapBits{subtractb(h.bitp, n/4), uint32(n%4) * heapBitsShift} return heapBits{subtractb(h.bitp, n/4), uint32(n%4) * heapBitsShift}
} }
// The caller can test isMarked and isPointer by &-ing with bitMarked and bitPointer. // The caller can test morePointers and isPointer by &-ing with bitScan and bitPointer.
// The result includes in its higher bits the bits for subsequent words // The result includes in its higher bits the bits for subsequent words
// described by the same bitmap byte. // described by the same bitmap byte.
func (h heapBits) bits() uint32 { func (h heapBits) bits() uint32 {
...@@ -730,7 +730,7 @@ func (h heapBits) initSpan(s *mspan) { ...@@ -730,7 +730,7 @@ func (h heapBits) initSpan(s *mspan) {
end := h.bitp end := h.bitp
bitp := subtractb(end, nbyte-1) bitp := subtractb(end, nbyte-1)
for { for {
*bitp = bitPointerAll | bitMarkedAll *bitp = bitPointerAll | bitScanAll
if bitp == end { if bitp == end {
break break
} }
...@@ -945,7 +945,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -945,7 +945,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
b := uint32(*ptrmask) b := uint32(*ptrmask)
hb := (b & 3) | bitScan hb := (b & 3) | bitScan
if gcphase == _GCoff { if gcphase == _GCoff {
// bitPointer == 1, bitMarked is 1 << 4, heapBitsShift is 1. // bitPointer == 1, bitScan is 1 << 4, heapBitsShift is 1.
// 110011 is shifted h.shift and complemented. // 110011 is shifted h.shift and complemented.
// This clears out the bits that are about to be // This clears out the bits that are about to be
// ored into *h.hbitp in the next instructions. // ored into *h.hbitp in the next instructions.
...@@ -1128,7 +1128,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -1128,7 +1128,7 @@ 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 word 1, // The leading byte is special because it contains the bits for word 1,
// which does not have the marked bits set. // which does not have the scan bit 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 {
...@@ -1177,7 +1177,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -1177,7 +1177,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
hb |= bitScan << (2 * heapBitsShift) hb |= bitScan << (2 * heapBitsShift)
b >>= 2 b >>= 2
nb -= 2 nb -= 2
// Note: no bitMarker for second word because that's // Note: no bitScan for second word because that's
// the checkmark. // the checkmark.
if gcphase == _GCoff { if gcphase == _GCoff {
*hbitp &^= uint8((bitPointer | bitScan | (bitPointer << heapBitsShift)) << (2 * heapBitsShift)) *hbitp &^= uint8((bitPointer | bitScan | (bitPointer << heapBitsShift)) << (2 * heapBitsShift))
...@@ -1211,7 +1211,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -1211,7 +1211,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
// but we'll stop at the break and then truncate // but we'll stop at the break and then truncate
// appropriately in Phase 3. // appropriately in Phase 3.
hb = b & bitPointerAll hb = b & bitPointerAll
hb |= bitMarkedAll hb |= bitScanAll
if w += 4; w >= nw { if w += 4; w >= nw {
break break
} }
...@@ -1259,7 +1259,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) { ...@@ -1259,7 +1259,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
// Emit bitmap byte. // Emit bitmap byte.
hb = b & bitPointerAll hb = b & bitPointerAll
hb |= bitMarkedAll hb |= bitScanAll
if w += 4; w >= nw { if w += 4; w >= nw {
break break
} }
...@@ -1275,7 +1275,7 @@ Phase3: ...@@ -1275,7 +1275,7 @@ Phase3:
// there are more entries than possible pointer slots. // there are more entries than possible pointer slots.
// Discard the excess entries (can't be more than 3). // Discard the excess entries (can't be more than 3).
mask := uintptr(1)<<(4-(w-nw)) - 1 mask := uintptr(1)<<(4-(w-nw)) - 1
hb &= mask | mask<<4 // apply mask to both pointer bits and mark bits hb &= mask | mask<<4 // apply mask to both pointer bits and scan bits
} }
// Change nw from counting possibly-pointer words to total words in allocation. // Change nw from counting possibly-pointer words to total words in allocation.
...@@ -1525,11 +1525,11 @@ Run: ...@@ -1525,11 +1525,11 @@ Run:
dst = add1(dst) dst = add1(dst)
bits >>= 8 bits >>= 8
} else { } else {
v := bits&bitPointerAll | bitMarkedAll v := bits&bitPointerAll | bitScanAll
*dst = uint8(v) *dst = uint8(v)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
v = bits&bitPointerAll | bitMarkedAll v = bits&bitPointerAll | bitScanAll
*dst = uint8(v) *dst = uint8(v)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
...@@ -1563,11 +1563,11 @@ Run: ...@@ -1563,11 +1563,11 @@ Run:
dst = add1(dst) dst = add1(dst)
bits >>= 8 bits >>= 8
} else { } else {
v := bits&0xf | bitMarkedAll v := bits&0xf | bitScanAll
*dst = uint8(v) *dst = uint8(v)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
v = bits&0xf | bitMarkedAll v = bits&0xf | bitScanAll
*dst = uint8(v) *dst = uint8(v)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
...@@ -1694,7 +1694,7 @@ Run: ...@@ -1694,7 +1694,7 @@ Run:
} }
} else { } else {
for nbits >= 4 { for nbits >= 4 {
*dst = uint8(bits&0xf | bitMarkedAll) *dst = uint8(bits&0xf | bitScanAll)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
nbits -= 4 nbits -= 4
...@@ -1752,7 +1752,7 @@ Run: ...@@ -1752,7 +1752,7 @@ Run:
for i := c / 4; i > 0; i-- { for i := c / 4; i > 0; i-- {
bits |= (uintptr(*src) & 0xf) << nbits bits |= (uintptr(*src) & 0xf) << nbits
src = subtract1(src) src = subtract1(src)
*dst = uint8(bits&0xf | bitMarkedAll) *dst = uint8(bits&0xf | bitScanAll)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
} }
...@@ -1778,7 +1778,7 @@ Run: ...@@ -1778,7 +1778,7 @@ Run:
totalBits = (uintptr(unsafe.Pointer(dstStart))-uintptr(unsafe.Pointer(dst)))*4 + nbits totalBits = (uintptr(unsafe.Pointer(dstStart))-uintptr(unsafe.Pointer(dst)))*4 + nbits
nbits += -nbits & 3 nbits += -nbits & 3
for ; nbits > 0; nbits -= 4 { for ; nbits > 0; nbits -= 4 {
v := bits&0xf | bitMarkedAll v := bits&0xf | bitScanAll
*dst = uint8(v) *dst = uint8(v)
dst = subtract1(dst) dst = subtract1(dst)
bits >>= 4 bits >>= 4
......
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