// there are no more pointers in the object. This information is held
// in the second nibble.
-// When marking an object if the bool checkmark is true one uses the above
+// When marking an object if the bool checkmarkphase is true one uses the above
// encoding, otherwise one uses the bitMarked bit in the lower two bits
// of the nibble.
-var checkmark = false
+var checkmarkphase = false
// inheap reports whether b is a pointer into a (potentially dead) heap object.
// It returns false for pointers into stack spans.
if gcphase != _GCmarktermination {
throw("marking new object while not in mark termination phase")
}
- if checkmark { // The world should be stopped so this should not happen.
+ if checkmarkphase { // The world should be stopped so this should not happen.
throw("gcmarknewobject called while doing checkmark")
}
throw("greyobject: obj not pointer-aligned")
}
- if checkmark {
+ if checkmarkphase {
if !ismarked(mbits) {
print("runtime:greyobject: checkmarks finds unexpected unmarked object obj=", hex(obj), ", mbits->bits=", hex(mbits.bits), " *mbits->bitp=", hex(*mbits.bitp), "\n")
print("runtime: found obj at *(", hex(base), "+", hex(off), ")\n")
atomicor8(mbits.bitp, bitMarked<<mbits.shift)
}
- if !checkmark && (mbits.xbits>>(mbits.shift+2))&_BitsMask == _BitsDead {
+ if !checkmarkphase && (mbits.xbits>>(mbits.shift+2))&_BitsMask == _BitsDead {
return wbuf // noscan object
}
}
if bits&_BitsPointer != _BitsPointer {
- print("gc checkmark=", checkmark, " b=", hex(b), " ptrmask=", ptrmask, " mbits.bitp=", mbits.bitp, " mbits.xbits=", hex(mbits.xbits), " bits=", hex(bits), "\n")
+ print("gc checkmarkphase=", checkmarkphase, " b=", hex(b), " ptrmask=", ptrmask, " mbits.bitp=", mbits.bitp, " mbits.xbits=", hex(mbits.xbits), " bits=", hex(bits), "\n")
throw("unexpected garbage collection bits")
}
continue
}
- if mheap_.shadow_enabled && debug.wbshadow >= 2 && debug.gccheckmark > 0 && checkmark {
+ if mheap_.shadow_enabled && debug.wbshadow >= 2 && debug.gccheckmark > 0 && checkmarkphase {
checkwbshadow((*uintptr)(unsafe.Pointer(b + i)))
}
if s.state != mSpanInUse {
continue
}
- if !checkmark && s.sweepgen != sg {
+ if !checkmarkphase && s.sweepgen != sg {
// sweepgen was updated (+2) during non-checkmark GC pass
print("sweep ", s.sweepgen, " ", sg, "\n")
throw("gc: unswept span")
return true
}
- if checkmark {
+ if checkmarkphase {
return ischeckmarked(&mbits)
}
// caller takes care of it.
//TODO go:nowritebarrier
func mSpan_Sweep(s *mspan, preserve bool) bool {
- if checkmark {
+ if checkmarkphase {
throw("MSpan_Sweep: checkmark only runs in STW and after the sweep")
}
// 10 - BitsPointer
// 11 - unused, for us BitsPointerMarked
//
- // When called to prepare for the checkmark phase (checkmark==1),
+ // When called to prepare for the checkmark phase (checkmarkphase==true),
// we change BitsDead to BitsScalar, so that there are no BitsScalarMarked
// type bits anywhere.
//
// The checkmark phase marks by changing BitsScalar to BitsScalarMarked
// and BitsPointer to BitsPointerMarked.
//
- // When called to clean up after the checkmark phase (checkmark==0),
+ // When called to clean up after the checkmark phase (checkmarkphase==false),
// we unmark by changing BitsScalarMarked back to BitsScalar and
// BitsPointerMarked back to BitsPointer.
//
throw("missing bitBoundary")
}
b := (*bitp & bitPtrMask) >> 2
- if !checkmark && (b == _BitsScalar || b == _BitsScalarMarked) {
+ if !checkmarkphase && (b == _BitsScalar || b == _BitsScalarMarked) {
*bitp &^= 0x0c // convert to _BitsDead
} else if b == _BitsScalarMarked || b == _BitsPointerMarked {
*bitp &^= _BitsCheckMarkXor << 2
throw("missing bitBoundary")
}
b = ((*bitp >> gcBits) & bitPtrMask) >> 2
- if !checkmark && (b == _BitsScalar || b == _BitsScalarMarked) {
+ if !checkmarkphase && (b == _BitsScalar || b == _BitsScalarMarked) {
*bitp &^= 0xc0 // convert to _BitsDead
} else if b == _BitsScalarMarked || b == _BitsPointerMarked {
*bitp &^= _BitsCheckMarkXor << (2 + gcBits)
}
b := (*bitp & bitPtrMask) >> 2
- if checkmark && b == _BitsDead {
+ if checkmarkphase && b == _BitsDead {
// move BitsDead into second word.
// set bits to BitsScalar in preparation for checkmark phase.
*bitp &^= 0xc0
*bitp |= _BitsScalar << 2
- } else if !checkmark && (b == _BitsScalar || b == _BitsScalarMarked) && *bitp&0xc0 == 0 {
+ } else if !checkmarkphase && (b == _BitsScalar || b == _BitsScalarMarked) && *bitp&0xc0 == 0 {
// Cleaning up after checkmark phase.
// First word is scalar or dead (we forgot)
// and second word is dead.
return
}
- if checkmark {
- throw("gccheckmark_m, entered with checkmark already true")
+ if checkmarkphase {
+ throw("gccheckmark_m, entered with checkmarkphase already true")
}
- checkmark = true
+ checkmarkphase = true
clearcheckmarkbits() // Converts BitsDead to BitsScalar.
- gc_m(startTime, eagersweep) // turns off checkmark + calls clearcheckmarkbits
+ gc_m(startTime, eagersweep) // turns off checkmarkphase + calls clearcheckmarkbits
}
//go:nowritebarrier
t1 = nanotime()
}
- if !checkmark {
+ if !checkmarkphase {
// TODO(austin) This is a noop beceause we should
// already have swept everything to the current
// sweepgen.
}
if debug.gccheckmark > 0 {
- if !checkmark {
+ if !checkmarkphase {
// first half of two-pass; don't set up sweep
unlock(&mheap_.lock)
return
}
- checkmark = false // done checking marks
+ checkmarkphase = false // done checking marks
clearcheckmarkbits()
}