heapBits.bits is carefully written to produce good machine code. Use
it in heapBits.morePointers and heapBits.isPointer to get good machine
code there, too.
Change-Id: I208c7d0d38697e7a22cad67f692162589b75f1e2
Reviewed-on: https://go-review.googlesource.com/22630
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
// are scalars.
// h must not describe the first or second word of the object.
func (h heapBits) morePointers() bool {
- return *h.bitp&(bitMarked<<h.shift) != 0
+ return h.bits()&bitMarked != 0
}
// isPointer reports whether the heap bits describe a pointer word.
// nosplit because it is used during write barriers and must not be preempted.
//go:nosplit
func (h heapBits) isPointer() bool {
- return (*h.bitp>>h.shift)&bitPointer != 0
+ return h.bits()&bitPointer != 0
}
// hasPointers reports whether the given object has any pointers.