Skip to content

Commit b275e55

Browse files
committed
runtime: clean up more traces of the old mark bit
Commit 59877bf 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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
1 parent 4d5bb76 commit b275e55

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/runtime/mbitmap.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ const (
8080
bitPointer = 1 << 0
8181
bitScan = 1 << 4
8282

83-
heapBitsShift = 1 // shift offset between successive bitPointer or bitMarked entries
83+
heapBitsShift = 1 // shift offset between successive bitPointer or bitScan entries
8484
heapBitmapScale = sys.PtrSize * (8 / 2) // number of data bytes described by one heap bitmap byte
8585

86-
// all mark/pointer bits in a byte
87-
bitMarkedAll = bitScan | bitScan<<heapBitsShift | bitScan<<(2*heapBitsShift) | bitScan<<(3*heapBitsShift)
86+
// all scan/pointer bits in a byte
87+
bitScanAll = bitScan | bitScan<<heapBitsShift | bitScan<<(2*heapBitsShift) | bitScan<<(3*heapBitsShift)
8888
bitPointerAll = bitPointer | bitPointer<<heapBitsShift | bitPointer<<(2*heapBitsShift) | bitPointer<<(3*heapBitsShift)
8989
)
9090

@@ -481,7 +481,7 @@ func (h heapBits) forward(n uintptr) heapBits {
481481
return heapBits{subtractb(h.bitp, n/4), uint32(n%4) * heapBitsShift}
482482
}
483483

484-
// The caller can test isMarked and isPointer by &-ing with bitMarked and bitPointer.
484+
// The caller can test morePointers and isPointer by &-ing with bitScan and bitPointer.
485485
// The result includes in its higher bits the bits for subsequent words
486486
// described by the same bitmap byte.
487487
func (h heapBits) bits() uint32 {
@@ -730,7 +730,7 @@ func (h heapBits) initSpan(s *mspan) {
730730
end := h.bitp
731731
bitp := subtractb(end, nbyte-1)
732732
for {
733-
*bitp = bitPointerAll | bitMarkedAll
733+
*bitp = bitPointerAll | bitScanAll
734734
if bitp == end {
735735
break
736736
}
@@ -945,7 +945,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
945945
b := uint32(*ptrmask)
946946
hb := (b & 3) | bitScan
947947
if gcphase == _GCoff {
948-
// bitPointer == 1, bitMarked is 1 << 4, heapBitsShift is 1.
948+
// bitPointer == 1, bitScan is 1 << 4, heapBitsShift is 1.
949949
// 110011 is shifted h.shift and complemented.
950950
// This clears out the bits that are about to be
951951
// ored into *h.hbitp in the next instructions.
@@ -1128,7 +1128,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
11281128

11291129
// Phase 1: Special case for leading byte (shift==0) or half-byte (shift==4).
11301130
// The leading byte is special because it contains the bits for word 1,
1131-
// which does not have the marked bits set.
1131+
// which does not have the scan bit set.
11321132
// The leading half-byte is special because it's a half a byte and must be
11331133
// manipulated atomically.
11341134
switch {
@@ -1177,7 +1177,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
11771177
hb |= bitScan << (2 * heapBitsShift)
11781178
b >>= 2
11791179
nb -= 2
1180-
// Note: no bitMarker for second word because that's
1180+
// Note: no bitScan for second word because that's
11811181
// the checkmark.
11821182
if gcphase == _GCoff {
11831183
*hbitp &^= uint8((bitPointer | bitScan | (bitPointer << heapBitsShift)) << (2 * heapBitsShift))
@@ -1211,7 +1211,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
12111211
// but we'll stop at the break and then truncate
12121212
// appropriately in Phase 3.
12131213
hb = b & bitPointerAll
1214-
hb |= bitMarkedAll
1214+
hb |= bitScanAll
12151215
if w += 4; w >= nw {
12161216
break
12171217
}
@@ -1259,7 +1259,7 @@ func heapBitsSetType(x, size, dataSize uintptr, typ *_type) {
12591259

12601260
// Emit bitmap byte.
12611261
hb = b & bitPointerAll
1262-
hb |= bitMarkedAll
1262+
hb |= bitScanAll
12631263
if w += 4; w >= nw {
12641264
break
12651265
}
@@ -1275,7 +1275,7 @@ Phase3:
12751275
// there are more entries than possible pointer slots.
12761276
// Discard the excess entries (can't be more than 3).
12771277
mask := uintptr(1)<<(4-(w-nw)) - 1
1278-
hb &= mask | mask<<4 // apply mask to both pointer bits and mark bits
1278+
hb &= mask | mask<<4 // apply mask to both pointer bits and scan bits
12791279
}
12801280

12811281
// Change nw from counting possibly-pointer words to total words in allocation.
@@ -1525,11 +1525,11 @@ Run:
15251525
dst = add1(dst)
15261526
bits >>= 8
15271527
} else {
1528-
v := bits&bitPointerAll | bitMarkedAll
1528+
v := bits&bitPointerAll | bitScanAll
15291529
*dst = uint8(v)
15301530
dst = subtract1(dst)
15311531
bits >>= 4
1532-
v = bits&bitPointerAll | bitMarkedAll
1532+
v = bits&bitPointerAll | bitScanAll
15331533
*dst = uint8(v)
15341534
dst = subtract1(dst)
15351535
bits >>= 4
@@ -1563,11 +1563,11 @@ Run:
15631563
dst = add1(dst)
15641564
bits >>= 8
15651565
} else {
1566-
v := bits&0xf | bitMarkedAll
1566+
v := bits&0xf | bitScanAll
15671567
*dst = uint8(v)
15681568
dst = subtract1(dst)
15691569
bits >>= 4
1570-
v = bits&0xf | bitMarkedAll
1570+
v = bits&0xf | bitScanAll
15711571
*dst = uint8(v)
15721572
dst = subtract1(dst)
15731573
bits >>= 4
@@ -1694,7 +1694,7 @@ Run:
16941694
}
16951695
} else {
16961696
for nbits >= 4 {
1697-
*dst = uint8(bits&0xf | bitMarkedAll)
1697+
*dst = uint8(bits&0xf | bitScanAll)
16981698
dst = subtract1(dst)
16991699
bits >>= 4
17001700
nbits -= 4
@@ -1752,7 +1752,7 @@ Run:
17521752
for i := c / 4; i > 0; i-- {
17531753
bits |= (uintptr(*src) & 0xf) << nbits
17541754
src = subtract1(src)
1755-
*dst = uint8(bits&0xf | bitMarkedAll)
1755+
*dst = uint8(bits&0xf | bitScanAll)
17561756
dst = subtract1(dst)
17571757
bits >>= 4
17581758
}
@@ -1778,7 +1778,7 @@ Run:
17781778
totalBits = (uintptr(unsafe.Pointer(dstStart))-uintptr(unsafe.Pointer(dst)))*4 + nbits
17791779
nbits += -nbits & 3
17801780
for ; nbits > 0; nbits -= 4 {
1781-
v := bits&0xf | bitMarkedAll
1781+
v := bits&0xf | bitScanAll
17821782
*dst = uint8(v)
17831783
dst = subtract1(dst)
17841784
bits >>= 4

0 commit comments

Comments
 (0)