diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 4014bd35547..26e511d495f 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -505,17 +505,6 @@ func (h heapBits) isPointer() bool { return h.bits()&bitPointer != 0 } -// hasPointers reports whether the given object has any pointers. -// It must be told how large the object at h is for efficiency. -// h must describe the initial word of the object. -func (h heapBits) hasPointers(size uintptr) bool { - // TODO: Use span.noScan instead of the heap bitmap. - if size == sys.PtrSize { // 1-word objects are always pointers - return true - } - return (*h.bitp>>h.shift)&bitMarked != 0 -} - // isCheckmarked reports whether the heap bits have the checkmarked bit set. // It must be told how large the object at h is, because the encoding of the // checkmark bit varies by size. diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index c6de4d07e5b..1b364b39f20 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -1227,7 +1227,7 @@ func greyobject(obj, base, off uintptr, hbits heapBits, span *mspan, gcw *gcWork atomic.Or8(mbits.bytep, mbits.mask) // If this is a noscan object, fast-track it to black // instead of greying it. - if !hbits.hasPointers(span.elemsize) { + if span.spanclass.noscan() { gcw.bytesMarked += uint64(span.elemsize) return }