// retain everything it points to.
spf := (*specialfinalizer)(unsafe.Pointer(sp))
// A finalizer can be set for an inner byte of an object, find object beginning.
- p := uintptr(s.start<<_PageShift) + uintptr(spf.special.offset)/s.elemsize*s.elemsize
+ p := s.base() + uintptr(spf.special.offset)/s.elemsize*s.elemsize
// Mark everything that can be reached from
// the object (but *not* the object itself or
if blocking {
b = gcw.get()
} else {
- b = gcw.tryGet()
+ b = gcw.tryGetFast()
+ if b == 0 {
+ b = gcw.tryGet()
+ }
}
if b == 0 {
// work barrier reached or tryGet failed.
// PREFETCH(wbuf->obj[wbuf.nobj - 3];
// }
//
- b := gcw.tryGet()
+ b := gcw.tryGetFast()
+ if b == 0 {
+ b = gcw.tryGet()
+ }
+
if b == 0 {
break
}
if obj&(sys.PtrSize-1) != 0 {
throw("greyobject: obj not pointer-aligned")
}
-
+ mbits := span.markBitsForAddr(obj)
if useCheckmark {
- if !hbits.isMarked() {
+ if !mbits.isMarked() {
printlock()
print("runtime:greyobject: checkmarks finds unexpected unmarked object obj=", hex(obj), "\n")
print("runtime: found obj at *(", hex(base), "+", hex(off), ")\n")
}
} else {
// If marked we have nothing to do.
- if hbits.isMarked() {
+ if mbits.isMarked() {
return
}
- hbits.setMarked()
+ mbits.setMarked()
// If this is a noscan object, fast-track it to black
// instead of greying it.
// Previously we put the obj in an 8 element buffer that is drained at a rate
// to give the PREFETCH time to do its work.
// Use of PREFETCHNTA might be more appropriate than PREFETCH
-
- gcw.put(obj)
+ if !gcw.putFast(obj) {
+ gcw.put(obj)
+ }
}
// gcDumpObject dumps the contents of obj for debugging and marks the
if useCheckmark && !gcBlackenPromptly { // The world should be stopped so this should not happen.
throw("gcmarknewobject called while doing checkmark")
}
- heapBitsForAddr(obj).setMarked()
+ markBitsForAddr(obj).setMarked()
gcw := &getg().m.p.ptr().gcw
gcw.bytesMarked += uint64(size)
gcw.scanWork += int64(scanSize)